# NCover Plugin

#### Plugin Information

 Plugin ID ncover 0.3 Mar 03, 2010 Plugin Central 3.2 Subversion Eclipse Hudson Forum Eclipse Bugzilla 3.3.3

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.

## Labels:

plugin-report plugin-report Delete
plugin-deprecated plugin-deprecated Delete

1. Jul 17, 2009

Hi - awesome that an NCover Plugin has been released!! I have a bit of...

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)?

1. Jul 28, 2009

Thanks to Julian this is fixed in the latest version of the plug-in 0.2.6 so upg...

2. Jul 20, 2009

Hi! I just found out how to get this working! Pre-Reqs: You need mav...

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. Jul 21, 2009

I was using jdk 1.5 but with your workaround the report is generated and display...

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

3. Jul 21, 2009

Hi, the ncover plugin installed successfully, and I followed the instruction lis...

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. Jul 28, 2009

Hi Karega, you need at least Hudson 1.312 to use this plug-in. You should be abl...

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. Jul 31, 2009

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

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. Aug 12, 2009

Varun, it looks like you are not using the latest version of the plug-in, but th...

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. Sep 06, 2009

HI , I have been finally able to  get the plugin running, one thing that I...

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. Aug 28, 2009

Why haven't this plugin used the XML file like the Clover Plugin. This would all...

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. Sep 03, 2009

Hi Trond!That was not in the scope of my project; my goal was just to archiv...

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. Sep 21, 2009

Am I correct in observing that the inability to use XML reports would require an...

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. Feb 17, 2010

If the Complete version is the only one that generates HTML reports, that would ...

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. Aug 12, 2010

Hi, Trying to use NCover with MSBuild & NUnit. Everything is going fine un...

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. Aug 16, 2010

The wiki is not so great for support/bug reporting, could you create an issue on...

The wiki is not so great for support/bug reporting, could you create an issue on issues.hudson-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.