Junit for Jenkins

Official Content

Get test case execution results in JUnit Format

Running test cases in batch mode is achieved by using MSBuild test tasks.

This is useful in CI Tools like Jenkins since they can read these XML files and show test case reports containing failed assertions.

Anytime you run a test using MSBuild task, you can add an extra task to see test results in XML JUnit format:

<JUnitExportTests JUnitTestFilePath="$(JUnitTestFilePath)">
      <Output TaskParameter="JUnitTestFilePath" PropertyName="JUnitTestFilePathOutput" />

This will create an XML file with the name TestResultJUnityyyy-dd-mm--hh-mm-ss.xml containing test results.

Note: This task needs to run over a previously opened KB after running test cases.

Example using Jenkins

This example uses GXtest.msbuild file (usually located on GeneXus IDE root folder).
Before starting, make sure you install the Junit reporting plugin in Jenkins located here.

Step 1) Run unit tests step

Add JUnitTestFilePath parameter in MSBuild:


Make sure that the Jenkin's user has writing privileges over the folder you want to store the test results.

Step 2) Add reporting in a "post-build" event

Use the JUnit plugin pointing to the previously used folder (in the example it is using WORKSPACE Jenkins folder):



You will start viewing Test results :


and trends...



Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.