UPDATE: Adding a 2019; the discovery/runner integration mechanism is same as per 2017 & 2015, so the key things that can go wrong are the same.
I've read Why is the xUnit runner not finding my tests, which covers reasons xUnit would never be able to find your tests but my problem is different - I'm confident there's nothing subtle going on with my tests; (they have worked in other environments, this seems to be just my machine) - the Visual Studio Test Runner in Visual Studio 2015 [Community Edition] is simply not showing any of my tests. I'm not doing anything remotely exciting; the tests target xUnit.net v2 on the Desktop.
I've looked in the Output window and am not seeing anything in at all under Test in the Show output from tabs.
let me know, thanks
I am using xUnit 2.2.0.
My issue was my solution was not able to find certain dlls and
app.config
was trying to resolve them. The error was not showing up in the test output window in Visual Studio.I was able to identify the error when I installed
xunit.runner.console
and tried to run the tests through command line.How to run xunit tests in CLI.
Ran into a similar problem with VS not discovering test methods. In my case I had the static keyword with the method, which I removed and it worked.
Also check if a completely empty app.config file (completely blank with absolutely no markup) is within the test project. This was the culprit in my case.
This can also be due to the build check box not being ticked for the current platform project in the build configuration. Click Build | Configuration manager, then make sure the test projects have a tick in the build column for the platform that you're using (for example 'x86').
This was definitely the solution that worked for me.
I was suffering from this problem for long times.
I had about 100 projects different version was deployed in different server.
Updating xunit from 2.2.0 to 2.3.1 was not a solution because build was failing in 2.3.1.
Then I just updated xunit.runner.visualstudio to 2.3.1 and everything started to work fine. I have used this command in my package manager console to updated my xunit.runner.visualstudio package