Test properties
Test Flags
You can set the Test Flags of any test either by setting the flags parameter of the inline test
or using the Flags decorator if the test is defined as a decorated function.
The flags of the test can be accessed using the flags attribute of the test.
flags
The flags parameter of the test can be use used to set the flags of any inline test. The flags parameter
must be passed valid flag or multiple flags combined with binary OR opertor.
For example,
1 | with Test("My test", flags=TE) as test: |
Flags
A Flags decorator can be used to set the flags of any test that is defined using a decorated function.
For example,
1 |
|
Test Tags
You can add tags to any test either by setting tags parameter of the inline test
or using Tags decorator if the test is defined as a decorated function. The values of the tags can be accessed
using the tags attribute of the test.
tags
The tags parameter of the test can be used to set tags of any inline test. The tags parameter
can be passed either a list, tuple or a set of tag values. For example,
1 | with Test("My test", tags=("tagA", "tagB")) as test: |
Tags
A Tags decorator can be used to set tags of any test that is defined used a decorated function. For example,
1 |
|
Test Attributes
You can add attributes to any test either by setting attributes parameter of the inline test
or by using Attributes decorator if the test is defined as a decorated function. The values of the attributes can be accessed
using the attributes attribute of the test.
attributes
The attributes parameter of the test can be used to set attributes of any inline test. The attributes parameter
can be passed either a list of (name, value) tuples or Attribute class instances. For example,
1 | with Test("My test", attributes=[("attr0", "value"), Attribute("attr1", "value")] as test: |
Attributes
An Attributes decorator can be used to set attributes of any test that is defined used a decorated function. For example,
1 |
|
Test Requirements
You can add requirements to any test either by setting requirements parameter of the inline test
or by using Requirements decorator if the test is defined as a decorated function. The values of the requirements can be accessed
using the requirements attribute of the test.
✋
Requirementclass instances must always be called with the version number the test is expected to verify.RequirementErrorexception will be raised if version does not match the version of the instance.
requirements
The requirements parameter of the test can be used to set requirements of any inline test. The requirements parameter
must be passed a list of called Requirement instances. of the inline test
or using Requirements decorator if the test is defined as a decorated function. The values of the requirements can be accessed
using the requirements attribute of the test.
For example,
1 |
|
Requirements
A Requirements decorator can be used to set requirements attribute of any test that is defined using a decorated function.
The decorator must be called with one or more called Requirement instances. For example,
1 | RQ1 = Requirement("RQ1", version="1.0") |
Test Specifications
You can add specifications to higher level tests either by setting specifications parameter of the inline test
or using Specifications decorator if the test is defined as a decorated function. The values of the specifications can be accessed
using the specifications attribute of the test.
✋ Specification class instances may be called with the version number the test is expected to verify.
SpecificationErrorexception will be raised if the version does not match the version of the instance.
specifications
The specifications parameter of the test can be used to set specifications of any inline test. The specifications parameter
must be passed a list of Specification class object instances for the inline tests
or using Specifications decorator if the test is defined as a decorated function. The values of the specifications can be accessed
using the specifications attribute of the test.
For example,
1 | from requirements import SRS001 |
Specifications
A Specifications decorator can be used to set specifications attribute of a higher level test that is defined using a decorated function.
The decorator must be called with one or more Specification class object instances. For example,
1 | from requirements import SRS001 |
Test Examples
You can add examples to any test by setting examples parameter of the inline test
or using Examples decorator if the test is defined as a decorated function. The examples can be accessed
using the examples attribute of the test.
examples
The examples parameter of the test can be used to set examples of any inline test. The examples parameter
must be passed a table of examples, which can be defined using Examples class for an inline test
or using the same Examples class as a decorator if the test is defined as a decorated function.
The rows of the examples table can be accessed
using the examples attribute of the test.
✋ Usually, examples are used only with test outlines. Please see Outline for more details.
For example,
1 | with Test("My test", examples=Examples("col0 col1", [("col0_row0", "col1_row0"), ("col0_row1", "col1_row1")])) as test: |
Examples
An Examples decorator can be used to set examples attribute of any test that is defined using a decorated function
or used as an argument of the examples parameter for the test.
The Examples class defines a table of examples and should be passed a header and a list for the rows.
✋ Usually, examples are used only with test outlines. Please see Outline for more details.
For example,
1 |
|