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

Test runner

Like any other codeunit, a test runner codeunit can have a OnRun trigger and normal user-defined functions, but, in addition to that, you can also add two test runner-specific triggers called OnBeforeTestRun and OnAfterTestRun. When test codeunits are called from the OnRun trigger of a test runner, OnBeforeTestRun and OnAfterTestRun will be triggered by the system as follows:

  • OnBeforeTestRun: This is triggered before the test codeunit is called, the test codeunit OnRun trigger is executed, and each of its test functions is run
  • OnAfterTestRun: This is triggered after each test function has run and the test codeunit finishes

Use the OnBeforeTestRun trigger to perform a test run pre-initialization and control the execution of a whole test codeunit and individual test functions. The latter can be achieved by using the Boolean return value of the OnBeforeTestRun trigger. Returning TRUE, the test codeunit or test function runs. Returning FALSE, it is skipped.

Use the OnAfterTestRun trigger to perform post-processing, such as logging the result of each test. When the OnAfterTestRun trigger is run, the standard result message box, as we have seen so far, is not shown.

Both OnBeforeTestRun and OnAfterTestRun are run in their own database transaction. This means that changes made to the database with each of these triggers are committed once their execution finishes.

主站蜘蛛池模板: 鄂州市| 丹江口市| 察隅县| 怀远县| 永安市| 沭阳县| 龙泉市| 平遥县| 蓬溪县| 凤山县| 漳州市| 宣化县| 泸西县| 沐川县| 忻州市| 金堂县| 大同县| 华容县| 和龙市| 临猗县| 石门县| 青海省| 平舆县| 长汀县| 当阳市| 柯坪县| 大兴区| 兰溪市| 封丘县| 三台县| 改则县| 鄂州市| 阳谷县| 民权县| 孟津县| 柘荣县| 林甸县| 三河市| 盱眙县| 五大连池市| 大安市|