问题
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-
Add the JUnitTestLogger tool and set output to JUnit This is explained in the question above by @patrik-Šebeň.
Set output to TRX (included by default in
dotnet test
). Then use trx2junit to convert to JUnit formatAdd 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