I would like to pass parameter values from test cases which are present in Team Foundation Server. I do the automation with the help of Microsoft Test Manager.
Below is example test method created using Unit Test Project.
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1(int a, int b, int expectedResult)
{
var sut = new Class1();
var result = sut.Add(a,b);
Assert.AreEqual(expectedResult, result);
}
}
}
Now when I try to build this, I get the below error:
UTA007: Method TestMethod1 defined in class UnitTestProject1.UnitTest1 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(). Additionally, return-type must be Task if you are running async unit tests. Example: public async Task Test.Class1.Test2().
How to achieve parameter passing in this scenario?
TestContext
instead? blogs.msdn.microsoft.com/vstsqualitytools/2006/01/09/… – zaitsman