I have a build definition in an on-premise Azure Dev Ops team project. This build definition has a VsTest task that runs unit tests compiled earlier in the build definition.
The issue we're having is the task fails even if all tests pass. The selector we're using to find the test assemblies initially tried to run tests in an assembly that used NUnit. We've filtered those out but that hasn't resolved the issue.
I've turned on the diagnostic logging for the test task but we're not finding any exceptions or error messages.
2020-04-06T20:11:39.0722884Z Test Run Failed.
2020-04-06T20:11:39.0724468Z Total tests: 5470
2020-04-06T20:11:39.0725088Z Passed: 5470
2020-04-06T20:11:39.0743719Z Total time: 8.9587 Minutes
2020-04-06T20:11:39.0908399Z ##[warning]Vstest failed with error. Check logs for failures. There might be failed tests.
2020-04-06T20:11:39.1165840Z ##[error]Error: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions\TestPlatform\vstest.console.exe failed with return code: 1
2020-04-06T20:11:39.5322019Z ##[error]VsTest task failed.
I previously had NUnit tests being used but those have been filtered. I've tried updating the NuGet references to the mstest adapters, as well.
Any ideas would be appreciated.
For this issue, it could be a problem of the test adapter throwing due to a misconfiguration. If the dll file you provide does not contain any tests, this will cause the test dll filter to pick up the wrong dll that caused the above error.
You need to carefully check your log to find the dll file that does not contain test, and the Test files path filter you specified. Then you can resolve this error by excluding this dll from vstest / the Test Assemblies step.
Here are some cases with similar issue you can refer to :