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

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
主站蜘蛛池模板: 泽普县| 彭州市| 平凉市| 扎赉特旗| 轮台县| 娄底市| 五常市| 奇台县| 田阳县| 阿荣旗| 洞口县| 库伦旗| 绩溪县| 宿迁市| 太湖县| 曲靖市| 湖南省| 龙游县| 邹城市| 岐山县| 平顺县| 武义县| 通山县| 宜州市| 忻城县| 沾化县| 神农架林区| 正镶白旗| 丹阳市| 桂平市| 永春县| 桦川县| 呼图壁县| 关岭| 陆良县| 波密县| 徐汇区| 司法| 绥德县| 中山市| 商河县|