Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publishing xunit test results in Azure Devops fails with "No Result Found to Publish"

I want to publish xunit test results in an Azure Devops release pipeline using the "Publish test results" task Version 1.* and 2.*.

Although xunit test file is present and has content - I checked with ls and cat commands in the pipepline I get an error message like this:

2020-02-13T08:23:10.9093662Z Obtained XUnit Test Run Start Date: 2020-02-13T08:23:10.9092530Z and Completed Date: 2020-02-13T08:23:10.9092530Z
2020-02-13T08:23:10.9144214Z No Result Found to Publish '/home/vsts/work/r1/a/report/report.xml'.
2020-02-13T08:23:10.9149123Z Obtained XUnit Test Run Start Date: 2020-02-13T08:23:10.9148260Z and Completed Date: 2020-02-13T08:23:10.9148260Z
2020-02-13T08:23:10.9149993Z No Result Found to Publish '/home/vsts/work/r1/a/report/report1.xml'.

The two files report1.xml and report2.xml get discovered properly but Azure DevOps says No Result Found to Publishand hesitates to publish them.

like image 888
bamchris Avatar asked Feb 13 '20 08:02

bamchris


1 Answers

If you're using dotnet test task in this way:

enter image description here

You may need to set VSTest instead of Xunit in Publish Test Result Task:

enter image description here

I met same message like yours and then resolve it by changing Xunit to VSTest. I think you may encounter similar issue.

In addition:

And as I know, built-in tasks such as Visual Studio Test task and Dot NetCore CLI task automatically publish test results to the pipeline, so you actually don't need a separate Publish Test Results task in the pipeline. See this for more details.

E.g: Dotnet test task by default will generate and publish test results:

enter image description here

Hope it makes some help :)

like image 95
LoLance Avatar answered Oct 15 '22 20:10

LoLance