Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests not discoverable in VS 2017 #31

Closed
neoistheone123 opened this issue Apr 25, 2017 · 6 comments
Closed

Tests not discoverable in VS 2017 #31

neoistheone123 opened this issue Apr 25, 2017 · 6 comments

Comments

@neoistheone123
Copy link

Despite installing Nuget package xunit.visualstudio.runner, the test is still not discoverable. When I use [Fact], it finds the test. What is the difference here?

@Suremaker
Copy link
Collaborator

Hello,

I just tried it out in Visual Studio 2017 Community Edition 15.1 (26403.3).

I have created two projects:

  • xUnit Test Project (.NET Core)
  • Class Library (.NET Framework 4.6.2)

In both I added following packages (plus their dependencies):

  • LightBDD.XUnit2 2.1.0
  • xunit.runner.visualstudio 2.2.0

With that setup, when I added following code, I was able to run test from both, Resharper 2017.1.1 as well as from standard Visual Studio runner:

using LightBDD.Framework.Scenarios.Extended;
using LightBDD.XUnit2;
using Xunit.Abstractions;
[assembly: LightBddScope]

namespace MyTestProject1
{
    public class My_feature : FeatureFixture
    {
        public My_feature(ITestOutputHelper output) : base(output)
        {
        }

        [Scenario]
        public void My_scenario()
        {
            Runner.RunScenario(_ => Hello_world());
        }

        private void Hello_world()
        {
        }
    }
}

Please ensure that you have [assembly: LightBddScope] added to test project, there is no mismatch between xunit versions (as well as all referenced LightBDD packages are of 2.1.0 version).

I hope it will help.

@neoistheone123
Copy link
Author

I tried running your example...it's still not discovered in VS17 test explorer. Can you confirm Test Explorer is displaying it?

@Suremaker
Copy link
Collaborator

I have attached sample solution with 2 projects:
LightBDD_VS2017.zip

On my VS 2017 with spec mentioned in first response, I am able to run the tests:
vs2017_test_run

@Suremaker
Copy link
Collaborator

I have also updated my VS to the newest version and checked that project works:
vs2017_26403 7

I had to recompile the project however, as it looked like it did not caught up immediately that there are tests present.

@neoistheone123
Copy link
Author

OK. Those test cases appear. May be something on my end...

@neoistheone123
Copy link
Author

It's working now. Can't reproduce the problem anymore. Thanks for your input!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants