Report Senders

Base

class libpermian.reportsenders.base.BaseReportSender(testplan, reporting_structure, caseRunConfigurations, event, settings, issueAnalyzerProxy, group=None)

Base class for case-run-configuration report sender.

The ReportSender classes are responsible for handling results according to the specification provided in the testplan in reporting structure.

The ReportSender has associated case-run-configurations and reacts on the execution progress which is represented by provided Result instances. Based on the content of reporting structure and settings, each class should deliver the desired reporting.

Parameters:
  • testplan (tplib.structures.testplan.TestPlan) – TestPlan instance for which the reporting should be done.

  • reporting_structure (tplib.structures.testplan.Reporting) – Test Plan reporting item containing data for this instance.

  • caseRunConfigurations (list[libpermian.testrun.CaseRunConfiguration]) – List of case-run-configurations for which the reports should be sent.

  • event (libpermian.events.base.Event) – Event based on which the reporting should be done. The ReportSender may use this to obtain more information useful for reporting.

  • settings (libpermian.settings.Settings) – Pipeline settings object

checkEmptyQueue()
Raises:

UnexpectedState – when the results queue is not empty.

Returns:

None

Return type:

None

descriptionOf(caseRunConfigurations)

Provide human readable description of results for provided caseRunConfigurations which will be used during reporting

Parameters:

caseRunConfigurations (iterable of CaseRunConfiguration) – List of caseRunConfiguration based on which the description should be formed.

Returns:

Human readable description of the results.

Return type:

str

description_format = 'Configuration: %s - Result: %s, %s - Beaker links: %s - Issues: %s ; '
property fallbackSettingsSections
flush()

This method is called instead of process{something} methods when reportSender throttling is enabled and should be used to submit results from self.caseRunConfigurations.withDirtyResult or full state of the testrun.

Returns:

Flush successful

Return type:

bool

issue_format = '%s'
issuesFor(crcList)

Provide issue set for the crcList to find out if the result needs additional review or if no review is necessary as all identified issues are already known.

Parameters:

crcList (iterable of CaseRunConfiguration) – CaseRunConfigurations to be inspected registered issue analyzers

Returns:

Issues found for provided crcList. Check isComplete property to find out if the set of issues is complete. If not, the CaseRunConfiguration results need to be reviewed.

Return type:

IssueSet

property nextFlush

Time remaining to next flush call. If throttling is not enabled, return None, otherwise always return positive number of seconds, in case the flush should have already happened, return 0. If next flush was not set yet, set it and return time remaning from now. Note that it’s only guaranteed that the return value will always be lower or equal than the throttle interval (or None if throttling is disabled).

Returns:

None if throttling is disabled, otherwise seconds to next flush event, 0 if the next flush event should have already happened.

Return type:

None or float

abstract processCaseRunFinished(testCaseID)

This method is called when all case-run-configurations of the TestCase associated with the TestRun (handled by this ResultsSender instance) have final result associated.

abstract processFinalResult(crc)

This method is called when a caseRunResult performs final change of state or result.

Example of use for this method: Send finished case-run-configuration notification or upload its result.

Parameters:

result (..testruns.Result) – Result object holding information about the new state.

abstract processPartialResult(crc)

This method is called when a caseRunResult updates it’s state or result.

Example of use for this method: Send in-progress notifications.

Parameters:

result (..testruns.Result) – Result object holding information about the new state.

processResult(crcUpdate)

This method is called in the loop processing results queue and signals if the result was the last one and reportsender should end.

Parameters:

result (libpermian.testrun.result.Result) – Result to be processed.

Returns:

True if the processed result is expected to be the last one. False otherwise.

Return type:

bool

abstract processTestRunFinished()

This method is called when TestRun (handled by this ResultsSerder instance) is finished (meaning that all worklows associated to the case-run-configurations are no longer running).

Examples of use for this method:

  • Mark TestRun in test case management system as finished if there are no manual (or aborted/canceled) case-run-configurations.

  • Send email with results summary.

abstract processTestRunStarted()

This method is called when TestRun (handled by this ResultsSender instance) is started.

Example of use for this method: create TestRun in test case management system.

resultOf(caseRunConfigurations)
resultUpdate(crc)

Notify ReportSender about new result. This method is meant to be used from outside of the ReportSender and should not contain processing of the result itself.

Default implementation just puts the relevant result to a queue which is later processed by the ReportSender in its thread.

Parameters:

result

Typer result:

libpermian.testrun.result.Result

Returns:

True if the result was relevant to the ReportSender instance. False otherwise.

Return type:

bool

run()

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

setNextFlush(flush_time=None)

Set time for next flush. :param flush_time: Set next flush time to the value directly provided instead of computing it from current time and throttle interval. :type flush_time: float (optional)

setUp()

Executed just before the ReportSender starts

tearDown()

Executed after the ReportSender has finished

Built-in

Factory