Skip to content

MSTEST0016 and base test class #2683

@avivanoff

Description

@avivanoff

We have the following structure in some of our test projects:

[TestClass]
public abstract class TestBase
{
    public TestContext TestContext { get; set; }

    [TestInitialize]
    public void RunTestSetup()
    {
        ...
    }

    [ClassCleanup]
    public static void ClassCleanup()
    {
        ...
    }
}

[TestClass]
public sealed class SomeTest : TestBase
{
    ...
}

After upgrading to 3.3.1 we started getting the error:

error MSTEST0016: Test class 'TestBase' should have at least one test method or be 'static' with method(s) marked by '[AssemblyInitialization]' and/or '[AssemblyCleanup]'

Should MSTEST0016 be checking for this pattern and not trigger the warning/error, or is there a better approach?

AB#2079035

AB#2332759

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions