##### Child pages
• NCover Plugin

## and how to migrate your plugin documentation in this blogpost

Go to start of banner

# NCover Plugin

Plugin Information

No information for the plugin 'ncover' is available. It may have been removed from distribution.

Archive and publish .NET code coverage HTML reports from NCover.

It is recommended to use instead the more flexible and robust HTML Publisher plugin, which was generalized from this plugin after its creation.

# Screenshots

The post-build action when configuring a project:

The coverage project/build action which sends you to the archived HTML report:

# Configuring the NCover Plugin

The NCover plug-in requires Hudson 1.312 or greater. If you are using an older version of Hudson, use its automatic upgrade feature first by visiting the "Manage Hudson" link on your Hudson dashboard and click the "Upgrade Automatically" button near the top.

1. Install the NCover plugin (via Manage Hudson -> Manage Plugins -> Available, check "NCover", and click the "Install" button at the bottom)
2. Configure your project's build script to generate NCover HTML reports (see below for an example with Gallio)
3. Enable the "Publisher NCover HTML report" publisher
4. Specify the HTML report directory which is generated by NCover, relative to the project workspace.
5. Optionally change the report name to be displayed. Multiple reports can be specified separated by commas.

# Generating NCover HTML reports

For generic help on this topic, see http://docs.ncover.com/how-to/create-ncover-reports/

When using Gallio, you can simply use the NCover runner. You'll need to pass two arguments to Gallio.Echo.exe. Make sure to replace the variables in caps with the actual path you want:

• /runner:ncover3
• /runner-property:NCoverArguments="//html HTML_DIR_NAME //at TRENDS_FILE"
• The "//at TRENDS_FILE" is optional but will keep track of coverage over time and include graphs in your HTML report

An example command might look like:

 C:\Program Files\Gallio\bin\Gallio.Echo.exe "C:\path\to\your.dll"
/runner:ncover3
/runner-property:NCoverArguments="//html artifacts\coverage-html //at ncover3.trend"


# Version History

#### Version 0.3 (Mar 3, 2010)

• Update code for more recent Hudson

#### Version 0.2.6 (Jul 28, 2009)

• Improve compatibility with older Java versions including 1.4
• Remove debug logging that was ending up in the build log

#### Version 0.2.5 (Jul 16, 2009)

• Allow for a report page to be named index.html instead of stomping over it
• Drop the filename extension from the tab names

#### Version 0.2.0 (UNRELEASED)

• Allow specifying multiple HTML files to be shown by separating with commas, and show in tabs

#### Version 0.1.0 (UNRELEASED)

• Initial release, allowing for archiving and displaying of NCover HTML coverage report directories.

1. Hi - awesome that an NCover Plugin has been released!!

I have a bit of a problem and not sure what it is.

I get an error when the plugin tries to publish NCover reports

Publishing NCover HTML report...
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\bootstrap.jar
Debug: http://qaserv01:8080/hudson/
FATAL: java.lang.String.isEmpty()Z
java.lang.NoSuchMethodError: java.lang.String.isEmpty()Z
at ncover.NCoverArchiver.perform(NCoverArchiver.java:211)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:379) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:367)
at hudson.model.Build$RunnerImpl.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:352)
at hudson.model.Run.run(Run.java:958)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:118)

I have a rather old NCover version in place - may this be the problem?

NCoverExplorer.Console 1.4.0.7

Or is it that the result file is not found (is directly located in the workspace folder)?

2. Hi! I just found out how to get this working!

Pre-Reqs:

You need maven on the machine in order to be able to build the plugin. Please refer to maven documention for installing maven.

- Get the source code for the ncover plugin

- In the file "NCoverArchiver.java" change the line  "if (!report.isEmpty()) {" to "if (!report.trim().equals("")) {".

- Recompile the plugin and use it in your hudson environment (assuming that maven is installed and configured correctly, fire up a cmd [on windows systems], navigate to the source folder (the pom.xml has to be in this folder) and type "mvn".).

