Skip to end of metadata
Go to start of metadata

Description:

Small Perl script to connect to a Test Swarm, log in and parse results of a task. Based on the results, the script will fail or succeed.

The program will continue to check the test swarm results until the stop criteria has been reached (see below). It will return a success return code (0) if the success criteria is fulfilled (see below).

Success Criteria
The script will check and report all the results on the page, but the success criteria is based only on the supported environments.

Icon

The script is considered successful if:

  • All the tests for the supported environments succeeded.

The script is considered failed if:

  • Any of the tests of the supported environments have not run
  • Any of the tests of the supported environments have either failed or errored (eg. due to the tests timing out)

Stop Criteria

The script will continue to check the test swarm results until:

Icon

No tasks are in progress AND the are no un-run tests in the supported environments
OR
The upper time limit has been reached.

Parameters and usage

The program requires perl to be installed, as well as the LWP::UserAgent module.

Usage:
perl checkTestSwarm.pl --user=USERNAME --pass=PASSWORD [OPTIONALS]

If given no parameters optional parameters are given, the script will check the latest task and its latest revision

Mandatory arguments:

argument

explanation

--user=USER

Use the username USER to log in to test swarm

--pass=PASSWORD

Use the password PASSWORD when logging in to the test swarm

Optional arguments:

argument

explanation

--taskname=NAME

Look for the task matching NAME. Note that NAME is allowed to be a regexp expression. Default value is '\w+' meaning the first available task will be matched.

--revision=NUM

Check results for the revision NUM. Note that NUM is allowed to be a regexp. Default value is '\d+' meaning the top most (latest) revision will be matched.

--waitstart=NUM

Wait NUM seconds before starting to check the test results. This is used to allow testswarm a chance to do the tests. The default value is 600 seconds (10 minutes).

--timeout=NUM

Time out limit for the script. If the script has run for NUM seconds without meeting a stop criteria it forces the parsing and reporting of the tests, even if some are unrun or in progress. The initial wait (--waitstart) is included in this time. The default value is 36000 seconds.

--frequency=NUM

The frequency of which the script checks the results. If the stop criteria wasn't meet on the first check, the script will wait for NUM seconds, before checking again. The default value is 300 seconds.

Settings used by CollectionSpace/Example
CollectionSpace runs the program via a Bamboo server, using the following arguments:

perl checkTestSwarm.pl --user=collectionspace --pass=<HIDDEN> --taskname='CollectionSpace UI' --timeout=3600 --frequency=300 --waitstart=600

Which means: Log in with the given username and password, look at the tasks matching "CollectionSpace UI", wait 10 minutes before starting to check the results, and then check with a frequency of 5 minutes. If all tests for supported environments haven't completed within 1 hour from execution, force the parsing and reporting of the results.

  • No labels