Not running selected NUnit tests (runs all) and not running [Explicit] test

My tests have been working quite well up to now in VS2015.  However, over my holiday period I installed VS2017 so I don't know if that affected anything.

When I select an [Explicit] test (in VS2015) it is not being run.  All other tests are being run; which isn't quite what I want.

I updated to R# 2017.3.1 and I'm on NUnit 3.4.1.

I tried NUnit 3.9.0 and added the NUnitTestAdapter (for what it is worth) but that didn't help at all so I'm back to just NUnit 3.4.1.

Any ideas?

0
5 comments

OK, so after a reboot it ran my single test once and then back to the above behaviour.

I can also add that removing the [Explicit] attribute from my test allows me to run the individual test.

0

Hello Eben!

 

Thank you for the feedback.

I couldn't reproduce the issue neither with NUnit 3.4.1 nor NUnit 3.9.0.

Could you please try to clear caches as described in the following help article: https://resharper-support.jetbrains.com/hc/en-us/articles/206546989-ReSharper-stopped-working-for-a-single-specific-solution and check if it helps?

If not I suppose some demo solution will be very helpful for us to reproduce the issue.

Thank you.

0

Thanks for the feedback.

 

I actually did try clearing the cache to no avail.  What I am doing currently is removing the [Explicit] attribute, running my test, then replacing it.  Once I have some time I'll see if I can reproduce it using a sample application.

This was working absolutely fine in VS2015 and the only thing I can think of that has changed was that I also installed VS2017 (CE) but it isn't inconceivable that something else also happened. 

Anyway, I'm not too stuck :)

0
Avatar
Permanently deleted user

Hello.

This same thing had started happening to me today. This was actually very annoying (as you can imagine).

My situation was a class decorated with [TestFixture, Explicit], and all of my test methods decorated with [TestCase, Explicit]. When I would target a test to run using ReSharper, it would run all other unit tests from all of my other test classes, except the class for the method I tried to execute. When I removed the Explicit attributes and ran the test, it worked as expected (only the one test ran). 

 

As I was writing all of this, I added 2 unit tests to my class to try and document/test this further. One with a method with just the attribute [Test] that contained a console out line. When I ran that test it worked. I added a second test with the [TestCase] attribute passing a simple string and outputting that. The first time I ran this method, it behaved in the unexpected behavior that has been described above - all of the other tests were running in my project (remember this test class had the Explicit attribute on it). I ran both of those methods a second time, and suddenly this odd behavior stopped occurring for that second test. After the simple [TestCase] method started working, I tried one of my original test methods, and that one also started working. I deleted this 2 additional unit tests and tried running my original ones again, and they are still working as expected (the bug seemed to have disappeared).

I cannot explain what happened, and it doesn't seem to have anything to do with my code explicitly. This seems like a bug that is occurring with ReSharper.

I should note that after this bug had occurred for me I tried shutting down all instances of VisualStudio and opening again to see if anything changed, but the bug was still present. I restarted my computer and the bug was still present. I updated ReSharper and restarted VisualStudio and the bug was still present. I cleared my ReSharper cache as linked in an above article, and the bug was still present. The bug suddenly stopped occurring after I had added those 2 simple tests to my class and executed them twice. Also, this bug wasn't restricted to just this one test class I was writing. I tried executing a few other test class methods on different classes that had previously worked (was using Explicit and TestCase attributes) and the unexpected behavior was occurring. When I asked a teammate to try those same existing tests on his machine, they executed as expected.

Below is my ReSharper and VS info.

JetBrains ReSharper Ultimate 2017.3.2 Build 111.0.20180201.63358
dotCover 2017.3.20180201.111828
ReSharper 2017.3.20180201.111630
Visual Studio 2015 (version 14.0.25431.1)

0
Avatar
Permanently deleted user

Facing this issue as well. Uncommenting the explicit tag every time I want to run the test is kind of tedious and I always have to remember it or it will run all my non explicit tests.

0

Please sign in to leave a comment.