Setting up the XRadar for a project is a relatively simple task with ant. It will probably take you less than a couple of hours to set up your project with ant. In this case you will get the analysis for the current build on the system. Setting up XRadar Dynamics, might take a litte longer since it involves having the source and builds of previous system releases. Once you have that the task of setting XRadar Dynamics up is fairly simple.
To get the XRadar properly installed, you first need to do some mandatory downloads and installs, second set some common properties and do some simple configs, and finally running the testproject to see that everything is working smoothely.
Before you begin installing the XRadar, the following prerequisites are mandatory:
| Setup Property | Description | Commands |
|---|---|---|
| ANT.HOME | XRadar uses the environement variable to find its Ant, you most likely have this variable set is already using ant. | On windows : set ANT_HOME="path/to/ant", on *nix : export ANT_HOME="/path/to/ant" |
Update XRADAR_HOME/testproject/user.properties with the follow value.
| Setup Property | Description |
|---|---|
| xradar.home | Set to the xradar home directory. |
XRadar is a XSLT product based, and it uses Ant for the transformation, which means XRadar is basicly a bunch of xsl script triggered by Ant. In order to run the XRadar properly, you need to set properly your Ant environement.
# For windows
ANT_OPTS=-Dfile.encoding=ISO-8859-1
# For *nix
export ANT_OPTS="-Dfile.encoding=UTF-8"
# For windows
ANT_OPTS=-Dfile.encoding=ISO-8859-1 -Xmx512M
# For *nix
export ANT_OPTS="-Dfile.encoding=UTF-8 -Xmx512M"
# For windows ANT_OPTS=-Dfile.encoding=ISO-8859-1 -Djava.endorsed.dirs=XRADAR_HOME/lib/endorsed/ -Xmx512M # For *nix export ANT_OPTS="-Dfile.encoding=UTF-8 -Djava.endorsed.dirs=XRADAR_HOME/lib/endorsed/ -Xmx512M"
# For windows
ANT_OPTS=-Dfile.encoding=ISO-8859-1 -Duser.language=en -Djava.endorsed.dirs=XRADAR_HOME/lib/endorsed/ -Xmx512M
# For *nix
export ANT_OPTS="-Dfile.encoding=UTF-8 -Duser.language=en -Djava.endorsed.dirs=XRADAR_HOME/lib/endorsed/ -Xmx512M"
All of this will ensure that when you run ant, the needed operations will get the right encoding information. Furthermore, the Xmx preoperty ensures that you have enough memory to run the XRadar (works with 5000 classes). Notice that if you have problems with a even larger project, this propery may be set higher.
After having done the previous steps, you are ready to see if the configuration works. The testproject can also be used as a template for how you may implement analysis on your own project.
In your console, go to the XRADAR_HOME directory and type:
XRADAR_HOME$ cd testproject
XRADAR_HOME/testproject$ ant
On a modern PC, the task will take a few minutes ( 1 to 5), and should run successfully. If not, there is something wrong in the configuration (you should go back and see if there is something that you have forgotten).The script will build 4 test projects and analyse them all. The XRadar Statics analysis of these projects can be found in XRADAR_HOME/release[1..4]/docs/index.html on your system. The XRadar Dynamics analysis for them all can be found in XRADAR_HOME/dynamics/docs/index.html. Enjoy!
After these initial steps, you may continue with the XRadar setup for your project through XRadar Statics Installation and XRadar Dynamics Installation . We do recommend that you do try to install the Unit test and coverage features so that you can see the XRadar's full potentional, however, Cobertura is known to be quite buggy. We plan to have it replaced by the new Emma project as soon as possible. Anyway, if you're interested in this feature, read on!
If you want to integrate JUnit or JCoverage into the XRadar, that is possible as well. JUnit is the first thing recommended to integrate. The solution is fairly simple. From $XRADAR_HOME/testproject/lib, copy junit.jar over to the $ANT_HOME/lib directory.
Then, in your console, go to the $XRADAR_HOME/testproject directory and type:
# On windows
export ANT_OPTS="-Dinclude.junit=true"
$XRADAR_HOME\testproject$ ant
# On *nix
$XRADAR_HOME/testproject$ ant -Dinclude.junit=true
The system will now build the unit tests and run them against the testproject. A report will finally be formatted and integrated into the XRadar. The prosess will take some time, but afterwards, you will see unit test metrics in both XRadar reports.
The second part that you may want to integrate is Cobertura test coverage tool. The solution is relatively simple, but since the XRadar is licenced under a standard BSD licence, and Cobertura runs under GPL, we cannot distribute it with the XRadar. See instructions below.
What you need to do is to get a full cobertura installation from cobertura site . The installation will typically come in a zip file. All jar-files included in the zip, you need to put in the $XRADAR_HOME/testproject/lib directory.
Assuming you have done the necessary installion of junit as described in the previos section you are now ready to go. In your console, go to the $XRADAR_HOME/testproject directory and type:
# On windows
export ANT_OPTS="-Dinclude.junit=true -Dinclude.cobertura=true"
$XRADAR_HOME\testproject$ ant
# On *nix
$XRADAR_HOME$/testproject ant -Dinclude.junit=true -Dinclude.cobertura=true
The system will now instument the classes of the testproject for coverage. The the system will build the unit tests and run them agains the testproject. A junit-report and cobertura-report will finally be formatted and integrated into the XRadar.
An optional second part that you may want to integrate is JCoverage as a replacement to cobertura. Still, Cobertura is based on the GPL version og JCoverage, and seems much more stable. Hence we recommend to only use JCoverage if you are using the commersial version. Jcoverage is a commercial company but has an open source version of its tool. The problem is that the xml-stream from the open source version is not working properly, but you can get a trial version of JCoverage-plus from their site if you register some information. In the future, let's hope they fix their bug. The following solution should be similar for both versions.
What you need to do is to get a full jcoverage installation from jcoverage . The installation will typically come in a zip file. All jar-files included in the zip, you need to put in the $XRADAR_HOME/testproject/lib directory. For jcoverage-plus, you will also need to put the licence file in the same directory.
Assuming you have done the necessary installion of junit as described in the previos section you are now ready to go. In your console, go to the $XRADAR_HOME/testproject directory and type:
$XRADAR_HOME$/testproject ant statics_all dynamics_all -Dinclude.junit=true -Dinclude.jcoverage=true
The system will now instument the classes of the testproject for coverage. The the system will build the unit tests and run them agains the testproject. A junit-report and jcoverage-report will finally be formatted and integrated into the XRadar.