Functions | |
include (fname) | |
include python code in a test script | |
test_file () | |
get the test file name with path | |
test_dir () | |
get the test directory (relative to the current directory) | |
test (title, opt=0) | |
start a new test | |
skip (nTests=9999) | |
skip the tests following this command. | |
SCENARIO (self, title="", opt=0) | |
start a new BDD-style scenario (alternative #1) | |
GIVEN (self, msg="", dest=0x3) | |
start the "given" section of a BDD-style scenario (alternative #1) | |
WHEN (self, msg="", dest=0x3) | |
start the "when" section of a BDD-style scenario (alternative #1) | |
THEN (self, msg="", dest=0x3) | |
start the "then" section of a BDD-style scenario (alternative #1) | |
AND (self, msg="", dest=0x3) | |
adds the "and" section of a BDD-style scenario (alternative #1) | |
scenario (title, opt=0) | |
start a new BDD-style scenario (alternative #2) | |
given (given_msg, and_msg) | |
start the "given" section of a BDD-style scenario (alternative #2) | |
when (given_msg, and_msg) | |
start the "when" section of a BDD-style scenario (alternative #2) | |
then (given_msg, and_msg) | |
start the "then" section of a BDD-style scenario (alternative #2) | |
expect (match) | |
defines an expectation for the current test | |
ensure (bool_expr) | |
ensures that the provided Boolean expression is true | |
glb_filter (*args) | |
Send the QS Global Filter to the Target. | |
loc_filter (*args) | |
Send the Local Filter to the Target. | |
ao_filter (obj_id) | |
Updates the Local Filter for a given AO in the Target. | |
current_obj (obj_kind, obj_id) | |
Set the Current-Object in the Target. | |
query_curr (obj_kind) | |
query the current object in the Target | |
tick (tick_rate=0) | |
trigger system clock tick in the Target | |
expect_pause () | |
defines expectation for a Test Pause | |
expect_run () | |
defines expectation for calling QF_run()/QF::run() | |
continue_test () | |
sends the CONTINUE packet to the Target to continue a test | |
command (cmdId, param1=0, param2=0, param3=0) | |
executes a given command in the Target | |
init (signal=0, params=None) | |
take the top-most initial transition in the current SM object in the Target | |
dispatch (signal, params=None) | |
dispatch a given event in the current SM object in the Target | |
post (signal, params=None) | |
post a given event to the current AO object in the Target | |
publish (signal, params=None) | |
publish a given event to subscribers in the Target | |
probe (func, data) | |
sends a Test-Probe to the Target | |
peek (offset, size, num) | |
peeks data in the Target | |
poke (offset, size, data) | |
pokes data into the Target. | |
fill (offset, size, num, item=0) | |
fills data into the Target. | |
note (msg, dest=(SCREEN|TRACE)) | |
display a note in the QUTest output and in QSPY output. | |
tag (msg, dest=(SCREEN|TRACE)) | |
display a tag in the QUTest output and in QSPY output. | |
pack (format, v1, v2) | |
packs data into binary string to be sent to QSPY. | |
last_rec () | |
returns last record received from the target as string. | |
on_reset () | |
callback function invoked after each Target reset | |
on_setup () | |
callback function invoked at the beginning of each test | |
on_teardown () | |
callback function invoked at the end of each test | |
Variables | |
int | VERSION = 740 |
current version of the Python QUTest interface | |
qutest_dsl.include | ( | fname | ) |
include python code in a test script
[in] | fname | name of the file to include. May contain a path relative to the test script. |
Example
file to be included:
test script calling include()
:
Definition at line 58 of file qutest_dsl.py.
qutest_dsl.test_file | ( | ) |
get the test file name with path
Definition at line 69 of file qutest_dsl.py.
qutest_dsl.test_dir | ( | ) |
get the test directory (relative to the current directory)
Definition at line 80 of file qutest_dsl.py.
qutest_dsl.test | ( | title, | |
opt = 0 ) |
start a new test
[in] | title | title of the test |
[in] | opt | options {0=default, NORESET} |
Definition at line 100 of file qutest_dsl.py.
qutest_dsl.skip | ( | nTests = 9999 | ) |
skip the tests following this command.
[in] | nTests | number of tests to skip (default-all remaining tests) e.g., skip(1) will skip one test following this command. |
Definition at line 125 of file qutest_dsl.py.
qutest_dsl.SCENARIO | ( | self, | |
title = "", | |||
opt = 0 ) |
start a new BDD-style scenario (alternative #1)
[in] | title | title of the scenario |
[in] | opt | options {0=default, NORESET} |
The SCENARIO()
command outputs the provided title
(text) to the QUTest output (text/log) and the QSPY output (text/log), adding the prefix
Definition at line 157 of file qutest_dsl.py.
qutest_dsl.GIVEN | ( | self, | |
msg = "", | |||
dest = 0x3 ) |
start the "given" section of a BDD-style scenario (alternative #1)
GIVEN()
section typically sets up the context for the "given-when-then" sequence. Therefore, a GIVEN()
section should follow SCENARIO().[in] | msg | optional "given" message |
[in] | dest | optional destination of the message (both screen and QSPY) |
Definition at line 189 of file qutest_dsl.py.
qutest_dsl.WHEN | ( | self, | |
msg = "", | |||
dest = 0x3 ) |
start the "when" section of a BDD-style scenario (alternative #1)
WHEN()
section should follow the GIVEN() section.[in] | msg | optional "when" message |
[in] | dest | optional destination of the message (both screen and QSPY) |
Definition at line 221 of file qutest_dsl.py.
qutest_dsl.THEN | ( | self, | |
msg = "", | |||
dest = 0x3 ) |
start the "then" section of a BDD-style scenario (alternative #1)
THEN()
section should follow the WHEN() section.[in] | msg | optional "when" message |
[in] | dest | optional destination of the message (both screen and QSPY) |
Definition at line 253 of file qutest_dsl.py.
qutest_dsl.AND | ( | self, | |
msg = "", | |||
dest = 0x3 ) |
adds the "and" section of a BDD-style scenario (alternative #1)
[in] | msg | optional "when" message |
[in] | dest | optional destination of the message (both screen and QSPY) |
Definition at line 284 of file qutest_dsl.py.
qutest_dsl.scenario | ( | title, | |
opt = 0 ) |
start a new BDD-style scenario (alternative #2)
[in] | title | title of the scenario |
[in] | opt | options {0=default, NORESET} |
The @scenario()
decorator outputs the provided title
(text) to the QUTest output (text/log) and the QSPY output (text/log), adding the prefix "Scenario:" in front.
The decorated function must take the:
[in,out] | context | execution context (clean context at the start of a scenario) |
do()
.context
(to let the QUTest system store any modifications to the context
)Definition at line 327 of file qutest_dsl.py.
qutest_dsl.given | ( | given_msg, | |
and_msg ) |
start the "given" section of a BDD-style scenario (alternative #2)
@given
section typically sets up the context for the "given-when-then" sequence. Therefore, a @given
section should follow @scenario() or it might follow the @then() section to define another "given-when-then" sequence.[in] | given_msg | optional "given" message |
[in] | and_msg | optional "and" messages |
The @given()
command outputs the provided given_msg
(text) to the QUTest output (text/log) and the QSPY output (text/log), adding the prefix "Given:" in front. Additionally, every subsequent and_msg
is also output with the prefix "And:".
The decorated function must take the:
[in,out] | context | execution context |
do()
.context
(to let the QUTest system store any modifications to the context
)Definition at line 385 of file qutest_dsl.py.
qutest_dsl.when | ( | given_msg, | |
and_msg ) |
start the "when" section of a BDD-style scenario (alternative #2)
@when
section typically executes a command() or post() command. The @when
section should follow the @given() section.[in] | when_msg | optional "when" message |
[in] | and_msg | optional "and" messages |
The @when()
command outputs the provided when_msg
(text) to the QUTest output (text/log) and the QSPY output (text/log), adding the prefix "When:" in front. Additionally, every subsequent and_msg
is also output with the prefix "And:".
The decorated function must take the:
[in,out] | context | execution context |
do()
.Definition at line 435 of file qutest_dsl.py.
qutest_dsl.then | ( | given_msg, | |
and_msg ) |
start the "then" section of a BDD-style scenario (alternative #2)
@then
section typically calls the expect() commands to verify the expectaion of the "given-when-then" sequence. The @then
section should follow the @when() section.[in] | then_msg | optional "then" message |
[in] | and_msg | optional "and" messages |
The @then
command outputs the provided then_msg
(text) to the QUTest output (text/log) and the QSPY output (text/log), adding the prefix "Then:" in front. Additionally, every subsequent and_msg
is also output with the prefix "And:".
The decorated function must take the:
[in,out] | context | execution context |
do()
.Definition at line 490 of file qutest_dsl.py.
qutest_dsl.expect | ( | match | ) |
defines an expectation for the current test
[in] | match | the expected match for the QSPY output The match string can contain special characters, such as: * , ? and [chars] , which are matched according to the Python command fnmatch.fnmatchcase() |
match
string can be the printf-style %-subsitution string (compatible with Python 2 and Python 3), or the new "f-string" (compatible only with Python 3).match
parameter will be automatically replaced with the current numerical value of the test sequence-counter.Definition at line 519 of file qutest_dsl.py.
qutest_dsl.ensure | ( | bool_expr | ) |
ensures that the provided Boolean expression is true
[in] | bool_expr | the Boolean expression to check |
Definition at line 533 of file qutest_dsl.py.
qutest_dsl.glb_filter | ( | * | args | ) |
Send the QS Global Filter to the Target.
[in] | args | list of Record-Type groups or individual Record-Types to set or clear. A given filter-group or an individual filter is set when it is positive, and cleared with it is preceded with the minus (- ) sign. The filter list can contain the following: GRP_ALL # all Record-Types
GRP_SM # State Machine Record-Types
GRP_AO # Active Object Record-Types
GRP_MP # Memory Pool Record-Types
GRP_EQ # Event Queue Record-Types
GRP_TE # Time Events Record-Types
GRP_QF # Framework Record-Types (e.g., post/publish/..)
GRP_SC # Scheduler Record-Types (e.g., scheduler lock/unlock)
GRP_SEM # Semaphore Record-Types (e.g., Semaphore take/signal)
GRP_MTX # Mutex Record-Types (e.g., Mutex lock/unlock)
GRP_U0 # User group 0 (Record-Types 100-104)
GRP_U1 # User group 1 (Record-Types 105-109)
GRP_U2 # User group 2 (Record-Types 110-114)
GRP_U3 # User group 3 (Record-Types 115-119)
GRP_U4 # User group 0 (Record-Types 120-124)
GRP_UA # All user records (Record-Types 100-124)
<num> # Specific QS trace Record-Type in the range 0..127
|
recID
the bitmask has a '1' in the position (1 << recID
).Definition at line 578 of file qutest_dsl.py.
qutest_dsl.loc_filter | ( | * | args | ) |
Send the Local Filter to the Target.
[in] | args | list of QS-ID groups or individual QS-IDs to set or clear. A given filter-group or an individual filter is set when it is positive, and cleared with it is preceded with the minus (- ) sign. |
This parameter can take one of the following values:
qsID
the bitmask has a '1' in the position (1 << qsID
).Definition at line 611 of file qutest_dsl.py.
qutest_dsl.ao_filter | ( | obj_id | ) |
Updates the Local Filter for a given AO in the Target.
[in] | obj_id | active object to set/clear the local filter for in the Target |
This parameter can be either a string (name of the AO) or the AO's priority. Also, it can be either positive (to set) or negative (to clear) the QS local filter.
Definition at line 635 of file qutest_dsl.py.
qutest_dsl.current_obj | ( | obj_kind, | |
obj_id ) |
Set the Current-Object in the Target.
[in] | obj_kind | Kind of object to set |
This parameter can take one of the following values:
[in] | obj_id | Name or addres of the object |
Definition at line 666 of file qutest_dsl.py.
qutest_dsl.query_curr | ( | obj_kind | ) |
query the current object in the Target
[in] | obj_kind | Kind of object to query |
This parameter can take one of the following values:
Definition at line 704 of file qutest_dsl.py.
qutest_dsl.tick | ( | tick_rate = 0 | ) |
trigger system clock tick in the Target
[in] | tick_rate | the tick rate (0..QF_MAX_TICK_RATE) |
Definition at line 724 of file qutest_dsl.py.
qutest_dsl.expect_pause | ( | ) |
defines expectation for a Test Pause
expect_pause()
expectation must be placed in the on_reset() callback.Definition at line 742 of file qutest_dsl.py.
qutest_dsl.expect_run | ( | ) |
defines expectation for calling QF_run()/QF::run()
Definition at line 760 of file qutest_dsl.py.
qutest_dsl.continue_test | ( | ) |
sends the CONTINUE packet to the Target to continue a test
Definition at line 773 of file qutest_dsl.py.
qutest_dsl.command | ( | cmdId, | |
param1 = 0, | |||
param2 = 0, | |||
param3 = 0 ) |
executes a given command in the Target
[in] | cmdId | the first cmdId argument for the QS_onCommand() callback function in the test fixture. |
cmdId
parameter could be either the raw number or a name that is delivered by QS_ENUM_DICTIONARY(enum, group), where the second group
argument is QS_CMD (numerical value 7).[in] | param1 | the "param1" argument to QS_onCommand() (optional) |
[in] | param2 | the "param2" argument to QS_onCommand() (optional) |
[in] | param3 | the "param3" argument to QS_onCommand() (optional) |
Definition at line 795 of file qutest_dsl.py.
qutest_dsl.init | ( | signal = 0, | |
params = None ) |
take the top-most initial transition in the current SM object in the Target
[in] | signal | the event signal of the "initialization event" |
[in] | params | the parameters of the "initialization event" |
Definition at line 816 of file qutest_dsl.py.
qutest_dsl.dispatch | ( | signal, | |
params = None ) |
dispatch a given event in the current SM object in the Target
[in] | signal | the event signal of the event to be dispatched |
[in] | params | the parameters of the event to be dispatched |
Definition at line 835 of file qutest_dsl.py.
qutest_dsl.post | ( | signal, | |
params = None ) |
post a given event to the current AO object in the Target
[in] | signal | the event signal of the event to be posted |
[in] | params | the parameters of the event to be posted |
Definition at line 854 of file qutest_dsl.py.
qutest_dsl.publish | ( | signal, | |
params = None ) |
publish a given event to subscribers in the Target
[in] | signal | the event signal of the event to be posted |
[in] | params | the parameters of the event to be posted |
Definition at line 873 of file qutest_dsl.py.
qutest_dsl.probe | ( | func, | |
data ) |
sends a Test-Probe to the Target
[in] | func | the name or raw address of a function |
[in] | data | the data (uint32_t) for the Test-Probe |
Definition at line 899 of file qutest_dsl.py.
qutest_dsl.peek | ( | offset, | |
size, | |||
num ) |
peeks data in the Target
[in] | offset | offset [in bytes] from the start of the current_obj() |
[in] | size | size of the data items (1, 2, or 4) |
[in] | num | number of data items to peek |
Definition at line 920 of file qutest_dsl.py.
qutest_dsl.poke | ( | offset, | |
size, | |||
data ) |
pokes data into the Target.
[in] | offset | offset [in bytes] from the start of the current_obj() |
[in] | size | size of the data items (1, 2, or 4) |
[in] | data | binary data to send |
Definition at line 939 of file qutest_dsl.py.
qutest_dsl.fill | ( | offset, | |
size, | |||
num, | |||
item = 0 ) |
fills data into the Target.
[in] | offset | offset [in bytes] from the start of the current_obj() |
[in] | size | size of the data item (1, 2, or 4) |
[in] | num | number of data items to fill |
[in] | item | data item to fill with |
Definition at line 958 of file qutest_dsl.py.
qutest_dsl.note | ( | msg, | |
dest = (SCREEN | TRACE) ) |
display a note in the QUTest output and in QSPY output.
[in] | msg | text message |
[in] | dest | destination (SCREEN, TRACE), default both |
Definition at line 979 of file qutest_dsl.py.
qutest_dsl.tag | ( | msg, | |
dest = (SCREEN | TRACE) ) |
display a tag in the QUTest output and in QSPY output.
Definition at line 986 of file qutest_dsl.py.
qutest_dsl.pack | ( | format, | |
v1, | |||
v2 ) |
packs data into binary string to be sent to QSPY.
format
. The arguments must match the values required by the [format](https://docs.python.org/3/library/struct.html#format-strings") exactly.
The pack() command is typically used inside other QUTest commands
to pack the binary event parameters or binary data for poke() and fill().
@param [in] format string
@param [in] v1 one or more data elements requried by format
@param [in] v2 one or more data elements requried by format
@par Usage
@code{py}
dispatch("MY_SIG", pack("<B", 2))
poke(2, 2, pack("<HH", 0xB2C2, 0xD2E2)) Definition at line 1009 of file qutest_dsl.py.
qutest_dsl.last_rec | ( | ) |
returns last record received from the target as string.
Definition at line 1026 of file qutest_dsl.py.
qutest_dsl.on_reset | ( | ) |
callback function invoked after each Target reset
Definition at line 1030 of file qutest_dsl.py.
qutest_dsl.on_setup | ( | ) |
callback function invoked at the beginning of each test
Definition at line 1034 of file qutest_dsl.py.
qutest_dsl.on_teardown | ( | ) |
callback function invoked at the end of each test
Definition at line 1038 of file qutest_dsl.py.
int qutest_dsl.VERSION = 740 |
current version of the Python QUTest interface
Definition at line 33 of file qutest_dsl.py.