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

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.

主站蜘蛛池模板: 五台县| 北海市| 峡江县| 大庆市| 广饶县| 灵川县| 平潭县| 大关县| 平湖市| 乌兰浩特市| 红原县| 寿宁县| 龙里县| 藁城市| 蒲江县| 三河市| 临朐县| 辰溪县| 白河县| 苍山县| 聊城市| 黔东| 朔州市| 盖州市| 大兴区| 澄城县| 游戏| 关岭| 招远市| 苍山县| 永寿县| 镇康县| 宜都市| 绥阳县| 连州市| 台中县| 亳州市| 凤城市| 梓潼县| 高淳县| 石林|