Please wait
Talk to Expert
Microsoft Dynamics Business central

Creating and Testing a Test Codeunit in Business Central.

Picture4

Creating and testing a Test Codeunit in AL for Dynamics 365 Business Central involves several steps. Test Codeunits are used to automate the testing of your application to ensure it functions correctly.

Here’s a detailed guide on how to create and test a Test Codeunit:

Step 1

Test codeunit : Test codeunits are codeunitsthat have subtype property set to “Test”. This test methods are created inside the Test codeunit.

Step 2

We create the “Test codeunit”, as normal codeunit but define as subtype to Test and the method which we want to test using “Test tool” as created by adding [test] in before the method.

Step 3

To test the Test codeunit, we need to type, “Test tool” in “Tell me” option, then following window will be opened.

Step 4

To get the list of codeunits , select the “Get Test codeunits” action, it will display the following window.

Step 5

If we select, “All test codeunits” it will display all the test codeunits present or if we select the “ Select Test codeunits” it display a list of the “Test codeunits” as below.

Step 6

In the above list, we have created 50100, 50102 and 50113 test codeunits.

Step 7

Select the codeunit which we want to run.

Step 8

After selecting the codeunit. Then following window will be displayed.

Step 9

Select “run “ action to run the test codeunit. If the result, is success then displays a success result or else failure result along with error in “First error” column.

 

Thank you for investing your time to read our blog! We’re passionate about sharing valuable insights to help you navigate the world of Business Central.

If you’re curious about how we can assist you in reaching your goals, don’t hesitate to get in touch. Our dedicated team is ready to provide support every step of the way.

Let’s turn your vision into reality together!


Comments