Question

I am using open cover with MSTest. I am a new users and trying to get hang of Opencover. I have tried with MSTest and MSTest is working fine with my new project in Vs2010. When I am executing following test using MStest it is working fine:

Command line run of MS Test :

MSTest /testmetadata:VoterDetails.vsmdi /testlist:DOBTest

Result:

C:\Users\<<MYuserName>>\Documents\Visual Studio 2010\Projects\VoterDetails>
MSTest /testmetadata:VoterDetails.vsmdi /testlist:DOBTest 
Microsoft (R) Test Execution Command Line Tool Version 10.0.30319.1 Copyright (c) Microsoft Corporation. All rights reserved.
Loading VoterDetails.vsmdi...
Starting execution...

Results               Top Level Tests
-------               ---------------
Passed                (DOBTest/)UT_voterDOB.VoterValidationTest.validateVoterDOB
Test
1/1 test(s) Passed

Summary
-------
Test Run Completed.
Passed  1
---------
Total   1
Results file:  C:\Users\<<MYuserName>>\Documents\Visual Studio 2010\Projects\VoterDetails\TestResults\<<MYuserName>>.trx
Test Settings: Local

But When I am executing following command then I am getting following result: I am posting all combinations I have tried:

C:\Users\<<MyUserName>>\AppData\Local\Apps\OpenCover>OpenCover.Console.exe 
-register:user 
-target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe"              
-targetargs:"/testmetadata:VoterDetails.vsmdi /testlist:DOBTest" 
-filter:+[VoterDetails]*

Access is denied.

C:\Users\<<MyUserName>>\AppData\Local\Apps\OpenCover>OpenCover.Console.exe 
-register:-arch:32 
-target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" 
-targetargs:"/testmetadata:VoterDetails.vsmdi /testlist:DOBTest" 
-filter:+[VoterDetails]*  -output:coverage.xml

Access is denied.

 C:\Users\<<MyUserName>>\AppData\Local\Apps\OpenCover>OpenCover.Console.exe 
 -target:"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" 
 -targetargs:"/testmetadata:VoterDetails.vsmdi /testlist:DOBTest" 
 -filter:+[VoterDetails]*  
 -output:coverage.xml 
 -mergebyhash

Access is denied.

Was it helpful?

Solution

How will MSTEST know where to find VoterDetails.vsmdi when you are running in the wrong folder; try running from OpenCover from

C:\Users\<<MYuserName>>\Documents\Visual Studio 2010\Projects\VoterDetails

i.e.

C:\Users\<<MyUserName>>\AppData\Local\Apps\OpenCover>OpenCover.Console.exe -register:user ...

also -arch:32 is not a valid option for OpenCover

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top