Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run automated tests from test plans gives error No test sources found

I have some NUnit tests and have worked through the instructions to run Azure Test Plans. The test binaries build from a build script that links a test dll to the pipeline setup per the instructions. All appears to work with the following pipeline

enter image description here

Until step 4 of Run the automated tests which fails with errors:

No test sources found

and

[error]The slice of type 'Execution' is 'Aborted' because of the error : Microsoft.VisualStudio.TestService.VstestAdapter.TestsNotFoundException: No test assemblies found on the test machine matching the source filter criteria or no tests discovered matching test filter criteria. Verify that test assemblies are present on the machine and test filter criteria is correct.

The test logs say

Creating run for selected test assemblies with following parameters SourceFilter: *.dll TestCaseFilter:

My test assembly is actually called MyProject.Test.dll and it was built with these instructions

/p:PackageLocation="$(build.artifactstagingdirectory)\\Test\\"

In the previous step to running any test the artifacts are downloaded like this:

enter image description here

If I change the Test run type to Test assemblies in the Azure test script

enter image description here

I get an error from the Azure Test Plan run saying

enter image description here

However, it's possible to "release" the new test script, which appears to succeed like this

enter image description here

Though in reality there was a similar error, fixed later below:

[warning]No test assemblies found matching the pattern: **\bin\x64\Release\*Test*.dll.

The NUnit test run fine from Visual Studio, they build ok, but I can't trigger them to run from the Azure Devops, aaargh. There were 2 problems there:

  1. There was no build task to copy dll and config libraries to the $(build.artifactstagingdirectory)\\Test\\ directory. I added a "copy files" task to the build script.

enter image description here

  1. Once that was done I could see in the "Download Artifacts" stage that test libraries were downloaded to the test directory

enter image description here

I set the release pipeline search folder to include the path to the downloaded artifacts

enter image description here

Now the Test Assemblies run via a "release"

enter image description here

How can I run this using the Test Run selection?

enter image description here

There is still error:

[error]The slice of type 'Execution' is 'Aborted' because of the error : Microsoft.VisualStudio.TestService.VstestAdapter.TestsNotFoundException: No test assemblies found on the test machine matching the source filter criteria or no tests discovered matching test filter criteria. Verify that test assemblies are present on the machine and test filter criteria is correct

enter image description here

like image 848
rupweb Avatar asked Dec 28 '25 19:12

rupweb


1 Answers

I had the same error:

##[error]ExecutionAndPublish.Run : Microsoft.VisualStudio.TestService.VstestAdapter.TestsNotFoundException: No test assemblies found on the test machine matching the source filter criteria or no tests discovered matching test filter criteria. Verify that test assemblies are present on the machine and test filter criteria is correct.

The problem was solved after clean Automated test storage and associate the tests again.

https://learn.microsoft.com/en-us/azure/devops/test/associate-automated-test-with-test-case?view=azure-devops

like image 56
João Calado Avatar answered Dec 30 '25 23:12

João Calado