Table of contents

Contents



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 tests (unit or UI) using MSBuild tasks, you can add an extra task to see test results in XML JUnit format:

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

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.

Step 1) Run unit tests step

Add JUnitTestFilePath parameter in MSBuild:

image_201931311026_1_png

By default, if a test fails, the RunTests task will be marked as failed as well. To prevent be marked as failed and process test results, the additional parameter /p:AllowFailedTests="true" must be set on this step.

Make sure that the Jenkins' 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):

image_201931311235_1_png

Results

You will start viewing Test results :

image_20181119202443_1_png

and trends...

image_201931311944_1_png

 


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant