官术网_书友最值得收藏!

Test Tool

Goal: Understand what the Test Tool entails and learn how to use and apply it.

The Test Tool is a standard application feature that allows you to manage and run the automated tests that reside in the database, and collect their results, be they test codeunits that belong to the standard application or that are part of extensions. With the various hands-on example tests, we will be using this tool a lot. However, before we do this, let's elaborate a little bit on it.

You can easily access the Test Tool using the TELL ME WHAT YOU WANT TO DO feature in Dynamics 365 Business Central, as displayed in the following screenshot:

When in a clean database, or at least a database or company where the Test Tool has not been used yet, this is how the Test Tool appears. A suite called DEFAULT with no records in it appears, as seen as follows:

To populate the suite take the following steps:

  1. Select the Get Test Codeunits action.
  2. On the dialog that opens, you have the following two options:
    • Select Test Codeunits: This will open a list page showing all test codeunits that are present in the database from which you can select specific test codeunits; once you have selected and clicked OK, these codeunits will be added to the suite
    • All Test Codeunits: This will add all test codeunits that exist in the database to the test suite

Let's select the first option, Select Test Codeunits. This will open the CAL Test Get Codeunits page. Unsurprisingly, it shows the four test codeunits we have created in Chapter 2, The Testability Framework, followed by the long list of over 700 standard test codeunits:

  1. Select the four test codeunits 60000 through 60003 and click OK.

The suite now shows for each test Codeunit a line with LINE TYPE = Codeunit and, linked to this line and indented, all its test functions (LINE TYPE = Function) as shown in the following screenshot:

  1. To run the tests, select the Run action.
  1. On the following dialog that opens, with options Active Codeunit and All, select All and press OK. Now all four test codeunits will be run and each test will yield a result, Success or Failure:

Had we selected the option Active Codeunit only, the selected codeunit would have been executed.

For each failure, the First Error field will display the error that caused the failure. As you can see, First Error is a FlowField. If you drill down into it, the CAL Test Result window opens. This displays the whole test run history for a specific test.
Note that the message dialog in MyFirstTestCodeunit yields an Unhandled UI error.

Running the test by selecting Run will call the standard test runner codeunit CAL Test Runner (130400) and will make sure that the following happen:

  • Tests run from the Test Tool will be run in isolation
  • The results of each test function will be logged

In this short overview of the Test Tool, we used the following features:

  • Get test codeunits
  • Creating multiple test suites

When diving into test coding, the Test Tool will be our companion. There we will be using various other features of it, including the following:

  • Run selected
  • Drilling into the test results
  • Referencing the call stack
  • Clearing the results
  • Test coverage map

Regarding on-premises installation: The Test Tool can be accessed and executed using an end-user license. This has been enabled since the fall of 2017.

主站蜘蛛池模板: 大丰市| 东乌| 甘德县| 健康| 阳原县| 屏东市| 天峻县| 乐陵市| 长泰县| 九江市| 杂多县| 枣庄市| 中西区| 赣榆县| 凉山| 浠水县| 竹北市| 苍溪县| 垣曲县| 仙桃市| 承德县| 宜春市| 阿勒泰市| 溧水县| 寻甸| 锡林郭勒盟| 石嘴山市| 金山区| 肥乡县| 克什克腾旗| 蕉岭县| 当雄县| 宁化县| 仁寿县| 措勤县| 宜君县| 横山县| 滦南县| 报价| 西乌珠穆沁旗| 仙游县|