Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find any matching test cases with xUnit

While the tests worked fine on friday I now get this error:

enter image description here

When I look at xUnit's github it's clear that this fails on xUnit code:

enter image description here

The GetTestCases code does this:

enter image description here

So, as I read it, and as I would expect, the test assembly is read for matches, which for some reason suddenly fails, while being just fine on friday.

I've tried another solution, it's tests run just fine.

What I've tried

  • Clean / rebuild solution
  • Manually remove bin obj folders
  • Uninstall and install package xunit (version 2.2.0)
  • Shut down / restart Visual Studio
  • Reboot laptop

None of this helps, nor did updating ReSharper.

What's going on and what can fix this?

Possibly ReSharper is interfering somehow?

like image 739
Spikee Avatar asked Jun 19 '17 06:06

Spikee


People also ask

Does xUnit run tests in parallel?

Running unit tests in parallel is a new feature in xUnit.net version 2. There are two essential motivations that drove us to not only enable parallelization, but also for it to be a feature that's enabled by default: As unit testing has become more prevalent, so too have the number of unit tests.

How do I run all test cases in Visual Studio?

To run all the tests in a default group, choose the Run icon and then choose the group on the menu. Select the individual tests that you want to run, open the right-click menu for a selected test and then choose Run Selected Tests (or press Ctrl + R, T).


1 Answers

My problem was, that the Unit Test project created in VS2017 (v15.2) did not have some specific assemblies reference. After every failed run attempt I just went through Output:Tests window a check for any exception. Exceptions were complaining about missing assembly references: System.Runtime, System.Runtime.Extensions, System.Reflection. System.Linq

Once I have added all the references(NuGets) all works as intended.

I'm using VS2017, SpecFlow(2.2.0), xUnit(2.2.0), .NET 4.7, R#(2017.1.3)

like image 191
Skorunka František Avatar answered Jan 02 '23 20:01

Skorunka František