osoftware / NSpecTestAdapter

NSpec Test Adapter for Visual Studio
MIT License
5 stars 5 forks source link

What's the test name to be passed to vstest.console.exe on command-line #10

Closed BrainCrumbz closed 9 years ago

BrainCrumbz commented 9 years ago

We're working on a local fork of this adapter in order to speed it up (BTW, we see already great results both in discovery and execution phases).

In order to verify that things work, we're running adapter against some sample spec DLL both from Visual Studio and also from command line through vstest.console.exe. To try with the execution of a subset of tests (basically ITestExecutor.RunTests(IEnumerable<TestCase> tests, ...), the additional command-line parameter to apply is:

/Tests:[ test name ] 

so for example (all on a single line):

vstest.console.exe 
  "C:\Path\To\Dll.dll" 
  /UseVsixExtensions:true 
  /Tests:TestMethod1,testMethod2

Now, we cannot figure out what exact is the name of a testcase with such adapter. We tried different strings in place of TestMethod1, but with no luck. Somethimes vstest warns us that no test was found, sometimes it just runs without any warning.

So, say that a testcase is found in:

class test_RemoteSettingsApi : nspec
{
   void Given_response_fails()
   {
     it["Should throw"] = () => { };
     ...

That is listed in VS Test Explorer as:

test RemoteSettingsApi > Given response fails > Should throw.

What should we put on command-line in order to run just that spec? (Beside the issue #3 )

Of course you'll be able to check that as soon as we publish something more polished, and hopefully you'll be happy to receive a PR.

BrainCrumbz commented 9 years ago

Nevermind, we thought "why not have a look at the tests?" :)

BTW, for anyone coming here looking for same answer, the test name should be:

nspec. test RemoteSettingsApi. Given response fails. Should throw.

and hence the command line should report that in quotes (period included):

vstest.console.exe 
  "C:\Path\To\Dll.dll" 
  /Tests:"nspec. test RemoteSettingsApi. Given response fails. Should throw."
  /UseVsixExtensions:true