microsoft / testfx

MSTest framework and adapter
MIT License
714 stars 253 forks source link

Cannot run test cases with DataRow attribute in MTM #421

Closed murarishukla712 closed 1 year ago

murarishukla712 commented 6 years ago

Description

I am trying to run a test case like the one mentioned below in Microsoft test management. I created a test case in MTM under a test suite and attached the below created test case in the automation script.

public class Calculator
{
    public int Add(int a, int b)
    {
        return a + b;
    }
}

[TestMethod]
[DataRow(3, 4, 7)]
[DataRow(5, 6, 11)]
public void When_add_two_numbers(int firstNumber, int secondNumber, int expectedResult)
{
    //Arrange
    Calculator calc=new Calculator();

    //Act
    var actualResult = calc.Add(firstNumber, secondNumber);

    //Assert
    Assert.AreEqual(expectedResult,actualResult);
}

Steps to reproduce

This can be reproduced with the steps mentioned above. I am using MSTest V2 to run the test. Because MSTest now supports DataTestMethod and DataRow attributes then I expect such data driven tests to be able to run on MTM as well. Is it not supported by MTM? If not then what is the workaround?

Expected behavior

I should be able to run the test case in MTM.

Actual behavior

I am getting below error when I am trying to run this test case in MTM. "Method" does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, does not return a value and should not take any parameter. for example: public void Test.Class1.Test().

Environment

Using Microsoft test environment to run the tests. Operating system- Windows 7 and MsTest V2 Microsoft test framework

jayaranigarg commented 6 years ago

@murarishukla712 : Currently you cannot run MSTestV2 tests in MTM. Tagging @PBoraMSFT @pvlakshm to comment on when can we bring in this support?

HeroMaxPower commented 3 years ago

Just to point out that MTM is sun-setted so this might not get any updates to this tech

Proof

Evangelink commented 1 year ago

I will move forward by closing this issue as this tool is part of the legacy tools.