Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope NUnit parallelization to generated classes instead of assembly-level #388

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

SeanKilleen
Copy link
Contributor

🤔 What's changed?

  • Removed assembly-wide attribute declaring parallelization to be InstancePerTestCase (not the NUnit default)
  • Add the attribute to the generated classes.

⚡️ What's your motivation?

Fixes #379

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

📋 Checklist:

  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "[vNext]" section of the CHANGELOG, linking to this pull request & included my GitHub handle to the release contributors list.

This text was originally taken from the template of the Cucumber project, then edited by hand. You can modify the template here.

@SeanKilleen
Copy link
Contributor Author

(This is still in progress, just FYI. I wanted to see how the build responded to the initial change.)

@obligaron
Copy link
Contributor

Tip: Here is the code that generates the NUnit specific attributes for a class

public void SetTestClass(TestClassGenerationContext generationContext, string featureTitle, string featureDescription)
{
CodeDomHelper.AddAttribute(generationContext.TestClass, TESTFIXTURE_ATTR);
CodeDomHelper.AddAttribute(generationContext.TestClass, DESCRIPTION_ATTR, featureTitle);
}

This code generates

    [NUnit.Framework.TestFixtureAttribute()]
    [NUnit.Framework.DescriptionAttribute("Calculator")]

If you want to add the FixtureLifeCycle attribute to each class, you will probably need to change this.

Hope this helps. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

With NUnit 4.x, "Only static OneTimeSetUp and OneTimeTearDown are allowed for InstancePerTestCase mode"
2 participants