AX6 sneak preview – X++ Unit test improvements

These days the first milestone of AX6 is being completed. It means the first wave of new functionality has been implemented, tested and documented. As always; it is an exciting time to be working on AX…

One of the features coming in MorphX in AX6 is set of improvements in the X++ Unit Test framework.

First of all the unit test framework in AX6 is leveraging the new attribute feature in the X++ langauge. For example; you can use an attribute to declaratively specify the target class for your test (i.e. the class that is being tested by this unit test). Here is how:

class MyTestCase extends SysTestCase

Starting in AX6; you can also use attributes to mark which methods on the unit test class are test methods:

public void myTest()

If you are using both unit testing and a version control system, you can benefit from marking your most critical test methods as check-in-tests. When setting up the version control system, you can specify which test project to run during check-in, and whether to run all unit test methods, or only the unit test methods that are marked as check-in-tests. During a check-in process the specified unit tests will be executed, and only if they all succeed the check-in will be submitted. This gives you the flexibility to run the most critical unit tests during the check-in process, while still having a full suite of unit tests that can be run on-demand. Here is how to mark a method as a check-in-test:

public void myCheckInTest()


Using test projects in AX6 to group your unit tests brings even more benefits. When running the test project, you now get the results visible directly in the project as small icons – and when hovering over a failed unit test, you get the failure message. 

This posting is provided “AS IS” with no warranties, and confers no rights.

Comments (5)

  1. @Jesper. (You probably figured this out by now – but I just saw your comment).  Yes, you can define your own attributes. Just create a class that extends SysAttribute.

  2. Jesper Jensen says:

    "…X++ now supports attributes (just like C#)".

    Does this mean that you can define your own attributes ?

    We’re currently missing an option to mark a test method as "slow running".

  3. "Leveraging the new attribute feature" simply means, that X++ now supports attributes (just like C#). The unit test framework uses this new capability, to enable the author of test code to decorate test methods with attributes – instead of as in AX2009 having to return a list of hard coded methods names for the test methods.

  4. byteway says:

    Sorry for not understanding this amazing test improvement…

    But, what does "leveraging the new attribute feature" mean? In a test, will the outcome of an attribute be a initiated class?

  5. This really awesome!!! To get the results visible directly in the project as small icons is really a kewl thought…Three Cheers to Microsoft

Skip to main content