Search code examples
unit-testingresharpercode-coveragejetbrains-idedotcover

Unit test coverage using dotCover command line tool(JetBrains) - Is it possible to run this tool with x64 dll tests?


I am using dotCover command line tool(JetBrains) https://www.jetbrains.com/dotcover/download/#section=commandline

I was reading this documentation https://www.jetbrains.com/help/dotcover/Running_Coverage_Analysis_from_the_Command_LIne.html

I have a logic dll - x64 compiled.
I have a tests dll (AppTests Test project) -x64 compiled
I was creating coverage.xml on my solution Items folder with the parameters below

<AnalyseParams>
      <TargetExecutable>C:\Program Files (x86)\Microsoft Visual Studio12.0\Common7\IDE\MSTest.exe</TargetExecutable> 
      <TargetArguments>D:\Projects\TheApplication\bin\Debug\AppTests.dll</TargetArguments>
      <Output>AppCoverageReport.html</Output>
      <ReportType>html</ReportType>
</AnalyseParams>

From the cmd I am typing "dotcover analyse coverage.xml"

I am getting the flowing Error: "If you build your test project assembly as a 64 bit assembly, it cannot be loaded. When you build your test project assembly, select "Any CPU" for the platform. To run your tests in 64 bit mode on a 64 bit processor, you must change your test settings in the Hosts tab to run your tests in a 32 bit process"

I can't build my logic.dll and AppTests.dll to "any cpu".

I read this post: How do I get unit tests to run on a x64 platform

But in my case, I am running the tests from dot cover command line tool and not from the visual studio UI.

What can I do? Is there any other option?

Thanks.


Solution

  • I was getting answer from Resharper support and it solve my issue, so I am sharing it.

    <AnalyseParams>
         <TargetExecutable>C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe</TargetExecutable> 
         <TargetArguments>D:\Projects\TheApplication\bin\Debug\AppTests.dll /Settings:"<your path>\runsetting.xml"</TargetArguments>
         <Output>AppCoverageReport.html</Output>
         <ReportType>html</ReportType>
    </AnalyseParams>