1

I've written 6 tests using Xunit for the first time.

[Fact] 
public void test_1()...
[Fact] 
public void test_2()...
[Fact] 
public void test_3()...
[Fact] 
public void test_4()...
[Fact] 
public void test_5()...
[Fact] 
public void test_6()...

Following this post Can Visual Studio 2010 Test Runner run XUnit? I was able to add the xunit console as an external tool in VS 2010.

However, when I click on the Xunit Test menu item I get the following results, shouldn't it say Tests complete : 6 of 6? why is it saying 1 of 1?

xUnit.net console test runner (64-bit .NET 4.0.30319.296)
Copyright (C) 2007-11 Microsoft Corporation.

xunit.dll:     Version 1.9.1.1600
Test assembly: C:\Users\...\MyProject-MVC\MyProject.Tests\bin\Debug\MyProject.Tests.dll

Tests complete: 1 of 1
1 total, 0 failed, 0 skipped, took 0.311 seconds
Community
  • 1
  • 1
SOfanatic
  • 5,523
  • 5
  • 36
  • 57
  • what happens when you run your assembly with xUnit console/gui outside VS? – Dima Apr 27 '13 at 18:25
  • have you build your solution before runnig tests? – Dima Apr 27 '13 at 18:27
  • I dont know how to run the dll outside of VS. I did build the solution and the build was successful – SOfanatic Apr 27 '13 at 18:57
  • 1
    http://stackoverflow.com/questions/16214684/why-is-the-xunit-runner-not-finding-my-tests?rq=1 ? Dous the VS xUnit plugin find them? – Ruben Bartelink Apr 27 '13 at 21:04
  • @RubenBartelink downloading `TestDriven.Net` resolved my issue... I'm not sure what was happening but now it's saying `Tests complete: 6 of 6` Thanks... voting up your comment. – SOfanatic Apr 27 '13 at 23:58
  • @SOfanatic Are you sure one of your [nested] test classes are not private ? Sounds like you need to be a SO Fanatic and a) read my answer b) upvote it :D (Or are you saying that the console runner has now magically started working - coz if that is the case, it's worth understanding why?) – Ruben Bartelink Apr 28 '13 at 07:03
  • my class is not private I have even made it public to make sure. And so far I only have the one class in my test project. TestDriven.net gives me the option to right click on the test class and run the tests. Not sure whats going on... it's like the test dll only had one test? – SOfanatic Apr 28 '13 at 14:19
  • Is TD.NET saying Adhoc or xUnit? Are the other runners running all the tests now? – Ruben Bartelink Apr 28 '13 at 20:16
  • @RubenBartelink Please scratch my last comments I had been moving around stuff so much trying to get the tests to work that I did not re-compile the test after making my classes public. Your post is correct, after making my test class public, it xUnit with VS external tool worked fine. I just had to build my dll again. – SOfanatic Apr 28 '13 at 20:53

1 Answers1

1

@rubenbartelink 's answer was the correct one. My main test class was private, in other words, it wasn't explicitly public.

Details: Why is the xUnit Runner not finding my tests

Community
  • 1
  • 1
SOfanatic
  • 5,523
  • 5
  • 36
  • 57