Just a little quick one for myself….
When running some data driven unit tests we were getting the below error.
Unit Test Adapter threw exception: System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
The cause of this was that we had rebuild the machines and somehow when installing office the DSN for Excel hadnt been created. On all of the other machines it had been setup fine but for some reason on my machine it hadnt been setup.
The fix was to create a DSN called Excel Files pointing to excel driversand then just rerun the unit tests.
As a reminder the test attributes for this were below:
[TestMethod][DeploymentItem(@”..\..\..\mappings.xlsx”)]
[DataSource(“System.Data.Odbc”, “Dsn=Excel Files;dbq=|DataDirectory|\\spreadsheet.xlsx”, “worksheet1$”, DataAccessMethod.Sequential)]