scenario.campaignreport module¶
Campaign reports.
- CAMPAIGN_REPORT¶
Main instance of
CampaignReport
.
- class CampaignReport¶
Bases:
Logger
Campaign report management.
JUnit XML reporting file format:
Refer to: https://llg.cubic.org/docs/junit/ [CUBIC]
Other useful resource: https://stackoverflow.com/questions/442556/spec-for-junit-xml-output
- __init__()¶
Configures logging for the
CampaignReport
class.
- _junit_path¶
JUnit report path being written or read.
- writejunitreport(campaign_execution, junit_path)¶
Generates a JUnit XML report output file.
- Parameters:
campaign_execution – Campaign execution to generate the report for.
junit_path – Path to write the JUnit report into.
- Returns:
True
for success,False
otherwise.
- readjunitreport(junit_path)¶
Reads the JUnit report.
- Parameters:
junit_path – Path of the JUnit file to read.
- Returns:
Campaign execution data read from the JUnit file.
None
when the file could not be read, or its content could not be parsed successfully.
- _campaign2xml(xml_doc, campaign_execution)¶
Campaign JUnit XML generation.
- Parameters:
xml_doc – XML document.
campaign_execution – Campaign execution to generate the JUnit XML for.
- Returns:
Campaign JUnit XML.
- _xml2campaign(xml_doc)¶
Campaign execution reading from JUnit report.
- Parameters:
xml_doc – JUnit XML document to read from.
- Returns:
Campaign execution data.
- _testsuite2xml(xml_doc, test_suite_execution, test_suite_id)¶
Test suite JUnit XML generation.
- Parameters:
xml_doc – XML document.
test_suite_execution – Test suite execution to generate the JUnit XML for.
test_suite_id – Test suite identifier.
- Returns:
Test suite JUnit XML.
- _xml2testsuite(campaign_execution, xml_test_suite)¶
Test suite reading from JUnit report.
- Parameters:
campaign_execution – Owner campaign execution instance.
xml_test_suite – JUnit XML to read from.
- Returns:
Test suite execution data.
- _testcase2xml(xml_doc, test_case_execution)¶
Test case JUnit XML generation.
- Parameters:
xml_doc – XML document.
test_case_execution – Test case execution to generate the JUnit XML for.
- Returns:
Test case JUnit XML.
- _xml2testcase(test_suite_execution, xml_test_case)¶
Test case reading from JUnit XML.
- Parameters:
test_suite_execution – Owner test suite execution instance.
xml_test_case – JUnit XML to read from.
- Returns:
Test case execution data.
- _safestr2xml(string)¶
Safe string conversion before it is used in the JUnit report.
Removal of colors.
- Parameters:
string – String to convert.
- Returns:
String safely converted.
- _path2xmlattr(xml_node, attr_name, path)¶
Sets a path XML attribute.
Sets either a relative or absolute path depending on the given file location compared with this JUnit file location.
- Parameters:
xml_node – XML node to set the attribute for.
attr_name – Attribute name.
path – Path object to use to set the attribute value.
- _xmlattr2path(xml_node, attr_name)¶
Path computation from an XML attribute.
When the attribute describes a relative path, the path is computed from the JUnit file. When it describes an absolute path, the path is taken as is.
- Parameters:
xml_node – XML node which attribute to read from.
attr_name – Attribute name to read.
- Returns:
Path computed.
- _xmlcheckstats(xml_node, attr_name, objects)¶
Statistics consistency checking between an upper level and its children.
- Parameters:
xml_node – Upper XML node which statistics to check.
attr_name – Statistics attribute to check.
objects – Execution objects to check statistics with.
Displays warnings when the statistics mismatch.