Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
FlorensRab opened this issue Jun 27, 2018 · 3 comments
Closed

Comments

@FlorensRab
Copy link

FlorensRab commented Jun 27, 2018

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

@jayaranigarg
Copy link
Member

jayaranigarg commented Jun 28, 2018

@FlorensRab : Thank you for reaching out to us.

Tagging @pvlakshm to comment on the expected behavior.

@jayaranigarg
Copy link
Member

@FlorensRab : Acknowledging this to be a bug on our end.

@pvlakshm
Copy link
Contributor

In this case, datarows on the base should not be executed.

@microsoft microsoft locked as resolved and limited conversation to collaborators Apr 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants