pyats.aereport.testscript package

testscript – TestScript Class

This module TestScript Class and related elements.

class pyats.aereport.testscript.TestScript(logfilepath, logging)

Bases: pyats.aereport.toplevel.aereportelement.AEReportElement

One or more test scripts that are invoked by the job file

Class based on the following schema definition

<xs:element name="testscript" minOccurs="0" maxOccurs="unbounded">
    <xs:annotation>
        <xs:documentation>One or more test scripts that are
            invoked by the job file</xs:documentation>
    </xs:annotation>
    <xs:complexType>
        <xs:complexContent>
            <xs:extension base="TestScriptType">
                <xs:sequence>
                    <xs:element name="pretestHandler" type="InfraHandlerSectionType"
                        minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element name="starttime" type="xs:dateTime"></xs:element>
                    <xs:element name="initinfo"></xs:element>
                    <xs:element name="runinfo" type="runinfoType" />
                    <xs:element name="commonSetup" type="TestSectionType"
                        minOccurs="0"></xs:element>
                    <xs:element name="commonVerify" type="TestSectionType"
                        minOccurs="0"></xs:element>
                    <xs:element name="testcase" type="TestResultType"
                        minOccurs="0" maxOccurs="unbounded"></xs:element>
                    <xs:element name="commonCleanup" type="TestSectionType"
                        minOccurs="0"></xs:element>
                    <xs:element name="stoptime" type="xs:dateTime"></xs:element>
                    <xs:element name="runtime"></xs:element>
                    <xs:element name="summary" type="summaryType" />
                    <xs:element name="posttestHandler" type="InfraHandlerSectionType"
                        minOccurs="0" maxOccurs="unbounded"></xs:element>
                    <xs:element name="cleanonerror" type="cleanType"
                        minOccurs="0"></xs:element>
                    <xs:element name="pause" minOccurs="0"></xs:element>
                    <xs:element name="abort" minOccurs="0"></xs:element>
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
</xs:element>
tag

Constant value = ‘testscript’ to be used as xml tag.

Type

str

pretesthandlers

Optional - list of InfraHandlerSection

Type

list

starttime

Initalized by aetest::script_init API

Type

datetime

initinfo
Type

TestScriptInitInfo

runinfo
Type

RunInfo

commonSetup

Optional - This is the section to configure the devices which is common for all the testcases in the script and is enclosed within aetest::common_setup API. All logs go into test script log file

Type

TestSection

commonVerify

Optional - This section is for verification invoked via aetest::common_verify API. All logs go into test script log file

Type

TestSection

testcases

Optional - list of TestResultType

Type

list

commonCleanup

Optional - This section is invoked via aetest::common_cleanup API and ensures that the steps occuring in common setup and verify are unconfigured here. All logs go into test script log file.

Type

TestSection

commonModify

Optional - This section is invoked via aetest::common_modify API

Type

TestSection

stoptime

Initalized by aetest::end API?

Type

datetime

runtime
Type

timedelta

summary
Type

Summary

posttestHandler

Optional - list of InfraHandlerSection. Autoeasy post test handler

Type

list

cleanonerror

Optional - clean routine on error condition

Type

Clean

pause

Optional - Invoked at the end of the testscript

Type

Pause

abort

Optional

Type

TestScriptAbort

add_testcase(**kwargs)

Create a testcase (TestResult) and append it to the testcases list.

Parameters
  • tcid (str) – The id of the testcase to be created. This is set once and never overwritten

  • variance (str) – Optional - Variance id is the same as TIMS config id. There cannot be a variance id at testcase level if it contains subtests. In such case the variance id will be part of subtest.

  • name (str) – Name of the testcase/subtest which is equivalent of the Title attribute in TIMS

  • xref (dict) – xRef

  • id (dict) – id of the testcase

add_testsection(**kwargs)

Create a testsection (TestSection) and append it to the sections list.

Parameters
  • sectionid (str) – The id of the section to be created. This is set once and never overwritten

  • logfilepath (str) – Path to the log file for the testcase

  • name (str) – Name of the testsection

Returns

Return the section if common<..> else return None

Return type

str or None

get_infrahandler(tag, name)

