
Additionally, the X++ compiler generates some extra IL to support certain features, which can be ignored. Typically, more tweaking is needed since you will likely be using some platform/foundation/appsuite objects and code, and don’t want code coverage to show up for those. To enable code coverage for X++ code in your test automation, a few things have to be setup. For many it worked, for others this did not work at all no matter what they tried… I have not been able to spend more time on investigating why for some people this doesn’t work. Note that after this was published, I received a mixed response from developers. Depending on which code editor you use, you only need to install and configure the right extensions to fully integrate code coverage into your development loop.Since the AXDEVALM blog has been removed from MSDN, I will repost the code coverage blog post here AS-IS (other than wrong capitalization in the XML code), until we can get better official documentation. The project templates are already fully preconfigured for it. NET has made great progress in many respects. To make them work with Coverlet, you must include the following settings in the. Coverage Gutters to visualize the code coverage results.If you are using Visual Studio Code, then you should install the following extensions: The results are also automatically displayed in the gutter of the code editor window:

Simply run the tests from the Test Explorer window and open the Fine Code Coverage tool window to see the results: With this, you do not need to run a special command to get the coverage report. If you do not have Visual Studio 2022 Enterprise, you can install the Fine Code Coverage extension instead. Using the Show Code Coverage Coloring button in the toolbar of this window, you can also view the results by coloring the code in the code editor window:

You can then view the report in the Code Coverage Results tool window: via the Analyze Code Coverage context menu item for tests in the Test Explorer window.via the Test > Analyze Code Coverage for All Tests menu item,.If you are using Visual Studio 2022 Enterprise, you can create a code coverage report in one of two ways: There is a built-in code coverage feature in Visual Studio 2022, but unfortunately it is only available in the Enterprise edition.

Let us take a look at how you can use this in your code editor. NET 5, the llector NuGet package is pre-installed in the test project templates, which can generate code coverage reports when the tests are executed.
