locked
Visual Studio 2012 data driven unit test do not work when Process Architecture is x64 RRS feed

  • Question

  • Very strange problem. I had this working on VS2010 and this would no longer work on VS2012. Therefore, I ripped apart the original test and created a very simple reproduction.

    What surprises me is that the unit test method shown below works fine when Processor Architecture is x32. But, test will not even execute when Process Architecture is x64.  

    I have simplified the unit test as follows:

            [TestMethod]
            [DeploymentItem("SimpleData.csv")]
            [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\SimpleData.csv", "SimpleData#csv", Microsoft.VisualStudio.TestTools.UnitTesting.DataAccessMethod.Sequential)]
            public void CopyDataFileAndReadValuesFromThatFile()
            {
                //check for the presene of the file
                string fullPath = Path.Combine(TestContext.DeploymentDirectory, "SimpleData.csv");
                Assert.IsTrue(System.IO.File.Exists(fullPath));
                //try to read some values from the file
                string SubmitterRole = (string)TestContext.DataRow["SubmitterRole"];
    
            }


    The data file 'SimpleData.csv' gets copied to the deployment folder. That is not a problem. The error message in the Output window is 

    ------ Run test started ------
    The active Test Run was aborted because the execution process exited unexpectedly. To investigate further, enable local crash dumps either at the machine level or for process vstest.executionengine.x86.exe. Go to more details: http://go.microsoft.com/fwlink/?linkid=232477
    ========== Run test finished: 0 run (0:00:10.7222126) ==========

    Error message in Application Event log

    The description for Event ID 0 from source VSTTExecution cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
    
    If the event originated on another computer, the display information had to be saved with the event.
    
    The following information was included with the event: 
    
    (vstest.executionengine.exe, PID 5660, Thread 7) OutOfProcessStrategy: Failed to get job info (error 24). This is benign, but means that when the test agent process is shut down, any child processes it may have will be left running.
    
    the message resource is present but the message is not found in the string/message table



    sdg



    • Edited by saurabhd Thursday, September 5, 2013 1:28 PM
    Thursday, September 5, 2013 1:23 PM

Answers

  • Hello,

    In VS2012, you can run unit test and coded UI test from Test Explorer, moreover you will get results in Test Explorer. For more information, please see: What's New in Developer Quality and Diagnostic Tools

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by saurabhd Monday, September 9, 2013 8:06 AM
    Monday, September 9, 2013 1:44 AM

All replies

  • I would like to add that I have VS 2012 Update 3 installed. My development environment is Windows Server 2008 R2.


    sdg

    Thursday, September 5, 2013 1:25 PM
  • Hello,

    If your machine is a 64-bit machine, you can run unit tests and capture code coverage information as a 64-bit process.

    About how to run unit test as a 64-bit process, please see:

    How to: Run a Unit Test as a 64-bit Process

    Except selecting x64 Processor Architecture in Test->Settings menu, you also must recompile your code and tests as Any CPU.

    Please check your configurations.

    Thanks,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, September 6, 2013 2:26 AM
  • Hello Amanda,

    Many thanks for replying. I am on a 64 bit virtual machine. I have followed the steps in the MSDN article which you have cited. From what I have observed, I have narrowed down this issue to the presence of the 'DataSource' attribute. If this is removed then everything works fine. In a nutshell I cannot get the Data Driven tests to work with Process Architecture=x64 and Platform Target=Any CPU. I want to highlight that the data file gets correctly deployed to the Deployment folder.

    Screen capture of my settings:

    Screen capture of my unit test method:

    In the mean while I have decided to abandon Data Driven unit tests and use custom code to read my CSV file.

    Thanks and Regards,
    Saurabh


    sdg

    Friday, September 6, 2013 6:38 AM
  • Hello,

    I have create a unit test based on your code and set the ‘Copy to Output Directory’ property to ‘Copy Always’ for the CSV file. After I run it under x64 processor architecture, I get the following error:

    The Microsoft.Jet.OLEDB.4.0 provider is not registered on the local machine.

    When I run test under x86 processor architecture, the test will work fine.

    After some searches, I find that microsoft.jet.oledb.4.0 provider is not supported for x64.

    For more information, please refer to:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/564cca1f-125f-4732-bf24-27090ebb25d9/microsoftjetoledb40-provider-is-not-registered-on-the-local-machine

    It seems that I get different issues with you. I suggest that you try to run the test on another machine to check the result.

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, September 6, 2013 10:18 AM
  • Thanks for replying Amanda. I think your point is valid.

    One final question before I give you the points - where did you see the error message: 'The Micrsoft.Jet.... is not registered on the local machine'

    Regards,

    Saurabh

    


    sdg

    Friday, September 6, 2013 10:48 AM
  • Hello,

    In VS2012, you can run unit test and coded UI test from Test Explorer, moreover you will get results in Test Explorer. For more information, please see: What's New in Developer Quality and Diagnostic Tools

    Best regards,


    Amanda Zhu <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by saurabhd Monday, September 9, 2013 8:06 AM
    Monday, September 9, 2013 1:44 AM
  • I get it. Thank you.

    With this limitation of VS2012 on 64 bit, I have had to adandon using data driven unit tests. I have re-coded my tests to programtically read the same CSV file and fire the test for every line in the file. Same functionality but without the custom attributes of data driven tests.

    In a nutshell, 'Microsoft.VisualStudio.TestTools.Data.Srouce.cv' does not work any more on 64 bit. I wish Microsoft VS.NET 2012 had provided a work around for this.

    Regards,
    Saurabh

    


    sdg

    Monday, September 9, 2013 8:10 AM
  • I was wondering if there was solution to the issue.
    We have 64 bit dlls and I would like to use data driven test to drive them.
    The inputs are simple csv files.

    Thank You,

    Sarmad Fayyaz

    Wednesday, December 10, 2014 7:35 AM