If we want to fetch the test data from MTM(Microsoft Test Manager) and use it inside our script we should follow the below steps:
- Open MTM
- Create a new Test case and insert the parameters
- Inside codedUITest file write the below code:
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.Test Case",
"http://localhost:8080/tfs/[CollectionName];[Project Name]","TestCaseId", DataAccessMethod.Sequential),TestMethod]Now if you want to access the parameters define inside the test case, Follow below code:public void method_Name(){ string s1= TestContext.DataRow["param_Name"].ToString();}param_Name= is the name of parameter defined inside the MTM Test Case.