Searches within infrahandlers lists whether an infrahandler of a given name already exists. It uses the tag to determine which list to search e.g. pretesthandlers list, etc.

Parameters
  • tag (str) – Used to determine which list to search. Possible values are: pretestHandler and posttestHandler

  • name (str) – The name of the handler to be found

Returns

ret – InfraHandler if found; otherwise None

Return type

InfraHandlerSection

get_logging_mode()

Return the logging mode

Returns

Logging mode

Return type

str

get_subtest(subtcid)

Verify if a subtest exists, if so return it, else return None

Parameters

subtcid (str) – The id of the subtest to be found.

Returns

If testcase exists, return the testcase. Else None.

Return type

str or None

get_testcase(tcid)

Verify if a testcase exists, if so return it, else return None

Parameters

tcid (str) – The id of the testcase to be found

Returns

If testcase exists, return the testcase. Else None.

Return type

str or None

get_testsection(id)

Return the testsection

Returns

If common<…> return section string, else return None

Return type

str or None

is_last_testcase_closed()

Return if the last testcase is closed

Returns

Return 1 if last testcase was closed, else False

Return type

Bool

is_last_testsection_closed()

Return if the last testsection is closed

Returns

Return 1 if last testsection was closed, else False

Return type

Bool

set_args(**kwargs)

Set testscript set_args

