locked
Unit test adapter failed to connect to the data source when data sources files are inside a subfolder RRS feed

  • Question

  • Hello, I'm new to TFS and I'm current running into the error below in our automated test after upgrading from TFS 2010 to TFS 2012. This was working fine before the upgrade.

    Within our Visual Studio test projects, our test data sources are all located under "TestDataSources" folder and each of them are set to "Copy Always" (for the "Copy To Output Directory" property).

    Then for each test methods, we got these attributes [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\TestDataSources\\PopulateSuppTierTblDictTest.csv", "PopulateSuppTierTblDictTest#csv", DataAccessMethod.Sequential), DeploymentItem("nbatBillPrintApp.exe"), DeploymentItem("nbatBillPrintAppUnitTest\\TestDataSources\\PopulateSuppTierTblDictTest.csv"), TestMethod]

    ERROR

    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: The Microsoft Jet database engine could not find the object 'PopulateSuppTierTblDictTest.csv'.  Make sure the object exists and that you spell its name and the path name correctly.

    We did not encounter this kind of problem in TFS 2010 using the same setup. To temporarily get around this problem, below is what I did and TFS 2012 works fine.

    1. Moved the data sources (CSV files) to Visual Studio's root project folder.

    2. Changed the attribute of the test methods to something like this (Removed TestDataSources):  [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\PopulateSuppTierTblDictTest.csv", "PopulateSuppTierTblDictTest#csv", DataAccessMethod.Sequential), DeploymentItem("nbatBillPrintApp.exe"), DeploymentItem("nbatBillPrintAppUnitTest\\PopulateSuppTierTblDictTest.csv"), TestMethod]

    QUESTION: Any idea on why does TFS 2012 does not let me put my data sources to a subfolder? Can you please let me know what I could be doing wrong or what configuration I should check? Many thanks in advance for your help on this.

    • Moved by John QiaoModerator Thursday, July 26, 2012 2:26 AM (From:Team Foundation Server - General)
    Wednesday, July 25, 2012 7:21 PM

Answers

All replies