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

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
主站蜘蛛池模板: 玛沁县| 寻乌县| 阳泉市| 利津县| 常山县| 原平市| 南安市| 汽车| 红原县| 遂溪县| 邹城市| 龙江县| 荃湾区| 大关县| 常宁市| 宁城县| 札达县| 济阳县| 泾阳县| 克东县| 新丰县| 阳泉市| 赤壁市| 民丰县| 东阳市| 普定县| 砚山县| 天柱县| 彭阳县| 景东| 阜城县| 武强县| 珲春市| 洪湖市| 漳平市| 日照市| 登封市| 随州市| 颍上县| 江西省| 讷河市|