1
Vote

Discovery failing with vstest.console.exe

description

I'm not able to use the xUnit test adapter to discover tests when running as part of vstest.console.exe. I've got this all working fine on several dev boxes, but I'm not able to get our CI boxes to discover anything during our unit test build. This is using the 0.99.8 vsix in VS 2012, and also tested with 0.99.7. The test dlls are being built with the latest beta nuget xunit package (v2.0.0.2738). The test dll is targeted at 4.5.

I have boiled it down to the simplest possible scenario, a single test dll with a single test class. Our command line is succeeding in finding the 1 test on a few dev boxes, but testing the changes on a few of our CI boxes have not been successful so far. I've followed the steps here to enable tracing a vstest discoveryengine tptrace log file, and everything looks fine. I have baselined this against machines that are working, and there's nothing that jumps out.

Is there any more traceability available for the actual discovery process? That seems to be the step that is falling down.What else is there I can try out to get this discovery working?

An example command line is:
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools..\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" /settings:D:\foldername\unittests.runsettings /UseVsixExtensions:true /logger:trx /enablecodecoverage D:\foldername\inst\Test\Unit\Test.Unit.xUnitSmoke.dll

Any ideas here much appreciated. This is currently a showstopper for a new stack of unit tests, and I'm dead keen to get xUnit in place over mstest

file attachments

comments

bartelink wrote Oct 29, 2014 at 11:54 AM

Best to ask on GitHub (where the code and issues have moved to) (Or SO if you need a quick answer)

eddiesholl wrote Oct 30, 2014 at 7:23 AM

Thanks. I have managed to troubleshoot the issue, results written up on my SO post.

I'll follow up over on github with the runsettings issue I encountered.

bartelink wrote Oct 30, 2014 at 9:36 AM

:thumbsup: :P

pmiossec wrote Jan 8, 2015 at 3:06 PM

It takes me to find the solution, so I think it worth the time to explain how I did for everyone...

The first step is to follow what is explained here to install the pre-release "xunit.runner.visualstudio" nuget package in the xunit projects that need it to be able to run the xunit test from Visual Studio.

Then, when you run your "vstest.console.exe" command, you MUST use the parameter "/TestAdapterPath".

Your command line should look like something (the path toward the xunit adapter is here relative so, you could put it in absolute or adapt depending on the active directory):
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" c:\path\to\your\assembly.to.test.dll /TestAdapterPath:".\packages\xunit.runner.visualstudio.0.99.9-build1021\build_common\"

For information, it works also with NUnit, nuget package "NUnitTestAdapter" and the command
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" c:\path\to\your\assembly.to.test.dll /TestAdapterPath:".\packages\NUnitTestAdapter.1.2\lib"

bartelink wrote Jan 9, 2015 at 12:34 PM

@pmiossec This also recently got covered in http://stackoverflow.com/questions/16647789/unit-tests-appear-in-xunit-gui-xunit-gui-clr4-exe-but-not-vs-2012-test-explore/16657414#16657414

It;s good to have this documented but I suggest adding this and future similar things either as comments or answers on SO or on github