In this section:
Setting Environment Variables
Setting environment variables for the components used in this tutorial is not required, but doing so may improve clarity.
DTP_HOME = DTP Server installation directory. Used for reference.
JTEST_HOME = Jtest installation directory.
WORKING_DIR = Base directory for this tutorial.
MONITOR_DIR = Location for CAM agent monitor files.
PROJECT_DIR = Location of the Calculator project.
REPORT_DIR = Directory for test results.
TOMCAT_DIR = Tomcat used for CAM, installation directory.
JAVA_HOME = Java JDK installation directory.
M2_HOME = Maven installation directory.
CYGWIN_HOME = Cygwin installation directory. Cygwin is used only for cURL only in this tutorial.
Setting Up the Environment
Configure an envSetup.bat batch file in the working directory (C:\Working\CAM\) with the following contents:
@echo off REM Set environment variables set DTP_HOME=C:\Parasoft\ParasoftTest\DTP set JTEST_HOME=C:\Parasoft\ParasoftTest\jtest\10.2.3_64 set WORKING_DIR=C:\Working\CAM set MONITOR_DIR=%WORKING_DIR%\monitor set PROJ_DIR=%WORKING_DIR%\calculator set REPORT_DIR=%PROJ_DIR%\Reports set TOMCAT_DIR=%WORKING_DIR%\tomcat set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_101 set M2_HOME=C:\maven set CYGWIN_HOME=C:\Cygwin6449 REM Configure Path set PATH=%PATH%;%JTEST_HOME% set PATH=%PATH%;%M2_HOME%\bin set PATH=%PATH%;%CYGWIN_HOME%\bin
This batch file should be executed after opening any command window used in this tutorial. Alternatively, these could be setup in your System Variables.
Setting Up DTP
Open the DTP homepage in a browser and log into Report Center. The default URL on a local machine is http://localhost:80. The default username and password is admin/admin. This should be changed before deploying DTP for general usage. The default user in this tutorial must have the ability to create and configure DTP Projects. Additional steps for setting up DTP are covered in Preparing DTP for Application Coverage.
Setting Up the Working Directory
- Create a working directory for the example project and associated files: C:\Working\CAM
- Copy the Calculator example project folder from %JTEST_HOME%\Examples to C:\Working\CAM. The project is copied to maintain the integrity of the original project in the distribution.
Setting Up Jtest
- Open a command window and run the C:\Working\CAM\envSetup.bat script.
- Change to the %WORKING_DIR%\calculator folder.
- Run the following command:
jtestcli -list-configs
- This will output a list of test configurations available for Jtest to run.
- If you do not get this list or if you get errors related to licensing, check the settings in the %JTEST_HOME%\jtestcli.properties configuration file. In most cases at minimum, you need the following settings configured:
jtest.license.use_network=true jtest.license.network.type=dtp jtest.license.network.edition=server_edition dtp.server=localhost dtp.port=8443 dtp.user=admin dtp.password=admin
Downloading the cam.war File
The CAM package will be available soon at http://marketplace.parasoft.com. Until then, contact your Parasoft representative for cam.war download information.
Setting Up the Tomcat Server
CAM currently requires a custom configured Tomcat server with environment setup for CAM and the tested applications.
- Verify that Tomcat is installed at %TOMCAT_DIR% (see CAM Tutorial Requirements).
- By default, Tomcat is configured to use the following ports:
- 8080
- 8009
- 8005
- 8443
- Open a web browser to http://localhost:8080 or use other means to verify that these ports are available.
- If the default ports are not available, modify the %TOMCAT_DIR%\conf\server.xml configuration file to make the following replacements in order to use ports that are available:
- 8080 => 7080
- 8009 => 7009
- 8005 => 7005
- 8443 => 7443
- Perform a global replacement in the file for each and save the changes.
- Open a command window and run C:\Working\CAM\envSetup.bat.
- Run the
catalina start
command to start the Tomcat server. - Open the following URL in a web browser to verify that the server runs properly:
http://localhost:7080
You should see the Tomcat homepage. - Close the browser and run the
catalina stop
command to stop the server.
Setting Up Maven
See the Jtest Maven Plugin documentation for full details.
- If you have been using Maven, then a settings.xml file should already exist in the C:\Users\<YOUR_LOGIN>\.m2\ directory. If this file does not exist, copy the settings.xml file to this directory from the %MAVEN_HOME%\conf\ directory.
- Edit the settings.xml file as follows:
Add the following plugin group to the
<pluginGroups>
element.<pluginGroup>com.parasoft.jtest</pluginGroup>
Add the following profile to the
<profiles>
element:<profile> <id>jtest-settings-profile</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <jtest.home> C:/Parasoft/ParasoftTest/jtest/10.2.3_64</jtest.home> </properties> <pluginRepositories> <pluginRepository> <id>jtest-local</id> <url>file://${jtest.home}/integration/maven</url> </pluginRepository> </pluginRepositories> </profile>
Add the following mirror to the
<mirrors>
element:<mirror> <id>jtest-local-mirror</id> <mirrorOf>jtest-local</mirrorOf> <url>file://<your_jtest_directory>/integration/maven</url> </mirror>
- Save your changes.