NCover, MbUnit, CCNet

NCover, MbUnit, CCNet

NCover and MbUnit play very nice togther, either from the command line, TD.net or ccnet.

From the command line its

ncover.console mbunit.cons.exe myassembly.dll

Don't forget the .exe, this assumes all the paths to the various thigs are mapped but if not

c:"program files"ncover"ncover.console.exe c:"program files"mbunit"mbunit.cons.exe myassembly.dll

If your using TD.net then simply use the right click and test with coverage option inside your unit test, it works just as well with MbUnit :)

If your using ccnet then you have a little more to do.

First alter your msbuild or nant file so that your unit tests are run from the mbunit.cons (using an exe task) and not the mbunit task. If your using MsBuild then its something like

<Exec WorkingDirectory="unitests"bin"debug"" Command="C:"Progra~1"NCover"ncover.console mbunit.cons.exe /rnf:unittest /rt:xml /rf:C:"CCNet"server"test"Artifacts unittests.dll //x C:"CCNet"server"test"Artifacts"ncover.xml" />

Note the working directory, this where your unittest assembly will be located. Note the use of progra~1 as program files is not undertsood by ccnet. Note that /rnf is the name of your unitest report and /rt: indicates its an xml file. Note that we use //x to output the ncover xml to the ccnet directory and /rf: to do the same for mbunit.

When thats working for you, edit your ccnet file to merge the outputs

 <merge>
         <files>
            <file>C:"CCNet"server"test"Artifacts"ncover.xml</file>
            <file>C:"CCNet"server"test"Artifacts"unittest.xml</file>
             <file>C:"CCNet"server"test"Artifacts"msbuild-results.xml</file>
         </files>
     </merge>

你可能感兴趣的:(over)