|
Using NoUnit and Code Pictures
(1) Get the NoUnit Code
(2) Get the Supporting Jars
(3) Extract the NoUnit Files
(4) Update the NoUnit Batch / Script
(5) Run the NoUnit report
(6) Have Fun using and extending the reports!
(1) Get the NoUnit Code
Download
nounit.zip or nounit.tar.gz from SourceForge.
(2) Get the Supporting Jars
The following are the required Jars to run NoUnit. They are available
within the required-jar
folder of SourceForge for ease of setup. I'd recommend checking out the websites
of each of these projects to get the latest versions.
- jclasslib.jar , the Java Byte code reader available through NetBeans.
- jdom.jar , an easy to use XML Parser from JDOM.
- xalan , xerces and parser.jar : Base XML Parsers and XSLT processors from Apache.
- (Optional) JUnit , to run the tests within the NoUnit Project from JUnit.
Although this software comes from open-source projects , the license conditions may
be different to that of NoUnit and copyright rests with the respective projects.
(3) Extract the NoUnit Files
Extracting nounit.zip / nounit.tar.gz will give you the following files:
- nounit.jar - NoUnit java class files.
- 'batch' folder - sample NT scripts to run NoUnit.
(yep , we could do with Unix scripts but it should be easy to
see what's going on).
- 'dtd' folder - (simple) explanation of the layout of XML produced by NoUnit / Code Pictures.
- 'output' folder - sample NoUnit xml and reports , and the four graphics used in the NoUnit report .
( put
your output straight into here , and everything will work ok).
- 'xslt' - the XML style sheets used to transform the XML into the HTML Code Pictures.
(4) Update the NoUnit Batch / Script
Below is the code from NoUnit.bat (in the batch folder) that calls the transformation. You'll
need to update it in line with your system setup.
java -classpath "G:\web-nounit-distro\nounit.jar;
\NoUnitFiles\jar\jdom.jar;\NoUnitFiles\jar\jaxp.jar;
\NoUnitFiles\jar\parser.jar;\NoUnitFiles\jar\xalan.jar;
\NoUnitFiles\jar\xerces.jar;\NoUnitFiles\jar\jclasslib.jar;"
net.firstpartners.nounit.ui.command.CommandLineProcessor
start_dir G:\\NoUnitFiles\\
output_dir G:\\web-nounit-distro\\output\\
report_class net.firstpartners.nounit.report.CallsReport
report_name G:\\web-nounit-distro\\xslt\\no-unit.xsl
output_file no-unit.htm
- - classpath : update with where you saved the Jar's from step (2).
- - net.firstpartners.nounit.ui.command.CommandLineProcessor : main start class - do not change
- start_dir - The start directory where the Java Classes you want to
analyze are sitting.
- output_dir - Directory where XML and final (NoUnit) Code Picture will be generated.
- report_class - The pluggable java class to generate report
(more details).
- report_name - The name of the XSLT to do the final XML -> HTML conversion (more details).
- output_file - The name to call the final Code Picture / NoUnit report.
The other batch file (simple-code-picture.bat) is similar.
(5) Run the NoUnit report
Run the batch file / script that you set up in (4). The XML and Code Pictures will
be in the output directory that you specified.
(6) Have Fun using and extending the reports!
NoUnit and Code Pictures are very flexible and extendable. For details on
how to extend NoUnit to do exactly what you want , click here.
|