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

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.

主站蜘蛛池模板: 秦安县| 彭山县| 伊春市| 称多县| 京山县| 铜梁县| 赣州市| 日喀则市| 兴安盟| 固安县| 琼海市| 达日县| 连云港市| 抚州市| 九江县| 蒙阴县| 鞍山市| 玉树县| 定日县| 白朗县| 资源县| 华池县| 平乡县| 奉贤区| 镇江市| 喀喇沁旗| 杂多县| 麟游县| 永川市| 安岳县| 益阳市| 延吉市| 通山县| 东平县| 巴彦县| 姚安县| 长春市| 富顺县| 宁晋县| 盈江县| 宝应县|