I am trying to do Unit Testing with Excel as data source. I am getting the following exception. How do we correct it?
The unit test adapter failed to
Solved it myself in a different way. Other answers are welcome.
Refer: Walkthrough: Using a Configuration File to Define a Data Source http://msdn.microsoft.com/en-us/library/ms243192.aspx
[TestMethod]
[DeploymentItem("C:/Sheets/DataSheet.xlsx")]
[DataSource("MyExcelDataSource")]
public void ChangePasswordTest()
{
int a = Convert.ToInt32(TestContext.DataRow[0]); //(int)Column.UserId
int b = Convert.ToInt32(TestContext.DataRow[1]);
int expectedResult = Convert.ToInt32(TestContext.DataRow[2]);
MyClass myObj = new MyClass(1, "P@ssw0rd");
int actualResult = myObj.GetAdditionResult(a, b);
Assert.AreEqual(expectedResult, actualResult, "The addition result is incorrect.");
}
App.Config
For VS 2010, TestTools version used is Version=10.0.0.0