Can't see .Net Core bitbucket pipelines test results

假装没事ソ 提交于 2019-12-21 05:45:31

问题


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.


回答1:


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"




回答2:


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.



来源:https://stackoverflow.com/questions/52540799/cant-see-net-core-bitbucket-pipelines-test-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!