pysys.writer.outcomes

Writers that record test outcomes to a variety of file formats.

JSONResultsWriter

class pysys.writer.outcomes.JSONResultsWriter(logfile, **kwargs)[source]

Bases: pysys.writer.api.BaseRecordResultsWriter

Writer to log a summary of the test results to a single JSON file, along with runDetails from the runner.

The following fields are always included for each test result:

  • testId: the test id, including ~mode suffix if it has modes defined.

  • outcome: the outcome string e.g. “NOT VERIFIED”.

  • outcomeReason: the string explaining the reason for the outcome, or empty if not available.

  • startTime: the time the test started, in %Y-%m-%d %H:%M:%S format and in the local timezone.

  • durationSecs: how long the test executed for (or None/null if unknown).

  • testDir: the path to this test under the testRootDir, using forward slashes.

  • testFile: the path (typically relative to testDir, using forward slashes) of the main file containing the test’s logic, e.g. pysystest.py, run.py etc. This is usually, but not always, a Python file.

If applicable, some tests/runs may have additional fields such as cycle, title and outputDir.

New in version 2.1.

includeTitle = True

By default the title of each test is included in the output.

To save disk space you can set this to False if it is not needed.

includeNonFailureOutcomes = '*'

In addition to failure outcomes, any outcomes listed here (as comma-separated display names, e.g. "NOT VERIFIED, INSPECT") will be included. To include all non-failure outcomes, set this to the special value "*".

To save disk space and record only failure outcomes, you may set this to an empty string.

outputDir = None

The directory to write the logfile, if an absolute path is not specified. The default is the working directory.

Project ${...} properties can be used in the path.

createTestResultDict(testObj, **kwargs)[source]

Creates the dict that will be output for each test result.

Returns

The dict, or None if this result should not be included/

TextResultsWriter

class pysys.writer.outcomes.TextResultsWriter(logfile, **kwargs)[source]

Bases: pysys.writer.api.BaseRecordResultsWriter

Writer to log a summary of the results to a logfile in .txt format.

outputDir = None

The directory to write the logfile, if an absolute path is not specified. The default is the working directory.

Project ${...} properties can be used in the path.

XMLResultsWriter

class pysys.writer.outcomes.XMLResultsWriter(logfile, **kwargs)[source]

Bases: pysys.writer.api.BaseRecordResultsWriter

Writer to log results to logfile in a single XML file.

The class creates a DOM document to represent the test output results and writes the DOM to the logfile using toprettyxml(). The outputDir, stylesheet, useFileURL attributes of the class can be overridden in the PySys project file using the nested <property> tag on the <writer> tag.

Variables
  • ~.outputDir (str) – Path to output directory to write the test summary files

  • ~.stylesheet (str) – Path to the XSL stylesheet

  • ~.useFileURL (str) – Indicates if full file URLs are to be used for local resource references

JUnitXMLResultsWriter

class pysys.writer.outcomes.JUnitXMLResultsWriter(**kwargs)[source]

Bases: pysys.writer.api.BaseRecordResultsWriter

Writer to log test results in the widely-used Apache Ant JUnit XML format (one output file per test per cycle).

If you need to integrate with any CI provider that doesn’t have built-in support (e.g. Jenkins) this standard output format will usually be the easiest way to do it.

The output directory is published as with category name “JUnitXMLResultsDir”.

outputDir = None

The directory to write the XML files to, as an absolute path, or relative to the testRootDir.

Project ${...} properties can be used in the path.

CSVResultsWriter

class pysys.writer.outcomes.CSVResultsWriter(logfile, **kwargs)[source]

Bases: pysys.writer.api.BaseRecordResultsWriter

Writer to log results to logfile in CSV format.

Writing of the test summary file defaults to the working directory. This can be be over-ridden in the PySys project file using the nested <property> tag on the <writer> tag. The CSV column output is in the form:

id, title, cycle, startTime, duration, outcome