apama.runner module

Contains PySys custom runner that adds support for EPL code coverage reporting.

class apama.runner.ApamaRunner(record, purge, cycle, mode, threads, outsubdir, descriptors, xargs)[source]

Bases: pysys.baserunner.BaseRunner

A custom PySys runner for Apama tests.

Supports the ability to generate EPL code coverage reports. Coverage settings can be configured by setting the following attributes on this class: eplcoverageargs, eplcoveragesource, eplcoverageinclude, eplcoverageexclude, eplcoveragetitle.

__init__(record, purge, cycle, mode, threads, outsubdir, descriptors, xargs)[source]

Create an instance of the BaseRunner class.

Parameters:
  • record – Indicates if the test results should be recorded
  • purge – Indicates if the output subdirectory should be purged on PASSED result
  • cycle – The number of times to execute the set of requested testcases
  • mode – The user defined mode to run the testcases in
  • threads – The number of worker threads to execute the requested testcases
  • outsubdir – The name of the output subdirectory
  • descriptors – List of XML descriptor containers detailing the set of testcases to be run
  • xargs – The dictionary of additional arguments to be set as data attributes to the class
isPurgableFile(path)[source]

Determine if a file should be purged when empty at the end of a test run.

This method is called by testComplete to provide runners with the ability to veto deletion of non-empty files that should always be left in a test’s output directory even when the test has passed, by returning False from this method. For example this could be used to avoid deleting code coverage files. By default this will return True.

Parameters:path – The absolute path of the file to be purged
purgeDirectory(dir, delTop=False)[source]

Recursively purge a directory removing all files and sub-directories.

Parameters:
  • dir – The top level directory to be purged
  • delTop – Indicates if the top level directory should also be deleted
testComplete(testObj, dir)[source]

Test complete method which performs completion actions after execution of a testcase.

The testComplete method performs purging of the output subdirectory of a testcase on completion of the test execution. Purging involves removing all files with a zero file length in order to only include files with content of interest. Should self.purge be set, the purging will remove all files (excluding the run.log) on a PASSED outcome of the testcase in order to reduce the on-disk memory footprint when running a large number of tests. Should a custom testComplete for a subclass be required, the BaseRunner testComplete method should first be called.

Parameters:
  • testObj – Reference to the pysys.basetest.BaseTest instance of the test just completed
  • dir – The directory to perform the purge on