PesterCat Ant Automation Tutorial

This tutorial will guide you through setting up the PesterCat Ant Toolkit to automatically run scripts and upload scripts results to a PesterCat DataBox installation. The PesterCat Ant Toolkit provides Ant tasks to play scripts, generate reports, and upload results to PesterCat DataBox.

  1. Download and Install Apache Ant
  2. Download and Install the PesterCat Ant Toolkit
  3. Run the PesterCat Ant demo script
  4. Install PesterCat DataBox
  5. Commit (upload) results to PesterCat DataBox
  6. View results in PesterCat DataBox

Download and Install Apache Ant

Apache Ant is a Java build tool that can be obtained online at: http://ant.apache.org. Apache Ant requires a suitable Java Development Kit (JDK) to be preinstalled on your system. Once you have a JDK, installing Ant is simply a matter of extracting the downloaded .zip or .tar.gz file and adding the 'bin' directory to your PATH.

On Windows:

  1. Double click the Ant zip file (called apache-ant-<version>.zip).
  2. Click 'File' --> 'Extract All' and follow the Extraction Wizard to extract Apache Ant to a directory on your system. In this tutorial we will extract to C:\.
  3. Add the Ant 'bin' directory to your system path. On Windows you can do this by right clicking on 'My Computer' --> Selecting the 'Advanced' tab --> 'Clicking the 'Environment Variables' button --> Adding a new 'User variable'. Set variable name to 'PATH' and the variable value to '%PATH%;C:\apache-ant-1.7.1\bin'. NOTE: Substitute the correct ant directory if you have a version older or more recent than 1.7.1.

Install the PesterCat Ant Toolkit

On Windows:

  1. Double click the Ant zip file (called apache-ant-<version>.zip).
  2. Click 'File' --> 'Extract All' and follow the Extraction Wizard to extract Apache Ant to a directory on your system. In this tutorial we will extract to C:\.

Run the PesterCat Ant demo script

On Windows:

  1. Open up a DOS prompt. Click 'Start' --> 'Run' --> Type 'cmd' and click enter.
  2. Change directory to the PesterCat-Ant by typing 'cd C:\PesterCat-Ant\'
  3. Run the PesterCat Ant Tutorial script by typing 'ant -f playback.xml'.
  4. The script will now play back the included tutorial.xml PesterCat script.

By default the PesterCat Ant playback.xml build files generates a static HTML report. You can view this report by opening the C:\PesterCat-Ant\out-report\index.html file with a web browser. In the next several sections we will explain how to upload the PesterCat results XML files to PesterCat DataBox which provides enhanced searching, reports, and notifications.

Install PesterCat DataBox

Follow the PesterCat DataBox installation instructions located here. Complete the installation and then follow the steps below to verify the application is working correctly.

  1. Open a web browser go to the following URL for your PesterCat DataBox machine name: http://localhost:8080/. (replace 'localhost' with a remote machine name if you installed PesterCat DataBox on a separate machine)
  2. Sign in to PesterCat DataBox with username 'admin' and password 'pestercat'. You should see the PesterCat DataBox results screen.

Commit (upload) results to PesterCat DataBox

CommitTask is an Ant Task in the Ant the PesterCat Ant Toolkit that can be used to upload script results to PesterCat DataBox. The sequence of events is usually as follows:

  1. Run a set of scripts via Ant using PlaybackTask. An output directory containing XML output files is generated.
  2. XML output can uploaded to PesterCat DataBox using CommitTask.
*Typically when uploading data to PesterCat DataBox there is no need to generate static HTML reports with ReportTask. The playback.xml file included in the PesterCat Ant Toolkit is configured to run ReportTask by default.

By default the playback.xml Ant script included in the PesterCat Ant Toolkit has the CommitTask section commented out. To uncomment the CommitTask section Open the C:\PesterCat-Ant\playback.xml file with a text editor. Right click on C:\PesterCat-Ant\playback.xml and select 'Open With' --> 'Wordpad'.

Uncomment the 'commit' task at the bottom of the script. Remove the '<!--' and '-->' XML comment delimters around the block. When you are finished the commit step should look like this:

	<commit name="tutorial" url="http://localhost:8080/" username="admin" password="pestercat" tag="1.0">
		<fileset dir="${basedir}/out">
			<include name="**/*.xml"/>
		</fileset>
	</commit>

Save the playback.xml file and exit out of Wordpad. Run the playback.xml file with Ant. On Windows:

  1. Open up a DOS prompt. Click 'Start' --> 'Run' --> Type 'cmd' and click enter.
  2. Change directory to the PesterCat-Ant by typing 'cd C:\PesterCat-Ant\'
  3. Run the PesterCat Ant Tutorial script by typing 'ant -f playback.xml'.
  4. The script will now play back the included tutorial.xml PesterCat script.

View results in PesterCat DataBox

Open a web browser and sign into PesterCat DataBox. You should see results for the tutorial.xml script that was just executed via Ant. Click the view link to view the playback report. From the playback report you can click individual scripts to view individual script results.

Results can be categorized using the 'name' and 'tag' fields supported by CommitTask. See the 'CommitTask' help page in PesterCat detailed CommitTask configuration options.