Skip to content

Assert.Inconclusive behavior is different in ctor vs TestInitialize #7302

@Evangelink

Description

@Evangelink

Describe the bug

Doing a call to Assert.Inconclusive in ctor results in test failure while the same in a TestInitialize method results in test cosndidered as skipped. I think the behavior should be the same across the 2 sides.

Steps To Reproduce

[TestClass]
public sealed class MyTestClass
{
    public MyTestClass()
    {
        Assert.Inconclusive("Skipped"); // TestMethod is considered as failing
    }

    [TestMethod]
    public void TestMethod()
    {         
    } 
}

while

[TestClass]
public sealed class MyTestClass
{
    [TestInitialize]
    public void TestInit()
    {
        Assert.Inconclusive("Skipped"); // TestMethod is considered as skipped
    }

    [TestMethod]
    public void TestMethod()
    {         
    } 
}

My current actual scenario is to skip based on TFM.

Metadata

Metadata

Labels

Area: AssertionArea: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions