locked
Unable to execute unit test on remote machine directly or using MTM RRS feed

  • Question

  • 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 [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    I get error while executing my data driven test on remote environment. I have data source in a shared folder with proper access provided to everyone. I am able to read another file (configuration file in .XML format) from the same location i.e. the shared folder. I use this XML file for running all the test cases but XLSX file is read only for data driven test.

    Test which does not require XLSX file to be read are working fine on the remote machine . Problem occurs with the test in which i have to use value from the XLSX data file

    Following is the snippet of how i am using the Data Source:

    [DataSource("System.Data.Odbc", "Dsn=Excel Files;Driver={Microsoft Excel Driver (*.xls)};dbq\\\\SharedFolder\\TestData.xlsx;defaultdir=.;driverid=790;maxbuffersize=2048;pagetimeout=5;readonly=true", "SheetName$", DataAccessMethod.Sequential), TestMethod()]
    Directly in the question refers to as using Visual Studio i.e. opening source code on remote machine and execute test.


    Varun



    Monday, February 17, 2014 8:18 AM

Answers

  • Hi,

    What is the operation system on the remote machine? Based on the error message, it seems that there is no ODBC driver on the remote machine.

    Please try to use OLEDB provider in DataSource attribute like this

    [DataSource("System.Data.OleDb", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\MEX_Config.xls;Persist Security Info=False;Extended Properties='Excel 12.0 Xml;HDR=YES'", "Sheet1$", DataAccessMethod.Sequential)]

    For more information, reference this thread with similar issues:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/46e3b60f-8cf7-48f7-b4f0-1eb093141266/unable-to-perform-data-driven-testing-in-visual-studio-2012?forum=vsunittest

    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.

    • Marked as answer by Varun.Bajpai Wednesday, February 19, 2014 11:38 AM
    Tuesday, February 18, 2014 5:16 AM

All replies

  • Hi,

    What is the operation system on the remote machine? Based on the error message, it seems that there is no ODBC driver on the remote machine.

    Please try to use OLEDB provider in DataSource attribute like this

    [DataSource("System.Data.OleDb", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\MEX_Config.xls;Persist Security Info=False;Extended Properties='Excel 12.0 Xml;HDR=YES'", "Sheet1$", DataAccessMethod.Sequential)]

    For more information, reference this thread with similar issues:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/46e3b60f-8cf7-48f7-b4f0-1eb093141266/unable-to-perform-data-driven-testing-in-visual-studio-2012?forum=vsunittest

    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.

    • Marked as answer by Varun.Bajpai Wednesday, February 19, 2014 11:38 AM
    Tuesday, February 18, 2014 5:16 AM
  • Hi Amanda,

    Thanks for the solution provided.

    When i try to run same same test concurrently on two machines (one local and one remote) using MTM i get the 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: The Microsoft Access database engine cannot open or write to the file ''. It is already opened exclusively by another user, or you need permission to view and write its data.

    This error is displayed for the test run where was initiated later i.e. if test is initiated first on remote machine and then on local, then test executing on remote machine will throw this error.

    Please note i have one common data source present at a shared location and all test would be using it.


    Varun


    • Edited by Varun.Bajpai Wednesday, February 19, 2014 8:27 AM
    Wednesday, February 19, 2014 8:25 AM
  • Hi,

    Did you mean that my suggestion in the previous reply resolved the initial issue in the original post?

    If yes, could you mind marking useful reply as answer to close this thread and then open up a new thread for the new question? In this way, our discussion here will not deviate too much from the original issue. This will make answer searching in the forum easier and be beneficial to other community members as well.

    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.

    Wednesday, February 19, 2014 10:36 AM
  • Hi Amanda,

    Yes your suggestion worked! thanks for the same.

    I have marked the suggestion as answer.

    Please could you tell what was the problem due to which the error was encountered. and how changes suggested by you made it work?

    Thanks in advance!!!


    Varun

    Wednesday, February 19, 2014 12:02 PM