I guess you're using an older JDK (1.4?), so the method "isEmpty()" can't be found because it's not supported. The method was introduced in Java 1.6: http://java.sun.com/javase/6/docs/api/java/lang/String.html#isEmpty%28%29\\

HTH,

Best Regards,

Julian

1. I was using jdk 1.5 but with your workaround the report is generated and displayed fine - thx a lot!

3. Hi, the ncover plugin installed successfully, and I followed the instruction listed below. but when I click the Code Coverage link it produces the following error.

# Status Code: 500

Exception:
Stacktrace: java.lang.NoSuchMethodError: hudson.model.DirectoryBrowserSupport.setIndexFileName(Ljava/lang/String;)V
at ncover.NCoverArchiver$BaseNCoverAction.doDynamic(NCoverArchiver.java:299) at ncover.NCoverArchiver$NCoverAction.doDynamic(NCoverArchiver.java:308)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:160) at org.kohsuke.stapler.MetaClass$11.dispatch(MetaClass.java:297)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:486)
at org.kohsuke.stapler.MetaClass$12.dispatch(MetaClass.java:318) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:486) at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:186)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:30)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:486)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:404)
at org.kohsuke.stapler.Stapler.service(Stapler.java:117)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
at winstone.ServletConfiguration.execute(ServletConfiguration.java:249)
at winstone.RequestDispatcher.forward(RequestDispatcher.java:335)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:378)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:91) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:83) at winstone.FilterConfiguration.execute(FilterConfiguration.java:195) at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:155)
at winstone.FilterConfiguration.execute(FilterConfiguration.java:195)
at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:368)
at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)

Generated by Winstone Servlet Engine v0.9.10 at Tue Jul 21 22:14:09 CDT 2009

Console out list Success
BUILD SUCCEEDED

Total time: 20.1 seconds.

Publishing NCover HTML report...
c:\devtools\Hudson\hudson.war
Debug: http://192.168.83.44:8080/
Report: 'Program/src/Build/Debug/Program.Test.dll-ncoverage.html'
Recording NUnit tests results
Finished: SUCCESS

What am I doing wrong? I need help ASAP! Very new to hudson.

1. Hi Karega, you need at least Hudson 1.312 to use this plug-in. You should be able to upgrade automatically by going into the "Manage Hudson" link from the main page of your Hudson dashboard.

4. Hi I have been banging my head against NCover plugin but getting this error

Total time: 237.6 seconds.

Publishing NCover HTML report...
C:\XXXX\XXXX\XXXXX\hudson\Server\hudson.war
Debug: null
Debug: http://localhost:8080/
FATAL: null
java.lang.NullPointerException
at ncover.NCoverArchiver.perform(NCoverArchiver.java:195)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:379) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:367)
at hudson.model.Build$RunnerImpl.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:352)
at hudson.model.Run.run(Run.java:958)
at hudson.model.Build.run(Build.java:112)
at hudson.model.ResourceController.execute(ResourceController.java:93)
at hudson.model.Executor.run(Executor.java:118)

My Ncover version is .2.6 and hudson is 1.3.15, please help as this is the major hurdle for us in moving from CCnet to hudson.

1. Varun, it looks like you are not using the latest version of the plug-in, but the debug information seems to imply that you aren't specifying any reports to display. What values have you specified in the directory and reports field?

1. HI ,

I have been finally able to  get the plugin running, one thing that I have noticed is that it requires you to speicfy the path in unix format using  forward slashes '/' instead of the back slashes of windows "\".

5. Why haven't this plugin used the XML file like the Clover Plugin. This would allow the plugin to specify Coverage metric targets just like the Clover Plugin. Another benefit would be that The Continuous Integration Game plugin could used the numbers to add or remove points to the developer as they check in code with better or worse test coverage.

1. Hi Trond!That was not in the scope of my project; my goal was just to archive and publish HTML reports, so that's what the plug-in currently does. If you would like to enhance it more that would be great, however.

1. Am I correct in observing that the inability to use XML reports would require anyone using this plugin to purchase a copy of NCover Complete (currently \$479) for the build server?

