views:

181

answers:

3

Hey folks

I'm trying to write some unit tests for an app I work on at work (In the vague hope that others might follow suit), and I was originally running these tests using NUnit and the ReSharper plugin.

However, ReSharper will no longer run tests for me for some reason: It simply crosses them out with a red strikeout.

There's no error code I'm afraid, and there's no mention of such behaviour on the JetBrains site.

Has anyone else experienced similar benhaviour?

Cheers, Ed

EDIT

An example of a test, just to show that I'm not just doing them wrong:

using NUnit.Framework;

/// <summary>
/// Test
/// </summary>
[TestFixture]
public class Test
{
    [Test]
    public void TestOne()
    {
        Assert.IsTrue(true);
    }
}

Not exactly much to go wrong in that example :D

+1  A: 

Most probably you incidentally deleted [TestFixture], [Test] attributes, made the test methods private, or the test class private.

Please post some example code if the above is not the case (whole class including class declaration)

Grzenio
There's nothing wrong with the Tests themselves (they run fine within the TeamCity build environment or from the NUnit console runner), but this is an ASP.net website so it's a pain to have to do a manual MSBuild every time I want to check my tests.
Ed Woodcock
Hi @EdWoodcock, Try (1) manually selecting a missing test to run - by clicking on the yellow/green circle on the left of the code (2) Close your testing session (its not the same as closing the window with all sessions!). Let me know if it still doesn't work.
Grzenio
Tried both and I'm afraid I have the same issue.
Ed Woodcock
Hi @EdWoodcock, I can't really guess anymore without seeing the code :(. Are you in a position to edit your question and paste your test fixture?
Grzenio
@Grzenio Honestly, it's not the code. I'm happy to paste up the test I put in there to check my NUnit was working correctly, but it's all the unit tests that don't run, so I'm not sure how helpful that will actually be.
Ed Woodcock
@EdWoodcock, sorry I pass :( Must be either something really silly or a bug in Resharper. I haven't tried 5.0 yet anyway...
Grzenio
A: 

Which ReSharper version do you use? Which framework version does your test project target? And which platform (x86/x64/AnyCPU)?

kropp
ReSharper is 5.0, framework is 3.5 x86, NUnit is x86
Ed Woodcock
A: 

I had a similar issue recently. The cause was that some config files which some of the tests required were not being copied to the relevant bin directory. The "copy if new/copy always" property on the file had got reset at some point. I got the same lack of feedback that you are seeing, and couldn't work out the problem until i upgraded resharper from 4.5 to 5. Then it started giving me an error message about one of the files.

Since you're already using v5, this probably won't help you that much!

Jonny Cundall
Where is that property in the options screen?I also started having this problem on 4.5, but it's been happening on multiple sln files, some of which are new, so I doubt it's a config issue, but you never know!
Ed Woodcock