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

Standard libraries

Goal: Get to know the basics about the standard test helper libraries provided by Microsoft.

Supporting their standard tests, Microsoft has created a nice and very useful collection of helper functions in more than 70 library codeunits. These helper functions range from random data generations and master data generation to standard generic and more specific check routines.

Need a new item? You might make use of the CreateItem or CreateItemWithoutVAT helper functions in Library - Inventory (codeunit 132201).

Need a random text? Use the RandText helper function in Library – Random (codeunit 130440).

Want to get the same formatted error messages when verifying your test outcome? Use one of the helper functions in the Assert (codeunit 130000), such as IsTrue, AreNotEqual, and ExpectedError.

A frequently reappearing question during my workshops is:

How do I know if these libraries contain a helper function I need in my own test? Is there an overview of the various helper functions?

Unfortunately, there is no overview of all available helper functions for Dynamics 365 Business Central. However, up to NAV 2018, a .chm help file containing this information was included in the TestToolKit folder on the product DVD. You might want to make use of this, but I always use a very simple method. Having all our code in a source code management system, I can do a quick file search in the standard test objects folder. In case I need a helper that will create me a service item, I might open VS Code on that folder and search for CreateServiceItem, as shown in the following screenshot:

In Section 3Designing and Building Automated Tests for Microsoft Dynamics 365 Business Central, of this book, when building tests, we will happily make use of various standard helper functions, making our work much more efficient and consistent.

At this very moment, the standard test library objects are to be found in the following ID ranges:
130000 to 133999: w1 test helper libraries
Note that all test tool objects also reside in the lower part of this range:
140000 to 143999: local test helper libraries
主站蜘蛛池模板: 莱芜市| 南召县| 措勤县| 洛川县| 华亭县| 工布江达县| 陵川县| 垣曲县| 利辛县| 卫辉市| 沙河市| 隆德县| 南汇区| 岳阳县| 香港 | 镇宁| 张北县| 阳东县| 晋江市| 丰顺县| 大兴区| 泰顺县| 邵阳县| 五家渠市| 长子县| 青州市| 万盛区| 上蔡县| 成安县| 渭源县| 松桃| 宽甸| 裕民县| 荣昌县| 龙海市| 苏尼特左旗| 民权县| 二连浩特市| 大同县| 尉犁县| 绵阳市|