3

I have added a release definition in Visual Studio Team Services to deploy an application to a Azure cloud service. I'm trying to run some integration tests after a successful deployment:

enter image description here

But unfortunately tests are not run:

Warning: No test is available in C:\a\301532a74\Build\Api.Web.IntegrationTests\Api.Web.IntegrationTests.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again. Information: Additionally, you can try specifying '/UseVsixExtensions' command if the test discoverer & executor is installed on the machine as vsix extensions and your installation supports vsix extensions. Example: vstest.console.exe myTests.dll /UseVsixExtensions:true ##[warning]No results found to publish. 

I have installed the NUnit Test Adapter (nuget package) for all projects containing tests (unit tests and integration tests). The weird thing is that I am able to run the tests as part of a build but not as part of a release.

I also tried to set the Path to Custom Test Adapters but it doesn't seem to make a difference.

What I am missing here? Is there a better way to run some integration tests as part of a release?

4
  • Is this NUnit 2 or 3? If 3, are you using the CTP9 package released this weekend? There was an issue with CTP8. Commented Apr 4, 2016 at 12:22
  • NUnit 2.6.4. I have the most recent version of NUnitTestAdapter installed. Commented Apr 4, 2016 at 13:18
  • What build agent are you using? Hosted or your own? Commented Apr 5, 2016 at 1:58
  • @Eddie-MSFT: I'm using the hosted agent Commented Apr 5, 2016 at 7:51

3 Answers 3

3

This is usually caused by the NUnit test adapter cannot be found by VSTest.

Usually, In "Build" environment, NUnit test adapter is restored in working folder by nuget, so VSTest can find it during the testing. But in "Release" environment, NUnit test adapter does not exist by default. So you need to update your build definition to upload the NUnit test adapter files to "drop" and the NUnit test adapter will be avaiable in "Release" environment after the artifacts is downloaded. Then you can set the "Path to Custom Test Adapters" to "$(System.DefaultWorkingDirectory)\" and try again.

If you are using your own build agent, you can also place the NUnit Test Adapter in a permanent path that the build agent can access and set the "Path to Custom Test Adapters" to it. Or install NUnit test adapter extension for VS on the build agent and enter "/UseVsixExtensions:true" in "Visual Studio Test\Other console options".

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Eddie. I already tried to copy the adapter assembly to the same folder as the tests assembly and set the "Path to Custom Test Adapters" with no luck, maybe I missed something. Unfortunately I cannot install the NUnit Test Adapter extension because I'm using Visual Studio Team Services (aka Visual Studio Online)
@RuiJarimba How many files do you copy? Can you share a screenshot for all the files in the artifact folder?
Sorry for the late reply. I solved my problem and posted the solution, thanks a lot for the help :-)
3

I have found a solution for my problem, based on Eddie's suggestions:

Step 1 - Copy all NUnit assemblies to the output folder of the test project (set the Copy Local property to True)

NUnit assemblies

enter image description here

Step 2 - Create an artifact that will contain all files of the bin folder of the test project. This will contain not only the test assemblies but also the NUnit assemblies

enter image description here

Step 3 - In the test task, set the Path to Custom Test Adapters to the artifacts folder that contains the test assemblies and the NUnit adapters assemblies

enter image description here

That's it! Next time you create a release and deploy to any environment tests will be executed.

Comments

0

My problem was that i didn´t have a testrunner for NUnit installed at all, since I´m using resharpers testrunner.

Therefore my solution was as simple as adding the nuget package, "NUnit3TestAdapter" version="3.4.0", to my test project.

In visualstudio.com (VS online) "Nuget restored adapters are automatically searched for." and you need not/should not specify a path for "Custom Test Adapters" - I don´t know if this also works for NUnit test adapter version 2.

1 Comment

Please note that I want to run the tests after a DEPLOYMENT, not as part of a build. Please read my question, all details are specified there.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.