Skip to content

Overridden test with datarow also executes datarows on base implementation #458

@FlorensRab

Description

@FlorensRab

Description

When overriding a test decorated with the TestDataAttribute all the datarows on the base will also be executed. This makes overriding a test quite useless.

Steps to reproduce

[TestClass]
public class Test
{
    [DataTestMethod]
    [DataRow("cherry")]
    [DataRow("banana")]
    [DataRow("Apple")]
    public virtual void TestMethod(string a)
    {
        Assert.IsTrue(true);
    }
}

[TestClass]
public class MyTest : Test
{
    [DataTestMethod]
    [DataRow("orange")]
    [DataRow("pineapple")]
    public override void TestMethod(string a)
    {
        Assert.IsTrue(true);
    }
}

Expected behavior

MyTest (2 tests) [0:00.004] Success
TestMethod (2 tests) [0:00.004] Success
TestMethod (orange) [0:00.004] Success
TestMethod (pineapple) [0:00.000] Success
Test (3 tests) [0:00.005] Success
TestMethod (3 tests) [0:00.005] Success
TestMethod (Apple) [0:00.000] Success
TestMethod (banana) [0:00.000] Success
TestMethod (cherry) [0:00.005] Success

Actual behavior

MyTest (5 tests) [0:00.006] Success
TestMethod (5 tests) [0:00.006] Success
TestMethod (Apple) [0:00.000] Success
TestMethod (banana) [0:00.000] Success
TestMethod (cherry) [0:00.000] Success
TestMethod (orange) [0:00.006] Success
TestMethod (pineapple) [0:00.000] Success
Test (3 tests) [0:00.007] Success
TestMethod (3 tests) [0:00.007] Success
TestMethod (Apple) [0:00.000] Success
TestMethod (banana) [0:00.000] Success
TestMethod (cherry) [0:00.007] Success

Environment

Desired functionality was with version 1.1.18
changed behavior started with 1.2.0 beta and onwards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions