Resharper sometimes ignores my tests

Now, it might be possibly that I don't fully understand the unit testing within Resharper, but I a little confused..

I have a C# solution with two projects - one for the production code and one for the NUnit unit tests. When I right click a test method and Run Unit Test, it all works fine. However, when I run unit tests for the Unit Test Sessions screen, sometimes it ignores the same methods as just run. There is no ignore attribute on the unit tests. I have tried abritratily changing test code to see if Resharper is clever enough not to run unit tests that don't need to be run (though this would scare me a little if it was the default).

Is this my lack of knowledge of unit test 'sessions'?

Help!!!!

7 comments
Comment actions Permalink

Hello Paul,

Could you please provide exact repro steps that we could perform on our side
to reproduce this behavior? Could you please also check if this happens with
any tests (even in a newly created class library) or only with some particular
tests? Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Now, it might be possibly that I don't fully understand the unit
testing within Resharper, but I a little confused..

I have a C# solution with two projects - one for the production code
and one for the NUnit unit tests. When I right click a test method and
Run Unit Test, it all works fine. However, when I run unit tests for
the Unit Test Sessions screen, sometimes it ignores the same methods
as just run. There is no ignore attribute on the unit tests. I have
tried abritratily changing test code to see if Resharper is clever
enough not to run unit tests that don't need to be run (though this
would scare me a little if it was the default).

Is this my lack of knowledge of unit test 'sessions'?

Help!!!!

---
Original message URL:
http://devnet.jetbrains.net/message/5277161#5277161



0
Comment actions Permalink

Cheers for the quick response.

I can replicate. The issue actually surrounds my code - I had incorrectly got nunit [SetUp] methods in some fixtures that were marked private rather than public. However, when running the tests from the public class WhateverTests fixture, Resharper still runs the unit tests held within the class. If I choose to run the same class tests from the Unit Test Session screen, it ignores the same tests. Not sure which is actually correct - probably ignoring the tests; it's what TestDriven.Net does also. However, I think invoking tests from the Sessions window and from the code pane should at least be consistent.

Regards,

0
Comment actions Permalink

Hello Paul,

Actually, this behavior is by design. ReSharper treats such tests as ignored
and they are ignored if you run them from the Unit Test Sessions window.
But when a developer chooses a specific test in the editor, ReSharper runs
that test anyway (even if it's ignored) because most likely this was the
developer's intention. Let me know if this helps. Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Cheers for the quick response.

I can replicate. The issue actually surrounds my code - I had
incorrectly got nunit methods in some fixtures that were
marked private rather than public. However, when running the tests
from the public class WhateverTests fixture, Resharper still runs the
unit tests held within the class. If I choose to run the same class
tests from the Unit Test Session screen, it ignores the same tests.
Not sure which is actually correct - probably ignoring the tests; it's
what TestDriven.Net does also. However, I think invoking tests from
the Sessions window and from the code pane should at least be
consistent.

Regards,

---
Original message URL:
http://devnet.jetbrains.net/message/5277183#5277183



0
Comment actions Permalink

Cheers Andrey,

Now you say that, I agree that it's useful functionality, if slightly confusing at first. Cheers for that clarification.

Cheers

0
Comment actions Permalink

It doesn't work as you say, Andrey, in my situation when I run for a first time after starting Visual Studio all tests everything is just fine, but when I try to do it again then I have "Ignored" and what is funny, I can't force it to run, Resharper totally ignores my commands and do whatever it like and I am very angry for this because I must restart completely whole Visual Studio to make it work again..

 

Please look at this video https://youtu.be/EPPPWh_-ReY

 

And there is another problem too, when I am clicking on test in the unit test session window then nothing is opening... Two bugs.

2
Comment actions Permalink

Hello Mariusz!

 

Could you please specify your ReSharper version and test framework used in your project?

Also please run Visual Studio with the following command line: 'devenv /ReSharper.LogFile C:\resharper_log.txt /ReSharper.LogLevel Verbose', reproduce the issue and send us a corresponding 'resharper_log.txt' file. You can share it privately via 'Submit a request' form.

Thank you.

0
Comment actions Permalink

I have exactly the same problem using the Jetrider TestRunner on RHEL. A random selection of tests are ignored. I'm able to get some of them to run after restarting the IDE but not all of them.

1

Please sign in to leave a comment.