8
votes

When using the Visual Studio Test task in Release Management, the release always returns:

No test assemblies found matching the pattern

currently Test Assembly is set to: **\*test*.dll;-:**\obj\**

I have tried multiple defaults like $(System.DefaultWorkingDirectory), etc.

The documentation I've been able to find is either not current with the existing layout of tasks, (such as the Publish Build Artifacts screen no longer containing the Contents box), is for the on premise Visual Studio 2015, or related specifically to the Build.

I've read and attempted the following:

UPDATE: I added a step to the build to Copy and Publish the test.dlls. They are now located. They all fail, due to missing other code, but they are located.

UPDATE II: My 3_Run_Tests.log file contains the following clues:

Error calling Initialization method for test class ... To run tests that interact with the desktop, you must set up the test agent to run as an interactive process.

Test Run deployment issue: The assembly or module ... directly or indirectly referenced by the test container ... was not found.

Because of the above, I am going to accept @eddie-msft's answer.

2
Can you confirm that the test assemblies are being published as artifacts and are getting pushed to the $(Agent.ReleaseDirectory) folder? - Daniel Mann
Which test framework? - jessehouwing
Whatever the default is with the Visual Studio Test task. - Joshua Drake
@JoshuaDrake The question was "What testing framework are your tests using?" - Daniel Mann
@DanielMann and that is the answer, I have not done anything aside from adjust the value in the Test Assembly textbox. The VSTest version is Latest. I guess in this case the MS testing framework might be the appropriate reply, but since it has all been subsumed into VS or RM, I hardly think of it as a Framework any more. - Joshua Drake

2 Answers

5
votes

You need to make sure that the complied file of the project which you'd like to test is also been copied and published to the same path with Test Assembly. The test will fail if only Test Assembly is copied.

I assume you are working on a C# project, in the step to copy test assembly, you can set the copy content as this:

**\YourTestProjectName\bin\$(BuildConfiguration)
0
votes

I have been having a similar issue. Multiple projects in build and the test file would not be found.

No test assemblies found matching the pattern *test*.dll;-:\obj**

Fix: added additional build step "build solution" and "Copy Files to". This build was pointed to VS solution file with automated test. "Copy Files to" was left at default