Junit for Jenkins

Unofficial Content

Get test case execution results in JUnit Format

Running tests in batch mode is achived by using msbuild test tasks

This is usefull in CI Tools like Jenkins since they can read this xml files and show test cases 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" />
</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 start, make sure you install Junit reporting plugin in Jenkins located here.

 

Step 1) Run unit tests step

Add JUnitTestFilePath parameter in msbuild:

image_201931311026_1_png

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

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

Use the Junit plugin pointing to 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