NUnit3TestAdapter 3.15 OneTimeSetUp not working anymore
See original GitHub issueVisual Studio 2017 v15.9.14 <package id="NUnit" version="3.12.0" targetFramework="net471" /> <package id="NUnit3TestAdapter" version="3.15.0" targetFramework="net471" />
The first time I run a test, OneTimeSetUp is called, then every other runs fails. I had no problems with 3.14. I made a new project to reproduced it with minimal code and I can run multiple time my test and it always succeed with 3.14, but as soon as I upgrade to 3.15, it is never called anymore… If I restart VS, it work only once and all following try fails. Can be reproduced with nuget package or VS extension.
using NUnit.Framework;
namespace NunitAdapter315Bug
{
[SetUpFixture]
public class ProjectSetup
{
public static bool oneTimePassed = false;
[OneTimeSetUp]
public void OneSetup()
{
oneTimePassed = true;
}
}
}
using NUnit.Framework;
namespace NunitAdapter315Bug
{
[TestFixture]
public class TestNunitAdpaterTest
{
bool setupPassed = false;
[SetUp]
public void Setup()
{
setupPassed = true;
}
[Test]
public void TestIt()
{
Assert.IsTrue(ProjectSetup.oneTimePassed);
Assert.IsTrue(setupPassed);
}
}
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Adapter V3 Release Notes
NUnit3 Test Adapter for Visual Studio - Version 3.15.1 - August 30, ... 649 NUnit3TestAdapter 3.15 OneTimeSetUp not working anymore (When a ...
Read more >Nunit3 OneTimeSetUp and OneTimeTeardown not working
My guess is that it's using the wrong version. Try renaming the attribute "OneTimeSetUp" to be "TestFixtureSetUp" and see if that makes it...
Read more >Visual Studio Test Explorer not running [OneTimeSetUp ...
I am trying to run my nUnit 3.x tests in Test Explorer using the NUnit3 VS Adapter - but the OneTimeSetup and Setup...
Read more >Recent Threads - Xamarin Community Forums - RSSing.com
I am encountering an error when assigning a new page to a class parameter. It appears that it has not been initialized and...
Read more >https://rep.erst.dk/git/openebusiness/library/dotn...
serviceModel> -</configuration> \ No newline at end of file ... packages\NUnit3TestAdapter.3.15.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

If anyone else is having trouble downgrading to version 3.14 to avoid this bug, here are the steps I took:
NUnit3TestAdapter-3.14.0.vsixfile from the releases page here. (Under Assets).vsixfile which will launch the VSIX Installer and install 3.14 on your desired version of visual studio.It seems to work with my test solution, thanks