locked
failed to connect to the data source or to read the data: when running a unit test via ordered test in VS2012, RRS feed

  • Question

  • Hi,

    I'm getting a strange behavior when i run a ordered test which includes couple of codedUI test.

    When i run the orderedTest it gives 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: Could not find file 'C:\<Directory>\<SubDirectory>\TestResults\<user> 2014-05-16 12_43_50\Out\TestData.mdb'.


    However, when i run the same codedUI test independently it run perfectly.

    I wonder if the CodedUI test run fine with the same deployment item, then why it's not by the ordered test.

    Friday, May 16, 2014 6:58 PM

Answers

  • Hey Jack

    I upgraded the Visual Studio 2012 with update 4, and the issue get resolved :)

    I don't no what was causing that, but I'm happy it get resolved.

    Thanks

    Ahsan.

    • Marked as answer by Ahsan Mumtaz Tuesday, May 27, 2014 3:20 PM
    Tuesday, May 27, 2014 3:20 PM

All replies

  • Hi Ahsan,

    Which VS version are you using? How did you run your test, in command line or VS IDE?

    If you just add one coded UI test to the ordered test, what about the result?

    You’d better run it in your VS IDE, I doubt that you didn’t call the .testsettings file in command line since you said that you use the deployment item. Or you didn't enable the testsettings file in your VS IDE.

    I wonder if the CodedUI test run fine with the same deployment item, then why it's not by the ordered test.

    In addition, do you mean that you use the same data for different coded UI tests when you add them to the ordered test? Maybe you could create two different deployment items, and then use one item for one coded UI test, check the result.

    If I have misunderstood this issue, please make free feel to let me know.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, May 19, 2014 7:26 AM
  • VS Version: 2012 Ultimate

    Im using IDE, so i think it's not required  to add .testsettings file explicitly.

    Here is the data source which i'm using in my CodedUI Test.

    [DataSource("System.Data.OleDb", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\TesData.mdb", "tblMyProfile", DataAccessMethod.Sequential), DeploymentItem("Testing\\TestData\\TestData.mdb"), TestMethod]

    And test run successfully.

    When i run the same CodedUI test call by a OrderedTest, its failed with following 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: Could not find file 'C:\<Directory>\<SubDirectory>\TestResults\<user> 2014-05-16 12_43_50\Out\TestData.mdb'


    Monday, May 19, 2014 12:53 PM
  • Hi Ahsan,

    Thanks for your friendly response.

    Error Details: Could not find file 'C:\<Directory>\<SubDirectory>\TestResults\<user> 2014-05-16 12_43_50\Out\TestData.mdb'

    Sorry for that I couldn’t repro this issue in my side. But it seems that it will find the mdb file in your test result folder, could you find it in that path?

    Out. Each test run folder contains a folder named Out. The Out folder is the actual deployment folder, to which assemblies and other deployment files are copied when the test run starts.

    http://msdn.microsoft.com/en-us/library/ms182475.aspx

    If you don’t use the testsetting file in your solution explorer, could you add the .mdb file to your solution? And then set “Copy to Output property to Copy if Newer” for it. And then change the datasource attribute:

    [DataSource("System.Data.OleDb", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\TesData.mdb", "tblMyProfile", DataAccessMethod.Sequential), DeploymentItem("TestData.mdb"), TestMethod].

    Run your coded UI test, and make sure that it really calls the data row. And then add it to a new ordered test, run it again.

    If still no help, please share me a simple sample, I will test it in my side.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 20, 2014 9:14 AM
  • Hey Jack

    I upgraded the Visual Studio 2012 with update 4, and the issue get resolved :)

    I don't no what was causing that, but I'm happy it get resolved.

    Thanks

    Ahsan.

    • Marked as answer by Ahsan Mumtaz Tuesday, May 27, 2014 3:20 PM
    Tuesday, May 27, 2014 3:20 PM
  • @Ahsan,

    Maybe it is the VS IDE issue, but it has been resolved in the latest update package. Anyway, since it works well now, I will close this issue case, if you meet any test issues, welcome to our forum.

    Have a nice day,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, May 28, 2014 1:47 AM