Coverage report says zero coverage on C#.Net Test code (For Nunit test)

1.2k views Asked by At

I am trying to get the code coverage for the C# test project(Nunit test case) Using OpenCover for sonarqube analysis. I ran the Following Executing cmd in command prompt(from the C# project solution folder & From C# project folder) but always i am getting the below executon output. I got the executing command from sonar page.

Is there anything i done wrongly or should i need to add any more argument to get the report.

System & Software Details:

  • OS: Windows7 64 bit
  • MsBuild Version: 14
  • Visual Studio : VS2015
  • Opencover version: 4.6.166.0
  • Nunit Version: 2.4.8.0 (Only having the Nunit core, Nunit framework & Nunit core interfaces library dll's)
  • SonarQube version: 5.6.5
  • SonarC# version: 5.10.0.1411
  • Sonar scanner for MSBuild Version: 2.2.0.24

Executing cmd : "C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -output:"SolutionFolder.sonarqube\opencover.xml" -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" -targetargs:"SolutionFolder\UnitTestProject1\bin\Debug\UnitTestProject1.dll"

Execution Output: Executing: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe Microsoft (R) Test Execution Command Line Tool Version 14.0.25420.1 Copyright (c) Microsoft Corporation. All rights reserved. Starting test execution, please wait... Warning: Using Isolation mode to run tests as required by effective Platform:X86 and .Net Framework:Framework35 settings for test run. Use the /inIsolation parameter to suppress this warning. Warning: No test is available in SolutionFolder\UnitTestProject1\bin\Debug\UnitTestProject1.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again. Information: Additionally, you can try specifying '/UseVsixExtensions' command if the test discoverer & executor is installed on the machine as vsix extensions and your installation supports vsix extensions. Example: vstest.console.exe myTests.dll /UseVsixExtensions:true Committing... Visited Classes 0 of 1 (0) Visited Methods 0 of 22 (0) Visited Points 0 of 117 (0) Visited Branches 0 of 22 (0) ==== Alternative Results (includes all methods including those without corresponding source) ==== Alternative Visited Classes 0 of 1 (0) Alternative Visited Methods 0 of 23 (0)

Note: In the Coverage output report, am only getting zero percentage coverage.

0

There are 0 answers