aderesh
aderesh

Reputation: 947

How can I get reason of Resharper's aborted tests?

I'm using Resharper 9.2 and NUnit 2.6.4 and ~120 unit tests. Sometimes when I start run tests resharper stops at random test and set it status to Aborted and skip the others. It is very inconvenient because I have manually run rest of tests. Are there any ways to get reason of Abortion, some resharper test run logs or something in NUnit to help solve my problem?

I also tried to use native NUnit runner but it sometimes throws exception which doesn't contain any useful info (some remoting exception which tells nothing useful)

I've tried to set "Run up to 1 assemblies in parallel" and "Use separate AppDomain for each assembly with tests" but it doesn't help.

UPD

I've reproduced this in debug mode, debug unit test just shut down and in output window I've found:

The program '[4572] JetBrains.ReSharper.TaskRunner.CLR4.exe: Program Trace' has exited with code 0 (0x0).
The program '[4572] JetBrains.ReSharper.TaskRunner.CLR4.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access violation'.

It seems that problem is external's library unsafe code.

Upvotes: 15

Views: 6130

Answers (3)

raddevus
raddevus

Reputation: 9077

I had only one test that basically didn't run any code except set an integer value. I was just adding my firsts tests getting my unit tests set up so I quickly added a setup() and a create() test.

Every time I ran I got the tests aborted error. tests aborted

Debug Failed

Debug breakpoint would not even stop inside the [Setup]TestSetup() method.

I removed both the TestSetup() and the [Test] void Create() method and it would run but of course give inconclusive as the result.

I added the [SetUp] TestSetup() method back in and it didn't abort either. I added the [Test] void Create() method back in again and it started aborting again with no ability to break.

Finally, I saw the problem. Do you see the problem?

[SetUp]    
public void TestSetup()
{
    string test = "this thing";
}

[Test]
void Create()
{
    int x = 5;
    string s1 = "super";
}

Spoiler

Oops, I forgot to set the Create() method to public.

Upvotes: 3

Tormod
Tormod

Reputation: 4573

I also ran into a case where Resharper decided to consistently abort a test. It didn't call into unmanaged or anything freaky.

The answer was that it had an inadvertent recursive call resulting in a stackoverflow exception. This was evident when I decided to "debug" instead of "running" them.

So I assume that the general takeaway is that "aborted" tests is symptomatic that something went wrong, but the error did not result in an exception being thrown from the code itself, but from the CLR or something.

Upvotes: 4

aderesh
aderesh

Reputation: 947

It seems that resharper has nothing to do in this case. I've got Access Violation error and in this case tester process will be shut down. There is no way in .net to process this error because it is not on managed level. The only thing is to check in output window if error message is like: "The program '[4572] JetBrains.ReSharper.TaskRunner.CLR4.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access violation'" when your tests are aborted for no reason. If you have access to native code you can debug.

In my case the problem was in improper use of COM object and Dispose() method. I've fixed it and everything is ok now - no "silent" abortion.

Upvotes: 3

Related Questions