2
votes

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

1

1 Answers

0
votes

According to your detailed description, the test .dll file should already exist in the corresponding folder ($(System.DefaultWorkingDirectory)/.../.../Release).

Since you could run the Test Assemblies successfully in Release Pipeline, the Search Path and filter in the VsTest Task could be right.

You need to check the .dll file connected to the test case in Test Case -> Associated Automation.

enter image description here

You need to make sure that the .dll from Automated test storage exists in your Release artifacts.

In other words, you need to make sure that the .dll in Test Case -> Automated test storage is MyProject.Test.dll

If not, you need to reconnect the correct .dll file.

Here is a doc about Associate automated tests with test cases.