...
Overall Test Architecture
Describe the components of Test set up
Test Bed
...
A typical integration test has three components:
- A series of executables with arguments that work together and generate outputs
- A series of expected outputs that should match the output of the executables
- A launcher that starts the tests, compares the outputs to the expected outputs, and determines if the test passes
A simple example
The simple example consists of a talker
node and a listener
node. Code of the talker
and listener
is found in the ROS 2 demos repository.
The talker
sends messages with an incrementing index which, ideally, are consumed by the listener
.
The integration test for the talker
and listener
consist of the three aforementioned components:
- Executables:
talker
andlistener
- Expected outputs: two regular expressions that are expected to be found in the
stdout
of the executables:- ‘Publishing: 'Hello World: ...’
for the
talker-
I heard: [Hello World: ...]for the
listener`
- ‘Publishing: 'Hello World: ...’
- Launcher: a launching script in python that invokes executables and checks for the expected output
The launcher starts talker
and listener
in sequence and periodically checks the outputs. If the regex patterns are found in the output, the launcher exits with a return code of 0
and marks the test as successful. Otherwise, the integration test returns non-zero and is marked as a failure.
The sequence of executables can make a difference during integration testing. If exe_b
depends on resources created by exe_a
, the launcher must start executables in the correct order.
Some nodes are designed to run indefinitely, so the launcher is able to terminate the executables when all the output patterns are satisfied, or after a certain amount of time. Otherwise, the executables have to use a runtime
argument.
Test Bed
Test Framework
This section provides examples for how to use the integration_tests
framework. The architecture of integration_tests
framework is shown in the diagram below.
integration_test architecture
Traffic Generator
Test API description
...