Question

I am trying to use the HTML reports generated by my unit tests to show in the CruiseControl.NET dashboard, but I don't know where I'm scewing it up.

I have my report generated in the "CCNetWorkingDirectory". In my "CCNet.config" file I am using the File Merge Task to copy the report to my "CCNetArtifactDirectory". This is the step that does not work. I tried it in many different ways. I have:

<publishers>
    <merge>
        <files>
            <file>
                Index.html
            </file>
            <file action="Copy">
                rep\Index.html
            </file>
        </files>
    </merge>
    <xmllogger/>
</publishers>

What should the paths in my configuration file be? My build breaks with the message:

"Failing Tasks : MergeFilesTask"

I really don't know what I am doing wrong.

Was it helpful?

Solution

I finally solved the problem.

In my ccnet.config file in the publishers node I have to copy the report.html like this:

<publishers>
  <merge>
    <files>
        <file action="Copy">PathToWorkingDirectory\report.html</file>
    </files>
  </merge>
  <xmllogger />
  <artifactcleanup cleanUpMethod="KeepLastXBuilds"
                   cleanUpValue="50" />
</publishers>

The file will be copied to the artifact directory to a folder named like the Build Label. This has to be done due to security reasons:

HTML Source Location
This plug-in can display any file that is in the build folder under artifacts folder for the project. It cannot display files from any other location (for security reasons).

To display the HTML report you simply have to add this line to your dashboard.config:

<htmlReportPlugin description="HRMLReport" actionName="htmlreport" htmlFileName="report.html" />

This line has to be placed under the buildPlugins node.

<buildPlugins>
  <buildReportBuildPlugin>
    <xslFileNames>
      <xslFile>xsl\header.xsl</xslFile>
      <xslFile>xsl\modifications.xsl</xslFile>
    </xslFileNames>
  </buildReportBuildPlugin>
  <buildLogBuildPlugin disableHighlightingWhenLogExceedsKB="50"/>
  <htmlReportPlugin description="HRMLReport" actionName="htmlreport" htmlFileName="report.html" />
</buildPlugins>

After these steps your report should be displayed if you navigate in your dashboard to the build which generates the file. There should be a link called HTMLReport.

OTHER TIPS

Quick Version:

Note all the examples at:

http://www.cruisecontrolnet.org/projects/ccnet/wiki/File_Merge_Task

are "*.xml" files.

<merge>
  <files>
    <file>Nunit*.xml</file>
    <file>FXCop.xml</file>
    <file>resources\**\*.xml</file>
    <file>E:\CruiseControl\BuildRoot\ProjectX\**\coderesults.xml</file>
    <file>E:\CruiseControl\BuildRoot\Project*\**\Business*.xml</file>
  </files>
</merge>

You need to merge .xml, not .htm(l).

Longer Version:

The merge task merges ~xml.

Whenever there is a build, there is a "MyBuildResults.xml" file, which I call the "super-xml".

If you have a tool (like NUnit(console).exe for example), that tool will push out a file, "NUnitTestResults.xml".

The CruiseControl.NET merge task will then take "NUnitTestResults.xml" (operative thing, it is XML) and "merge" that into the MyBuildResults.xml (again, XML).

That kind of makes sense. You can merge XML into other XML. How could you take any file and merge it into any file, including an .html file. If you merge HTML, what comes first? Last? Middle?

Now, once your have a final "MyBuildResults.xml", there are .XSL files that will transform that into .html that shows up in the CruiseControl.NET project webpage.

You'll notice a bunch of links (to the left) of the CruiseControl.NET webpage...one of them being "NUnit Test Results". But out of the box, if you click it, nothing displays.

That's because no NUnitTestResults.xml has been "merge up into" the super-build-xml file.

If you find the .xsl files that CruiseControl.NET installs for you (or you installed after the fact), take a look at those, that will show you how that .xsl transforms the XML of the "super-build-xml".

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