This directory contains a set of tests describing interactions between nodes, and more specifically between a controller and a controllee.
This test set is written in a high level language before being automatically converted into a language understandable by the different controllers.
There are currently 4 implementations of the CHIP device controller. These different implementations share a common configuration file describing the supported functionalities in terms of clusters, commands and attributes: controllers-clusters.zap
Controllers | Testing |
---|---|
POSIX CLI | y |
iOS | y |
Python | n |
Android | n |
For more information on the different implementations of the CHIP device controller, see README.md
The process of automatic conversion of test files depends on the ZAP tool.
Each of the CHIP device controller implementations uses a dedicated template translating the tests into an appropriate format.
Controllers | Template |
---|---|
POSIX CLI | examples/chip-tool/templates/partials/test_cluster.zapt |
iOS | src/darwin/Framework/CHIP/templates/partials/test_cluster.zapt |
Python | |
Android |
These dedicated templates share a common script which augments the test file with the content of the ZAP database built from the definition files of the specification.
This common script exposes the result of the analysis in the form of multiple lists accessible from the dedicated template files.
These lists contain elements of which certain properties are directly configurable through the source test file, but also additional properties added during the analysis.
{{chip_tests}} takes as parameter a list of test files and returns an iterable list of objects.
Each element of the list is an object with the following properties:
Name | Description |
---|---|
name | Name of the test set in human readable format |
config | Default configuration that is inherited by each of the tests in this set |
tests | The set of tests. It is possible to iterate over it using {{chip_test_items}} |
Name | Description |
---|---|
cluster | Name of the cluster that will be targeted by default by each of the tests in this set |
endpoint | Endpoint Identifier that will be targeted by default by each of the tests in this set |
Additionally, the object exhibits the following autogenerated properties:
Name | Description |
---|---|
filename | Name of the source file from which the test set was built |
totalTests | Total number of tests contained in this set |
{{chip_tests_items}} can be used inside a {{chip_tests}} block and iterates over the test set.
Each element of the list is an object with the following configurable properties:
Name | Description |
---|---|
label | Test name |
disabled | Allows to deactivate a test |
command | Name of the command to execute. The command can be any of the commands available for the cluster, or a special command. |
attribute | If the command is a special attribute command, then this property contains the name of the attribute targeted by the command. |
optional | Allows you to specify that a test is optional. An optional test passes if the controllee does not support the requested command or if the command is supported, and the specified conditions are validated. |
cluster | The name of the target cluster. If not specified, the default configuration is used. |
endpoint | The identifier of the target endpoint. If not specified, the default configuration is used. |
arguments | A list of arguments to pass to the command. It is possible to iterate over it using {{chip_test_item_\parameters}} |
response | A list of expected results or result constraints. It is possible to iterate over it using {{chip_test_item_response_parameters}} |
Additionally, the object exhibits the following autogenerated properties:
Name | Description |
---|---|
index | Overall test index |
{{chip_tests_item|_parameters}} can be used inside a {{chip_test_items}} block and iterates over the test arguments for the target command.
This object contains all the properties contained in the ZAP database related to the command or the attribute in the case of a special attribute command.
It is increased by the value to be used contained in the test file.
{{chip_tests_item|_response|_parameters}} can be used inside a {{chip_test_items}} block and iterates over the test response arguments for the target command.
This object contains all the properties contained in the ZAP database related to the response or the attribute response in the case of a special attribute command.
It is increased by the expected value or the constraints to be used contained in the test file.