Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't see .Net Core bitbucket pipelines test results

I finally managed to make reports of my tests in bitbucket pipeline by this command:

- dotnet test MyTests --logger "trx;LogFileName=test-reports/results.xml"

Build Teardown says:

Found matching test report file MyPath/test-reports/results.xml
Finished scanning for test reports. Found 1 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.

However, I can't see these test results file in bitbucket. I know that there should be a new tab in pipeline window or something like it. Any suggestions how to see them in a nice display window?

Didn't find any documentation or articles.

like image 278
Deivydas Voroneckis Avatar asked Sep 27 '18 15:09

Deivydas Voroneckis


2 Answers

Bitbucket pipeline accepts only JUnit xml format. You need to add JUnitTestLogger and change command to dotnet test "--logger:junit;LogFilePath=./test-reports/results.xml"

like image 151
Patrik Šebeň Avatar answered Sep 30 '22 05:09

Patrik Šebeň


I've found 3 approaches-

  1. Add the JUnitTestLogger tool and set output to JUnit This is explained in the question above by @patrik-Šebeň.

  2. Set output to TRX (included by default in dotnet test). Then use trx2junit to convert to JUnit format

  3. Add the XUnit tool and set output to XUnit. Then use xunit-to-junit to convert to JUnit format

The approach you take will probably be dictated by which ever tool is the easiest for you to install.

Also note that Pipelines tells us in the “build teardown” that it is “Searching for test report files in directories named [test-results, failsafe-reports, test-reports, surefire-reports] down to a depth of 4”. By default, dotnet test puts the results in a folder called “testresults”, so a valid directory will need to be specified with the -r (aka --reports-directory) option.

like image 44
Spongeboy Avatar answered Sep 30 '22 06:09

Spongeboy