BaranyiAndor
BaranyiAndor

Reputation: 11

How to run a single test in NUnit using ReSharper7

my question is how can I run a single test on a single TestFixture at a time(for debugging for example). I have several TestFixtures in each Test Category, and whenever I click on the R# icon on a single test, it says 'Run'/'Debug', however, even when selecting the exact test and the fixture, R# and NUnit runs all Fixtures one after the other.

[Category("LoginTestSuite")]
[TestFixture(SiteEditionsEnum.AsiaPacific)]
[TestFixture(SiteEditionsEnum.Australia)]
[TestFixture(SiteEditionsEnum.Canada)]
[TestFixture(SiteEditionsEnum.CanadaFrench)]
[TestFixture(SiteEditionsEnum.France)]
[TestFixture(SiteEditionsEnum.Germany)]
[TestFixture(SiteEditionsEnum.HongKong)]
[TestFixture(SiteEditionsEnum.Japan)]
[TestFixture(SiteEditionsEnum.Spain)]
[TestFixture(SiteEditionsEnum.UnitedKingdom)]
[TestFixture(SiteEditionsEnum.UnitedStates)]

public class LoginTestSuite : FrontEndTestSuitesCommon
{
[...]


    [Test]
    public void RunLoginFunctionalTest()
    {
        Logger.Log(MessageType.None, "This test case is using the email address: " + ConfigurationManager.AppSettings["DefaultLoginEmail"], LogLevel.Info);
        Actions.Login.GetToLoginPage();
        Actions.Login.SetLoginCredentials();

After the click all Fixtures start running(i.e. all siteEditions)

The menu seems to say it will run or debug only that test with UK TestFixtures, but it doesn't, it runs all fixtures instead. I use VS2008 SP1, ReSharper 7.0.97.60 with the built-in NUnit 2.6

Upvotes: 0

Views: 230

Answers (1)

Bob The Janitor
Bob The Janitor

Reputation: 20802

First off I think there is a fundamental flaw in your test set up, your trying to make your one test do too much. One of the primary concepts of unit testing is "single responsibility", having verbose tests isn't a bad thing, and having a lot of tests isn't a bad thing.

My suggestion would be to break up your tests into a class for each TestFixture or could you create a test for each TestFixture Item? it's not about Resharper not running your tests wrong, it's how you have written your tests isn't matching how resharper was designed to work.

Upvotes: 2

Related Questions