Parameters
  • Initinfo (#) –

  • script (dict) – CLI paramerters passed to test script

  • pargs (str) – CLI paramerters passed to test script

  • taskid (str) – TaskId is set for easypy runs only; for stand-alone mode, it would be null. This value is internally set by aetest::script_init API

  • description (str) – Description for the testscript

  • logfile (dict) – File in which the test script logs are saved

  • swversion (str) – software version

  • hwversion (str) – hardware version

  • tstversion (str) – testscript version

  • aehandlers (str) – aetest testcase or section handlers

  • initinfo (dict) – Initinfo

  • runinfo (dict) – runinfo

Note

Clean is not supported by aetest, hence not supported by aereport. However, the clean API is working, and can be easily enhanced to support clean in testscript. It is working right now for testsuite.

start_logfile(filepath)

Sets the logfile path, and if logging is set to SingleFile, it calculates the size of the logfile at that moment, and uses the value for ‘begin’ attribute of logfile

Parameters

filepath (str) – Path to the log file to be used

Submodules

basetestresult – BaseTestResult Class

This module implements BaseTestResult class. It is the base for testcases and subtests.

class pyats.aereport.testscript.basetestresult.BaseTestResult

Bases: pyats.aereport.toplevel.aereportelement.AEReportElement

XML results for each test result containing setup, test and cleanup sections

Class based on the following schema definition

<xs:sequence>
    <xs:element name="starttime" type="xs:dateTime" />
    <xs:element name="initinfo" type="initInfoType" />
    <xs:element name="runinfo" type="runinfoType" />
    <xs:element name="setup" type="TestSectionType" minOccurs="0" />
    <xs:element name="test" type="TestSectionType" minOccurs="0" />
    <xs:element name="section" type="TestSectionType" minOccurs="0"
        maxOccurs="unbounded" />
    <xs:element name="cleanup" type="TestSectionType" minOccurs="0" />
    <xs:element ref="result"></xs:element>
    <xs:element name="testresultHandler" type="InfraHandlerSectionType"
        minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="stoptime" type="xs:dateTime" />
    <xs:element name="runtime"></xs:element>
    <xs:element name="aehandler" minOccurs="0" maxOccurs="unbounded"></xs:element>
    <xs:element name="pause" minOccurs="0"></xs:element>
</xs:sequence>
starttime

starttime

Type

datetime

initinfo

initinfo

Type

InitInfo

runinfo

runinfo

Type

RunInfo

setup

setup

Type

TestSection

test

test

Type

TestSection

sections

sections - list of TestSection

Type

list

cleanup

cleanup

Type

TestSection

result

Rollup result is based on individual setup/test, customtest and cleanup sections within the subtest

Type

Result

testresulthandlers

testresulthandlers - list of InfraHandlerSection

Type

list

stoptime

stoptime

Type

datetime

runtime

Runtime, stoptime - starttime

Type

timedelta

aehandlers

aehandlers - list of AEHandlers

Type

list

pause

pause

Type

Pause

timsextra

Optional - A dictionary to hold key value pairs of extra tims attributes

Type

dict

add_testsection(**kwargs)

Create a testsection (TestSection) and append it to the sections list.

Parameters
  • sectionid (str) – The id of the section to be created. This is set once and never overwritten

  • logfilepath (str) – Path to the log file for the testcase

  • name (str) – Name of the testsection

get_infrahandler(tag, name)

Searches within infrahandlers lists whether an infrahandler of a given name already exists. It uses the tag to determine which list to search (So far there is only one infrahandlers list in basetestresult which is testresulthandlers.

Parameters
  • tag (str) – Used to determine which list to search. Possible values are: testresultHandlers

  • name (str) – The name of the handler to be found

Returns

ret – InfraHandler if found; otherwise None

Return type

InfraHandlerSection

get_testsection(id)

Return the testsection

Returns

If common<…> return section string, else return None

Return type

str or None

is_last_testsection_closed()

Return if the last testsection is closed

Returns

Return 1 if last testsection was closed, else False

Return type

Bool

set_args(**kwargs)

set basetestresult testscript set_args

Parameters
  • name (str) – initinfo/name

  • description (str) – initinfo/description

  • pargs (str) – initinfo/pargs

  • swversion (str) – initinfo/swversion

  • hwversion (str) – initinfo/hwversion

  • fwversion (str) – initinfo/fwversion

  • tstversion (str) – initinfo/tstversion

  • platform (str) – initinfo/platform

  • interface (str) – initinfo/interface

  • id (dict) – id

  • uut (str) – uut

  • xref (dict) – xref

  • logfile (dict) – logfile

  • comment (str or int) – Comment for the run

  • diag (str) – Diag for the run

  • error (str) – Error for the run

  • userdef (str) – User defined tag

  • pause (str) – pause

  • unpause (str) – Unpause

  • result (str) – Result

  • scriptname (str) – name of the script

set_timsextra(**kwargs)

Sets tims custom attributes for a testscase or a subtest.

start_logfile(filepath)

Sets the logfile path, and if logging is set to SingleFile, it calculates the size of the logfile at that moment, and uses the value for ‘begin’ attribute of logfile

Parameters

filepath (str) – Path to the log file to be used

stop_logfile()

If logging is set to SingleFile, it calculates the size of the logfile at that moment, subtracts it from the initial size (value for ‘begin’ attribute) and updates the ‘size’ attribute.

commonsubsection – CommonSubSection Class

This module contains the CommonSubSection class.

class pyats.aereport.testscript.commonsubsection.CommonSubSection(tag='subSection')

Bases: pyats.aereport.toplevel.aereportelement.AEReportElement

Common Subsections are subsections of a TestSection that should only exist in commonsetup and commoncleanup sections

Class based on the following schema definition

<xs:complexType name="CommonSubSectionType">
    <xs:sequence>
        <xs:element name="starttime" type="xs:dateTime"></xs:element>
        <xs:element name="xref" type="xrefType" />
        <xs:element name="id"></xs:element>
        <xs:element name="name"></xs:element>
        <xs:element name="description" type="xs:string"></xs:element>
        <xs:element name="logfile" type="LogFileType"/>
        <xs:element name="runinfo" type="runinfoType" />
        <xs:element ref="result" />
        <xs:element name="stoptime" type="xs:dateTime" />
        <xs:element name="runtime"></xs:element>
    </xs:sequence>
</xs:complexType>
tag

Default value = ‘subSection’

Type

str

starttime

testcase start time, internally set by aetst

Type

datetime

xref
Type

XRef

id

Various ids related to subsesction in common setup/cleanup

Type

Id

name

Name of the subsesction in common setup/cleanup

Type

str

description

Description for the testcase or subtest

Type

str

logfile
Type

LogFile

runinfo
Type

RunInfo

result
Type

Result

stoptime
Type

datetime

runtime
Type

timedelta

extra

that wont be printed in the xml

module

Type

Dictionary contains extra information

add_teststep(**kwargs)
get_teststep(tsid)

Verify if a step exists, if so return it, else return None

Parameters

tcid (str) – The id of the step to be found

Returns

If step exists, return it. Else None.

Return type

str or None

property module
property path
set_args(**kwargs)

set basetestresult testscript set_args

Parameters
  • name (str) – initinfo/name

  • description (str) – initinfo/description

  • id (dict) – id

  • xref (dict) – xref

  • logfile (dict) – logfile

  • comment (str or int) – Comment for the run

  • diag (str) – Diag for the run

  • error (str) – Error for the run

  • userdef (str) – User defined tag

  • pause (str) – pause

  • unpause (str) – Unpause

valid_parents = ['commonSetup', 'commonModify', 'commonVerify', 'commonCleanup']

result – Result

This module implement Result section used by TestResult, TestGroup, and TestSection.

class pyats.aereport.testscript.result.Result

Bases: pyats.aereport.toplevel.aereportelement.AEReportElement

Result element for storing test result with values limited to pass, passx, fail, abort, skip, block

Class based on the following schema definition

<xs:element name="result">
    <xs:complexType>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="mode"></xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
</xs:element>
tag

Default value = ‘result’.

Type

str

attrs

Default value is None. This is to ensure that all elements contain an attrs dictionary. attrs is expanded as attributes in the xml start tag. Indicates how result was determined: Auto = result set by ATS; override = result set by user.

Type

dict

generate_dom(parent)

Override the default behavior of AEReportElement.generate_dom

Parameters

parent (AEReportElement) – The xml element that should be used as a parent for this userdef

set_args(**kwargs)

Set InitInfo attributes

Parameters
  • mode (str) – Mode of the result

  • value (str) – Value of the result

subtestresult – SubTestResult Class

This module implements SubTestResult class

class pyats.aereport.testscript.subtestresult.SubTestResult(subtcid)

Bases: pyats.aereport.testscript.basetestresult.BaseTestResult

XML results for each test result containing setup, test and cleanup sections

Class based on the following schema definition

<xs:sequence>
    <xs:element name="starttime" type="xs:dateTime" />
    <xs:element name="initinfo" type="initInfoType" />
    <xs:element name="runinfo" type="runinfoType" />
    <xs:element name="setup" type="TestSectionType" minOccurs="0" />
    <xs:element name="test" type="TestSectionType" minOccurs="0" />
    <xs:element name="section" type="TestSectionType" minOccurs="0"
        maxOccurs="unbounded" />
    <xs:element name="cleanup" type="TestSectionType" minOccurs="0" />
    <xs:element ref="result"></xs:element>
    <xs:element name="testresultHandler" type="InfraHandlerSectionType"
        minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="stoptime" type="xs:dateTime" />
    <xs:element name="runtime"></xs:element>
    <xs:element name="aehandler" minOccurs="0" maxOccurs="unbounded"></xs:element>
    <xs:element name="pause" minOccurs="0"></xs:element>
</xs:sequence>
tag

Constant value = ‘subtest’ to be used as xml tag.

Type

str

starttime
Type

datetime

initinfo
Type

InitInfo

runinfo
Type

RunInfo

setup

setup

Type

TestSection

test

test

Type

TestSection

sections

sections - list of TestSection

Type

list

cleanup

cleanup

Type

TestSection

result

Rollup result is based on individual setup/test, customtest and cleanup sections within the subtest

Type

Result

testresulthandlers

testresulthandlers - list of InfraHandlerSection

Type

list

stoptime
Type

datetime

runtime
Type

timedelta

aehandlers

aehandlers - list of AEHandlers

Type

list

pause

pause

Type

Pause

children = ['starttime', 'initinfo', 'runinfo', 'setup', 'test', 'sections', 'cleanup', 'result', 'testresulthandlers', 'stoptime', 'runtime', 'aehandlers', 'pause']
property description
property module
property name
property path

TestGroup

This module contains the base class for all schema elements.

class pyats.aereport.testscript.testgroup.TestGroup

Bases: pyats.aereport.toplevel.aereportelement.AEReportElement

XML results for grouping subtests run by test scripts

Class based on the following schema definition

<xs:complexType name="TestGroupType">
    <xs:sequence>
        <xs:element name="starttime" type="xs:dateTime"></xs:element>
        <xs:element name="id"></xs:element>
        <xs:element name="initinfo" type="initInfoType"/>
        <xs:element name="runinfo" type="runinfoType"/>
        <xs:element name="setup" type="TestSectionType" minOccurs="0"/>
        <xs:element name="test" type="TestSectionType" minOccurs="0"/>
        <xs:element name="section" type="TestSectionType" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element name="subtest" type="TestResultType" maxOccurs="unbounded"/>
        <xs:element name="cleanup" type="TestSectionType" minOccurs="0"/>
        <xs:element ref="result"></xs:element>
        <xs:element name="stoptime" type="xs:dateTime"></xs:element>
        <xs:element name="runtime"></xs:element>
        <xs:element name="summary" type="summaryType"/>
        <xs:element name="aehandler" minOccurs="0" maxOccurs="unbounded"></xs:element>
        <xs:element name="pause" minOccurs="0"></xs:element>
    </xs:sequence>
</xs:complexType>
tag

Constant value = ‘multitest’ to be used as xml tag.

Type

str

starttime

testcase start time, internally set by aetst::testcase begin block

Type

date

stoptime

testcase end time, internally set up aetest::testcase end block

Type

date

runtime

The time elapsed between the starttime and the stoptime

Type

str

testgroupid

This is the testgroup id which will typically be not reported in TIMS. But users may choose to report this as separate record in TIMS

Type

TestGroupId

initInfo

initInfo object

Type

InitInfo

runinfo

RunInfo object

Type

RunInfo

setup

TestSection object

Type

TestSection

test

TestSection object

Type

TestSection

sections

TestSection object

Type

TestSection

subtests

TestResult object

Type

TestResult

cleanup

TestSection object

Type

TestSection

result

Rollup result is based on individual setup, subtests and cleanup sections within the group tests. But user can also explicitly over-ride it by calling ats_results -result directly.

Type

str

summary

Summary object

Type

Summary

aehandler

aetest testcase or section handler

Type

AEHandler

pause

Invoked at the end of the testcase

Type

Pause

class pyats.aereport.testscript.testgroup.TestGroupId

Bases: pyats.aereport.toplevel.aereportelement.AEReportElement

XML results for grouping subtests run by test scripts

Class based on the following schema definition
<xs:element name="id">
    <xs:annotation>...</xs:annotation>
    <xs:complexType>
        <xs:sequence>
            <xs:element name="name" type="xs:string">...</xs:element>
            <xs:element name="tcr" minOccurs="0">...</xs:element>
            <xs:element name="tims" minOccurs="0">...</xs:element>
            <xs:element name="testplan" minOccurs="0">...</xs:element>
            <xs:element name="md5" minOccurs="0">...</xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>
tag

Constant value = ‘report’ to be used as xml tag.

Type

str

name

This is the testcase id in aetest context specified via -tc_id to aetest::testcase API

Type

str

tcr

Testcase Repository id which is created and stored in TIMS

Type

str

tims

Tims test id which is created and stored in TIMS

Type

str

testplan

Test Plan id which should be an EDCS number

Type

str

md5

Md5 is calculated based on testcase name, test paramters, testbed name etc to ensure uniqueness

Type

InitInfo

testresult – TestResult Class

This module implements TestResult class

class pyats.aereport.testscript.testresult.TestResult(tcid, **kwargs)

Bases: pyats.aereport.testscript.basetestresult.BaseTestResult

XML results for each test result containing setup, test and cleanup sections

Class based on the following schema definition

<xs:sequence>
    <xs:element name="pretestcaseHandler" type="InfraHandlerSectionType"
        minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="starttime" type="xs:dateTime" />
    <xs:element name="initinfo" type="initInfoType" />
    <xs:element name="runinfo" type="runinfoType" />
    <xs:element name="setup" type="TestSectionType" minOccurs="0" />
    <xs:element name="test" type="TestSectionType" minOccurs="0" />
    <xs:element name="section" type="TestSectionType" minOccurs="0"
        maxOccurs="unbounded" />
    <xs:element name="subtest" type="SubTestResultType"
        minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="cleanup" type="TestSectionType" minOccurs="0" />
    <xs:element ref="result"></xs:element>
    <xs:element name="testresultHandler" type="InfraHandlerSectionType"
        minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="stoptime" type="xs:dateTime" />
    <xs:element name="runtime"></xs:element>
    <xs:element name="posttestcaseHandler" type="InfraHandlerSectionType"
        minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="aehandler" minOccurs="0" maxOccurs="unbounded"></xs:element>
    <xs:element name="pause" minOccurs="0"></xs:element>
</xs:sequence>
tag

Constant value = ‘testcase’ to be used as xml tag.

Type

str

pretestcasehandlers

pretestcasehandlers - list of InfraHandlerSection

Type

list

starttime
Type

datetime

initinfo
Type

InitInfo

runinfo
Type

RunInfo

setup

setup

Type

TestSection

test

test

Type

TestSection

sections

sections - list of TestSection

Type

list

subtests

subtests - list of SubTestResult

Type

list

cleanup

cleanup

Type

TestSection

result

Rollup result is based on individual setup/test, customtest and cleanup sections within the subtest

Type

Result

testresulthandlers

testresultHandlers - list of InfraHandlerSection

Type

list

stoptime
Type

datetime

runtime
Type

timedelta

posttestcasehandlers

posttestcashandlers - list of InfraHandlerSection

Type

list

aehandlers

aehandlers - list of AEHandlers

Type

list

pause

pause

Type

Pause

add_subtest(**kwargs)

Create a testcase (TestResult) and append it to the testcases list.

Parameters
  • subtcid (str) – The id of the subtest to be created. This is set once and never overwritten

  • logfilepath (str) – Path to the log file for the testcase

  • variance (str) – variance - Variance id is the same as TIMS config id. There cannot be a variance id at testcase level if it contains subtests. In such case the variance id will be part of subtest.

  • name (str) – Name of the testcase/subtest which is equivalent of the Title attribute in TIMS

  • xref (dict) – xRef

  • id (dict) –

children = ['pretestcasehandlers', 'starttime', 'initinfo', 'runinfo', 'setup', 'test', 'sections', 'subtests', 'cleanup', 'result', 'testresulthandlers', 'stoptime', 'runtime', 'posttestcasehandlers', 'aehandlers', 'pause']
property description
get_infrahandler(tag, name)

Searches within infrahandlers lists whether an infrahandler of a given name already exists. It uses the tag to determine which list to search e.g. pretestcasehandlers list, etc.

Parameters
  • tag (str) – Used to determine which list to search. Possible values are: pretestcaseHandler, posttestcaseHandler, testresultHandler

  • name (str) – The name of the handler to be found

Returns

ret – InfraHandler if found; otherwise None

Return type

InfraHandlerSection

get_subtest(id)

Return the subtest

Returns

If subtest id exists, return it, else return None

Return type

str or None

is_last_subtest_closed()

Return if the last subtest is closed

Returns

Return 1 if last subtest was closed, else False

Return type

Bool

property module
property name
property path

testscriptabort – TestScriptAbort Class

This module implements TestScriptAbort class used by TestScript.

class pyats.aereport.testscript.testscriptabort.TestScriptAbort(abortfile='')

Bases: pyats.aereport.toplevel.aereportelement.AEReportElement

Class based on the following schema definition

<xs:element name="abort" minOccurs="0">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="time">
                <xs:annotation>
                    <xs:documentation>Time when abort signal was received</xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="abortfile">
                <xs:annotation>
                    <xs:documentation>Name of abort file generated to indicate abort condition</xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>

Examples

>>> abort1 = TestScriptAbort('/path/to/my/file')
>>> print abort1.xml()
<abort><abortfile>/path/to/my/file</abortfile><time>2014-03-12:23-59-22</time></abort>
tag

Constant value = ‘abort’ to be used as xml tag.

Type

str

time

Time when abort signal was received

Type

datetime

abortfile

Name of abort file generated to indicate abort condition

Type

str

testsection – TestSection Class

This module implements TestSection class

class pyats.aereport.testscript.testsection.TestSection(tag='section')

Bases: pyats.aereport.toplevel.aereportelement.AEReportElement

XML results for generic test sections such as testproc, setup, cleanup, common_cleanup, common_setup, etc

Class based on the following schema definition

<xs:sequence>
    <xs:element name="starttime" type="xs:dateTime" />
    <xs:element name="name" minOccurs="0"></xs:element>
    <xs:element name="xref" type="xrefType" />
    <xs:element name="logfile" type="LogFileType" />
    <xs:element name="runinfo" type="runinfoType" />
    <xs:element name="checkpoint" type="CheckpointType"
        minOccurs="0" maxOccurs="unbounded" />
    <xs:element ref="result" />
    <xs:element name="stoptime" type="xs:dateTime"></xs:element>
    <xs:element name="runtime"></xs:element>
    <xs:element name="aehandler" minOccurs="0" maxOccurs="unbounded"></xs:element>
    <xs:element name="pause" minOccurs="0"></xs:element>
    <xs:element name="subSection" type="CommonSubSectionType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
tag

Default value = ‘section’. Probably would be overwritten

Type

str

starttime
Type

datetime

name

Name of section; used in the case of custom sections

Type

str

xref
Type

XRef

logfile
Type

LogFile

runinfo
Type

RunInfo

checkpoints

checkpoints - list of checkpoints

Type

list

result
Type

Result

stoptime

section end time, internally set up aetest::section end block

Type

datetime

runtime
Type

timedelta

aehandlers

aehandlers - list of AEHandlers - aetest testcase or section handlers

Type

list

pause

pause

Type

Pause

commonsubsections

commonsubsections - list of CommonSubSection objects

Type

list

extra

description : Description of the section module name path

Type

Dictionary contains extra information

add_commonsubsection(**kwargs)

Create a commonsubsection and append it to the commonsubsections list.

Parameters
  • logfilepath (str) – Path to the log file for the testcase

  • variance (str) – variance - Variance id is the same as TIMS config id. There cannot be a variance id at testcase level if it contains subtests. In such case the variance id will be part of subtest.

  • name (str) – Name of the testcase/subtest which is equivalent of the Title attribute in TIMS

  • xref (dict) – xRef

  • id (dict) – id

add_teststep(**kwargs)
children = ['starttime', 'name', 'description', 'xref', 'logfile', 'runinfo', 'checkpoints', 'result', 'stoptime', 'runtime', 'aehandlers', 'pause', 'commonsubsections', 'teststeps']
common_section_tags = ['commonSetup', 'commonVerify', 'commonCleanup', 'commonModify']
property description
get_commonsubsection(tcid)

Verify if a commonsubsection exists, if so return it, else return None

Parameters

tcid (str) – The id of the commonsubsection to be found

Returns

If commonsubsection exists, return it. Else None.

Return type

str or None

get_teststep(tsid)

Verify if a step exists, if so return it, else return None

Parameters

tcid (str) – The id of the step to be found

Returns

If step exists, return it. Else None.

Return type

str or None

is_last_commonsubsection_closed()

Return if the last commonsubsection is closed

Returns

Return 1 if last commonsubsection was closed, else False

Return type

Bool

property module
property path
set_args(**kwargs)
Parameters
  • xref (dict) – xref

  • logfile (dict) – logfile

  • pause (str) – pause

  • result (dict) – Result

  • runinfo (dict) – runinfo

  • checkpoint (dict) – checkpoint

  • aehandlers (dict) – aehandlers

  • pause – pause

  • commonsubsections (str) – commonsubsection

valid_section_tags = ['setup', 'cleanup', 'section', 'commonSetup', 'commonVerify', 'commonCleanup', 'commonModify']
class pyats.aereport.testscript.teststep.TestStep(tag='step')

Bases: pyats.aereport.toplevel.aereportelement.AEReportElement

add_teststep(**kwargs)
get_teststep(tsid)

Verify if a step exists, if so return it, else return None

Parameters

tcid (str) – The id of the step to be found

Returns

If step exists, return it. Else None.

Return type

str or None

set_args(**kwargs)
valid_section_tags = ['step']