I'm using VSTS 2K8 and I've set up a Unit Test Project. In it, I have a test class with a method that does a simple assertion. I'm using an Excel 2007 spreadsheet as my data source.
My test method looks like this:
public void State_Value_Is_Set()
string expected = "MD";
string actual = TestContext.DataRow["State"] as string;
The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests" (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library.
Error details: ERROR [42S02] [Microsoft][ODBC Excel Driver] The Microsoft Office Access database engine could not find the object 'Sheet1'. Make sure the object exists and that you spell its name and the path name correctly.
Change the "Build Action" property of Excel(.xlsx) to Content and "Copy to Output Directory" to Copy if newer.
This worked for me when I got the same error as urs...
++ also dont forget to browse and add the excel file in Deployment tab of TestRun.config file that is in the server soution..:)