1. If the Complete version is the only one that generates HTML reports, that would be true. Does the free Community version not generate HTML?

6. Hi,

Trying to use NCover with MSBuild & NUnit.

Everything is going fine until the end of ncover, get the following error:

E:\Hudson\jobs\NUnitTest\workspace>exit 1
Publishing NCover HTML report...
Report: 'fullcoveragereport.html'
Report: 'uncoveredreport.html'
ERROR: Directory 'E:\Hudson\jobs\NUnitTest\coverage' exists but failed copying to 'E:\Hudson\jobs\NUnitTest\builds\2010-08-12_15-33-23\ncover'.
Recording NUnit tests results
Finished: FAILURE

My 'Execute Windows batch command' is:

"E:\Program Files (x86)\Gallio\bin\Gallio.Echo.exe" E:\Hudson\jobs\NUnitTest\workspace\NUnitTest\NUnitTest.Test\bin\Release\NUnitTest.Test.dll" /runner:ncover3 /runner-property:NCoverArguments="//html E:\Hudson\jobs\NUnitTest\coverage //at ncover3.trend"

Any thoughts?

1. The wiki is not so great for support/bug reporting, could you create an issue on issues.jenkins-ci.org if you find that is reproducible? You might also try the HTML Publisher plugin, I'll add a note to the top of the wiki page here.

7. I am working with a windows application in c#.

Using Jenkins, i created a job that will do the following tasks.
1.Build the application using msbuild
2.Tests Unit Test Cases using nunit-console.exe
3.Calculate Code coverage using NCover. (Issue)
4.Later publish the application using Nant plugin

Tasks 1, 2 and 4 works fine, while 3 having issue.

Can somebody put light on this matter?

This is the batch file that i used to find out the coverage "C:\Program Files\NCover\NCover.Console.exe" "E:\Myapp\test.exe" -h //x "E:\Newfolder\coverage.xml"

The batch file is executed in Jenkins and we can see the Test.exe in task manager, what i need is the code coverage in html format when executing the Nunit test cases and no need to run my text.exe

"D:\Set Up\Nuint\NUnit-2.6.2\bin\nunit-console.exe" "E:\Myapp\test.sln" /xml="E:\Newfolder\TestResult.xml"

This is the batch command that i used to test the test cases, i need to know the code coverage while executing the test case, but in my case my test.exe is executed and NCover console.exe start monitor my test.exe for calculating the coverage

i tried to find out the coverage with "D:\Set Up\GallioBundle-3.4.14.0\bin\Gallio.Echo.exe" "E:\Myapp\test.exe" /runner:ncover3 /runner-property:NCoverArguments"//html E:\test //at ncover3.trend" build is succeded, but no covrage html/xml is created

i tried by adding "C:\Program Files\NCover\NCover.Console.exe" infront of "D:\Set Up\Nuint\NUnit-2.6.2\bin\nunit-console.exe" "E:\Myapp\test.sln" /xml="E:\Newfolder\TestResult.xml" , build succeded. and in console o/p found some coverage data  like

Execution Time: 92.4688 s
Symbol Coverage: 43.72%
Branch Coverage: 22.70%

and coverage.nccov file is created . but i need to create/show a coverage report in html format.

1. steps to solve

1.Need to monitor the execution of Test cases Using ncover-console.exe
This will create a .nccov file in Jenkins workspace folder
"C:\Program Files\NCover\NCover.Console.exe" "D:\Set Up\Nuint\NUnit-2.6.2\bin\nunit- console.exe" "E:\Myapp\test.sln" /xml="[PATH]\TestResult.xml"

2.Create coverage html report from .nccov file using NCover.Reporting.exe
"C:\Program Files\NCover\NCover.Reporting.exe" "C:\Program Files\Jenkins\jobs\Fluent XA\workspace\coverage.nccov" //or FullCoverageReport:Html:output

This will create an output folder in Jenkins work space which contains all the coverage reports in HTML formats

don't forget to add post build action to publish Ncover Html Reports