- Automated Testing in Microsoft Dynamics 365 Business Central
- Luc van Vugt
- 241字
- 2021-06-24 14:56:54
Understanding test case design patterns
Goal: Learn the basic patterns for designing tests.
If you have been testing software, you might know that each test has a similar overall structure. Before you can perform the action under test, for example, the posting of a document, first, the data needs to be set up. Then, the action will be exercised. And finally, the result of the action has to be verified. In some cases, a fourth phase applies, a so-called teardown, which is used to revert the system under test to its previous state.
The four phases of a test case design pattern are listed as follows:
- Set up
- Exercise
- Verify
- Teardown
http://robots.thoughtbot.com/four-phase-test
This design pattern was typically the pattern used by Microsoft in the early years of C/SIDE test coding. Like the following test function example, taken from codeunit 137295 - SCM Inventory Misc. III, you will encounter it in a vast number of older test codeunits:
[Test] PstdSalesInvStatisticsWithSalesPrice()
// Verify Amount on Posted Sales Invoice Statistics
// after posting Sales Order.
// Setup: Create Sales Order, define Sales Price on Customer
Initialize();
CreateSalesOrderWithSalesPriceOnCustomer(SalesLine, WorkDate());
LibraryVariableStorage.Enqueue(SalesLine."Line Amount");
// Enqueue for SalesInvoiceStatisticsPageHandler.
// Exercise: Post Sales Order.
DocumentNo := PostSalesDocument(SalesLine, true);
// TRUE for Invoice.
// Verify: Verify Amount on Posted Sales Invoice Statistics.
// Verification done in SalesInvoiceStatisticsPageHandler
PostedSalesInvoice.OpenView;
PostedSalesInvoice.Filter.SetFilter("No.", DocumentNo);
PostedSalesInvoice.Statistics.Invoke();
- 利潤(rùn)為王+生意經(jīng)+現(xiàn)金為王+小而美(套裝共4冊(cè))
- 解碼勝任力
- 史玉柱內(nèi)部講話揭秘:營(yíng)銷教父的50個(gè)創(chuàng)業(yè)忠告
- 管理隨筆
- 方舟:數(shù)字經(jīng)濟(jì)創(chuàng)新史
- 樂高:創(chuàng)新者的世界
- 華為績(jī)效管理之道
- 領(lǐng)導(dǎo)的權(quán)威品質(zhì)
- 人力資源法律管理③:特殊員工管理
- 新媒體運(yùn)營(yíng)(微課版·第2版)
- 華為如何培養(yǎng)人:發(fā)現(xiàn)精兵、提拔干將、持續(xù)增長(zhǎng)
- 管理學(xué)原理
- 超市賣場(chǎng)定價(jià)策略與品類管理
- 高管股權(quán)激勵(lì)合約、控股股東股權(quán)質(zhì)押與資本結(jié)構(gòu)動(dòng)態(tài)調(diào)整:基于代理沖突視角
- 中國(guó)式阿米巴落地實(shí)踐之從交付到交易