•
|
•
|
•
|
•
|
Add the jar file’s directory as a command line -lib argument.
|
1.
|
Create a new file (e.g., parasoft.xml or jtest.xml). In this file, you will import your original Ant build file as well as specify how you want Ant to run the Parasoft plugin.
|
2.
|
Start that file by defining the project and calling the Parasoft Ant library. Add one project definition for each logical project in your build script. Each project defined here will be reported to Parasoft Concerto as a separate project. For example:
<project name="Parasoft Test Build" default="parasoft-test" xmlns:parasoft="antlib:com.parasoft.antlib"> If the build.xml being imported has its project definition basedir set to anything other than the current directory ".", add the same basedir to this configuration. For example: <project name="Parasoft Test Build" default="parasoft-test" xmlns:parasoft="antlib:com.parasoft.antlib" basedir=".."> (If omitted, it defaults to ".") |
3.
|
Import the original Ant build.xml file. For example:
<import file="build.xml"/> This step is not required for running SOAtest. |
4.
|
Add a target for the Parasoft task you want executed and use dependencies to specify the task to integrate with (e.g., build). For example:
<target name="parasoft-test" depends="build"> For SOAtest, you do not need to use dependencies to specify the task to integrate with. |
5.
|
Configure the target for the task. Be sure to specify
a. Any required or desired task options described in the plugin reference page b. (Not required for SOAtest) Either javacref or monitorref (described below) to specify which compilation targets you want to operate on. For example: <!-- To use and configure Parasoft Test Plugin --> <parasoft:jtest config="builtin://Static Analysis"> <!-- javacref refers to the ID of the specific javac in build.xml --> <projectDescription basedir="." javacref="javacId" overwrite="true"/> </parasoft:jtest> |
•
|
To automatically record the project’s javac targets, use the parasoft:monitor task. As your project builds, the monitor will record every call to the javac compiler. You can then give the monitor an ID then reference the monitor in your Parasoft script. If you are writing an Ant script in a very dynamic way (e.g., using <antcall/> to call the javac compiler multiple times with different arguments), using the monitor is highly recommended. See Using the Monitor below for more details.
|
•
|
To have the plugin operate on javac calls specified in build.xml, add refids for those calls, then use javacref to specify the refid(s) you want to operate on. This option gives you more control over project configuration than the monitor option provides. See Using refids below for more details.
|
1.
|
Modify your Parasoft Ant build script so that parasoft:monitor is called prior to compilation.
|
2.
|
In the Parasoft task definition in your Parasoft Ant build script, specify
monitorref="your.monitor" |
<target name="parasoft-init">
<parasoft:monitor id="my.monitor"/>
</target>
<target name="jtest" depends="parasoft-init,clean, compiler">
<echo>Running Jtest</echo>
<!== build main sources -->
<parasoft:jtest config="builtin://Static Analysis" overwrite="true">
<projectDescription monitorref="my.monitor" overwrite="true" /"
</parasoft:jtest>
1.
|
2.
|
In the Parasoft task definition in your Parasoft Ant build script, specify which refids you want the task to operate on:
|
•
|
To operate on specific javac calls, use javacref ="javacId" or javacref ="javacId, javacId2, javacId3, ..".
|
•
|
•
|
<javac target="${jdk.version.class}"
source="${jdk.version.source}"
...
id="main.javac"
...
.../>
<target name="parasoft-test" depends="build">
...
<!-- To use and configure Parasoft Test Plugin -->
<parasoft:jtest config="builtin://Static Analysis">
<!-- javacref refers to the ID of the specific javac in build.xml -->
<projectDescription basedir="." javacref="main.javac" overwrite="true"/>
</parasoft:jtest>
...
</target>
The parasoft:monitor task (described above in Using the Monitor) also executes the Parasoft Build Monitor, which analyzes your build and sends Parasoft Concerto data regarding build warnings, errors, and the number of files successfully compiled. This must be performed before compilation.
<?xml version="1.0"?>
<project name="Jtest Build" default="jtest" xmlns:parasoft="antlib:com.parasoft.antlib">
<import file="build.xml"/>
<property name="concerto" value="developers.parasoft.com"/>
<property name="projectName" value="Default Project"/>
<property name="config" value="builtin://Static Analysis"/>
<!-- Installs the parasoft monitor to track the build -->
<target name="parasoft-init">
<parasoft:monitor id="parasoft.monitor" concertoHost="${concerto}" concertoPort="8080" projectName="${projectName}"/>
</target>
<!-- Creates the localsettings file used by parasoft tools, can optionally retrieve settings from Concerto (4.5 or higher) -->
<target name="localsettings">
<parasoft:localsettings concertoHost="${concerto}" concertoPort="8080" projectName="${projectName}">
<additionalProperty key="scope.author" value="false"/>
<additionalProperty key="scope.local" value="true"/>
<additionalProperty key="report.mail.enabled" value="true"/>
</parasoft:localsettings>
</target>
<!-- runs Jtest by statically analyzing the build. id attributes must be added to javac targets. A separate project is setup for each javac -->
<target name="jtest-multiple-projects" depends="parasoft-init, clean, compile, localsettings">
<echo>Running Jtest Using Multiple Projects</echo>
<parasoft:jtest config="${config}">
<projectDescription javacref="main.javac" overwrite="true"/>
<projectDescription javacref="submodule.javac" overwrite="true"/>
</parasoft:jtest>
</target>
<!-- runs Jtest by statically analyzing the build. id attributes must be added to javac targets. A single project is setup which combines the referenced javac targets -->
<target name="jtest-single-project" depends="parasoft-init, clean, compile, localsettings">
<echo>Running Jtest Using Single Project</echo>
<parasoft:jtest config="${config}">
<projectDescription javacref="main.javac, submodule.javac" overwrite="true"/>
</parasoft:jtest>
</target>
<!-- runs Jtest by statically analyzing the build. Collects all javac targets from build file -->
<target name="jtest-single-project-all" depends="parasoft-init, clean, compile, localsettings">
<echo>Running Jtest Using With All javac targets</echo>
<parasoft:jtest config="${config}">
<projectDescription javacref="all" overwrite="true"/>
</parasoft:jtest>
</target>
<!-- runs Jtest by statically analyzing the build. Collects all javac references from build file -->
<target name="jtest-single-project-allrefs" depends="parasoft-init, clean, compile, localsettings">
<echo>Running Jtest Using With All javac targets that have references</echo>
<parasoft:jtest config="${config}">
<projectDescription javacref="allrefs" overwrite="true"/>
</parasoft:jtest>
</target>
<!-- runs Jtest by analyzing the build dynamically. The monitor will collect information during the build to setup and run Jtest -->
<target name="jtest-with-monitor" depends="parasoft-init, clean, compile, localsettings">
<echo>Running Jtest With Monitor</echo>
<parasoft:jtest config="${config}">
<projectDescription monitorref="parasoft.monitor" overwrite="true"/>
</parasoft:jtest>
</target>
</project>
<!-- Project definition and call to Parasoft Ant library -->
<project name="Parasoft Test Build" default="parasoft-test"
xmlns:parasoft="antlib:com.parasoft.antlib">
<!-- To import the original Ant build.xml file and specify the task to integrate to -->
<import file="build.xml"/>
<target name="parasoft-test" depends="build">
<!-- To run Jtest on the specified project directory in projectDescription, using the
configuration in config and Jtest in jtestHome -->
<parasoft:jtest config="builtin://Static Analysis" jtestHome="C:\Program
Files\Parasoft\Jtest\9.5">
<projectDescription basedir="."/>
</parasoft:jtest>
</target>
</project>
<!-- Project definition and call to Parasoft Ant library -->
<project name="Parasoft Test Build" default="parasoft-test"
xmlns:parasoft="antlib:com.parasoft.antlib">
<!-- To import the original Ant build.xml file and specify the task to integrate to -->
<import file="build.xml"/>
<target name="parasoft-test" depends="build">
<!-- To run Jtest on the specified project directory in projectDescription, using the
configuration in config and Jtest in jtestHome -->
<parasoft:jtest config="builtin://Static Analysis" jtestHome="C:\Program
Files\Parasoft\Jtest\9.5">
<projectDescription basedir="."/>
</parasoft:jtest>
</target>
</project>
<!-- Project definition and call to Parasoft Ant library -->
<project name="Parasoft Test Build" default="parasoft-test"
xmlns:parasoft="antlib:com.parasoft.antlib" basedir="../sources">
<target name="soatest-test">
<!-- To generate .project file needed to run SOAtest if it does not exist -->
<parasoft:eclipse/>
<!-- To run SOAtest with the selected configuration -->
<parasoft:soatest config="builtin://Run Web Functional Tests in Browser Specified by Test"
soatestHome="C:\Program Files\Parasoft\SOAtest\9.4"/>
</target>
</project>
•
|