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 – Only used if supportMultipleModesPerRun=False; specifies the single mode tests will be run with.
- threads – The number of worker threads to execute the requested testcases
- outsubdir – The name of the output subdirectory
- descriptors – List of
pysys.xml.descriptor.TestDescriptor
descriptors specifying the set of testcases to be run - xargs – The dictionary of additional “-X” user-defined arguments to be set as data attributes on 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
-
processCoverageData
(**kwargs)[source]¶ Called after execution of all tests has completed to allow processing of coverage data (if enabled), for example generating reports etc.
The default implementation collates Python coverage data from coverage.py and produces an HTML report. It assumes a project property pythonCoverageDir is set to the directory coverage files are collected into, and that PySys was run with -X pythonCoverage=true. If a property named pythonCoverageArgs exists then its value will be added to the arguments passed to the run and html report coverage commands.
Custom runner subclasses may replace or add to this by processing coverage data from other languages, e.g. Java.
-
testComplete
(testObj, dir)[source]¶ Test complete method which performs completion actions after a testcase has finished executing and its final outcome has been determined.
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 aPASSED
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 be called afterwards inside a try…finally block. Do not put logic which could change the test outcome in testComplete - useBaseTest.cleanup
instead.This method is always invoked from a single thread, even in multi-threaded mode.
Parameters: - testObj – Reference to the
pysys.basetest.BaseTest
instance of the test just completed - dir – The directory to perform the purge on
- testObj – Reference to the
-