nunit: SetUpFixture not run

Description

I’m trying to migrate a test project from .NET Classic 4.7.2 to .NET Core 2.2. I have a class marked with SetUpFixture and inside it a OneTimeSetUp method. It is not run at all.

Versions

NUnit version: 3.12.0 NUnit3TestAdapter version: 3.15.0 Visual Studio: 2017 Professional, 15.9.15 .NET platform: Core 2.2

Repro

using NUnit.Framework;

namespace Tests
{
    public class Tests
    {
        [Test]
        public void Test1()
        {
            Assert.True(SUF.HasRun);
        }
    }
}

[SetUpFixture]
public class SUF
{
    public static bool HasRun;

    [OneTimeSetUp]
    public void BeforeEverything()
    {
        HasRun = true;
    }
}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 17

Most upvoted comments