Justus Coverage uses Progress Profiler data to account programs execution and check if they comply to pre-configured categories' rates.
The execution coverage information is very useful for software testing since it makes possible to identify parts of the tested software that haven't been "touched" by the test, that is, potentially buggy code.
Justus Coverage can be used both with manual and automated tests since it's based on Profiler's data.
Since Justus Coverage uses data generated by Progress Profiler utility, you should have the files already saved before starting the application. You'll need both the data file (usually a .out file) and the listing files (having the source code).
You won't be able to check coverage running binaries.
To start Justus coverage you have to run:
justus coverage |
Be sure you have $JUSTUS_HOME/bin on your path.
When you start it, a dialog will be shown asking for the files created by the Profiler. If you have already configured a categorisation file, you may also inform it and then click OK.
Once Justus Coverage had finished loading all the data it will show a windows with all the source code found and, for each file, the coverage rate.
On the right you'll be able to check the source code and the status of each statement. Justus Coverage will use different colors to highlight covered statements (black), not covered (red) and ignored (gray).
If you have too many source files finding them on the treeview may be a little confusing and then you may want to create categories to group related sources. Just click File, Edit Categories and you'll be able to create categories.
You can create new categories using the New button down on the left corner. For each category you'll be able to add rules to include and/or exclude files to that category.
Once you create or remove rules, Justus Coverage will calculate which files meet your requirements in the grid called "Matching Programs". Just click OK (down in the middle) to refresh the main view windows.
You may save you categories configuration using the File, Save Categories on the main menu.
You can save coverage results in an XML format so you don't have to process all the files every time you want to check the content or if you want to send them to someone who doesn't have Justus Coverage Installed.
Click on File, Save Results in the main Menu, and you'll be asked to inform an output file (.xml). Just inform it and click OK. Open the generated file using a browser that supports XSLT (Internet Explorer or Firefox)
Justus Coverage can be run as an Ant task, specially for automated building and testing. The box bellow shows an example:
<project name="CoverTest" basedir="." default="use"> <property file="build.properties" /> <taskdef resource="PCT.properties" classpath="${PCT.home}/lib/PCT.jar" /> <taskdef resource="Justus.properties" classpath="<INST_DIR>/justus.jar" /> <target name="use" description="Checking Code Coverage"> <delete dir="${temp.dir}" /> <mkdir dir="${temp.dir}"/> <mkdir dir="${temp.dir}/code"/> <echo file="${temp.dir}\profiler.pf" append="false"> # Justus Coverage - Progress Profiler Parameter File ${line.separator} -OUTFILE ${temp.dir}/profResult.out ${line.separator} -LISTINGS ${temp.dir}/code ${line.separator} -DESCRIBE "Performance_Test" </echo> <ProUnit project="prounitSuite.xml" result="${temp.dir}/result.xml" verbose="false" dlcHome="${DLC.home}"> <option name="-zprofile" value="${temp.dir}\profiler.pf"/> </ProUnit> <JustusCoverageTask profileFile="${temp.dir}/profResult.out" sourcefolder="${temp.dir}/code" resultFile="${temp.dir}/coverage.xml" coverageConfig="categories.xml" noChecking="true"/> </target> </project> |
Justus Coverage can also be run on command line
java -classpath justus.jar <parameters> net.cordova.justus.coverage.JustusCoverage [view|save] |
-DprofileFile=c:/myProject/profResult.out | Progress Profiler's result file. |
-Dsourcefolder=c:/myProject/proflist | Progress Profiler's source output folder. |
-DcoverageConfig=c:/myProject/coverage.xml | Justus Coverage categories configuration. |
-DresultFile=c:/myProject/coverageResult.xml | Justus Coverage result file (required if using save option). |
view | Runs Justus Coverage GUI Interface for viewing coverage results. |
save | Saves Justus Coverage result file. |