Problem
After hours of searching, I'm unable to find the root cause of Azure Pipelines failing to execute my various unit tests. These tests build and run locally with no warnings or issues, but will not run within my Azure Pipeline. I've seen many similar issues, but the vast majority of them regard Pipelines failing to find the test dll's in the first place (often due to an incorrect test name pattern). However, this is not the case with my situation. Pipelines has no problem locating the dll's, and even lists each one by name. Pipelines then fails to execute any of the tests in these dll's and throws an error that will be detailed in the full output below.
Full Output
##[section]Starting: Unit Tests
==============================================================================
Task : Visual Studio Test
Description : Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VsTest) runner. Test frameworks that have a Visual Studio test adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests using QUnit, Mocha and Jasmine), etc. can be run. Tests can be distributed on multiple agents using this task (version 2).
Version : 2.153.9
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/test/vstest
==============================================================================
SystemVssConnection exists true
##[warning]Unable to get feature flag: TestExecution.EnableHydra
SystemVssConnection exists true
##[warning]Unable to get feature flag: TestExecution.EnableTranslationApi
SystemVssConnection exists true
##[warning]Unable to get feature flag: TestExecution.EnableDiagnostics
Running tests using vstest.console.exe runner.
======================================================
Test selector : Test assemblies
Test filter criteria : null
Search folder : C:\agent\_work\34\s
VisualStudio version selected for test execution : latest
Attempting to find vstest.console from a visual studio installation.
Run in parallel : false
Run in isolation : false
Path to custom adapters : null
Other console options : null
Code coverage enabled : true
Diagnostics enabled : false
SystemVssConnection exists true
Run the tests locally using vstest.console.exe
========================================================
Test selector : Test assemblies
Test assemblies : **\release\**\*UnitTests.dll,**\release\**\**\*UnitTests.dll,!**\obj\**
Test filter criteria : null
Search folder : C:\agent\_work\34\s
Run settings file : C:\agent\_work\34\s
Run in parallel : false
Run in isolation : false
Path to custom adapters : null
Other console options : null
Code coverage enabled : true
Diagnostics enabled : false
Rerun failed tests: false
VisualStudio version selected for test execution : latest
Attempting to find vstest.console from a visual studio installation.
========================================================
======================================================
[command]"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" @C:\agent\_work\_temp\2c095351-b2dc-11eb-b929-bff4d6da517a.txt
Microsoft (R) Test Execution Command Line Tool Version 16.7.0
Copyright (c) Microsoft Corporation. All rights reserved.
vstest.console.exe
"C:\agent\_work\34\s\Source\bin\Release\Service1.UnitTests\Service1.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Service2.UnitTests\Company.Service2.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Service3.UnitTests\Service3.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Service4.UnitTests\Company.Service4.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Service5.UnitTests\Company.Service5.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Service6.UnitTests\Company.Service6.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Service7.UnitTests\Company.Service7.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Service8.UnitTests\Company.Service8.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Service9.UnitTests\Company.Service9.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Company.Service10.UnitTests\Company.Product.Service10.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Company.Service11.UnitTests\Company.Service11.UnitTests.dll"
"C:\agent\_work\34\s\Source\bin\Release\Service12\Company.Service9.UnitTests.dll"
/EnableCodeCoverage
/logger:"trx"
/TestAdapterPath:"C:\agent\_work\34\s"
Starting test execution, please wait...
M i c r o s o f t ( R ) C o v e r a g e C o l l e c t i o n T o o l V e r s i o n 1 6 . 0 . 3 0 3 1 9 . 2 0 0
C o p y r i g h t ( c ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .
2.6157
A total of 12 test files matched the specified pattern.
No test is available in C:\agent\_work\34\s\Source\bin\Release\Service1.UnitTests\Service1.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Service2.UnitTests\Company.Service2.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Service3.UnitTests\Service3.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Service4.UnitTests\Company.Service4.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Service5.UnitTests\Company.Service5.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Service6.UnitTests\Company.Service6.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Service7.UnitTests\Company.Service7.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Service8.UnitTests\Company.Service8.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Service9.UnitTests\Company.Service9.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Company.Service10.UnitTests\Company.Product.Service10.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Company.Service11.UnitTests\Company.Service11.UnitTests.dll C:\agent\_work\34\s\Source\bin\Release\Service12\Company.Service9.UnitTests.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
M i c r o s o f t ( R ) C o v e r a g e C o l l e c t i o n T o o l V e r s i o n 1 6 . 0 . 3 0 3 1 9 . 2 0 0
C o p y r i g h t ( c ) M i c r o s o f t C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .
Results File: C:\agent\_work\34\s\TestResults\result.trx
Attachments:
C:\agent\_work\34\s\TestResults\result_coverage.coverage
No Result Found to Publish 'C:\agent\_work\34\s\TestResults\result.trx'.
##[section]Async Command Start: Publish test results
##[section]Async Command End: Publish test results
##[section]Finishing: Unit Tests