@@ -19,6 +19,11 @@ Python tests located in src/python_testing
19
19
20
20
## Writing Python tests
21
21
22
+ - Defining arguments in the test script
23
+ - In order to streamline the configuration and execution of tests, it is
24
+ essential to define arguments at the top of the test script. This
25
+ section should include various parameters and their respective values,
26
+ which will guide the test runner on how to execute the tests.
22
27
- All test classes inherit from MatterBaseTest in
23
28
[ matter_testing_support.py] ( https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/matter_testing_support.py )
24
29
- support for commissioning using the python controller
@@ -36,11 +41,17 @@ Python tests located in src/python_testing
36
41
- Use Mobly assertions for failing tests
37
42
- self.step() along with a steps\_ function to mark test plan steps for cert
38
43
tests
39
- -
40
44
41
45
### A simple test
42
46
43
47
```
48
+ # test-runner-runs: run1
49
+ # test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
50
+ # test-runner-run/run1/factoryreset: True
51
+ # test-runner-run/run1/quiet: True
52
+ # test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json
53
+ # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
54
+
44
55
class TC_MYTEST_1_1(MatterBaseTest):
45
56
46
57
@async_test_body
@@ -74,6 +85,59 @@ The default_matter_test_main() function is used to run the test on the command
74
85
line. These two lines should appear verbatim at the bottom of every python test
75
86
file.
76
87
88
+ ## Defining the test arguments
89
+
90
+ Below is the format:
91
+
92
+ ```
93
+ # test-runner-runs: <run_identifier>
94
+ # test-runner-run/<run_identifier>/app: ${TYPE_OF_APP}
95
+ # test-runner-run/<run_identifier>/factoryreset: <True|False>
96
+ # test-runner-run/<run_identifier>/quiet: <True|False>
97
+ # test-runner-run/<run_identifier>/app-args: <app_arguments>
98
+ # test-runner-run/<run_identifier>/script-args: <script_arguments>
99
+ ```
100
+
101
+ ### Description of Parameters
102
+
103
+ - test-runner-runs: Specifies the identifier for the run. This can be any
104
+ unique identifier.
105
+
106
+ - Example: run1
107
+
108
+ - test-runner-run/<run_identifier>/app: Indicates the application to be used
109
+ in the test. Different app types as needed could be referenced from section
110
+ [ name: Generate an argument environment file ] of the file
111
+ [ .github/workflows/tests.yaml] ( https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/tests.yaml )
112
+
113
+ - Example: \${TYPE_OF_APP}
114
+
115
+ - test-runner-run/<run_identifier>/factoryreset: Determines whether a factory
116
+ reset should be performed before the test.
117
+
118
+ - Example: True
119
+
120
+ - test-runner-run/<run_identifier>/quiet: Sets the verbosity level of the test
121
+ run. When set to True, the test run will be quieter.
122
+
123
+ - Example: True
124
+
125
+ - test-runner-run/<run_identifier>/app-args: Specifies the arguments to be
126
+ passed to the application during the test.
127
+
128
+ - Example: --discriminator 1234 --KVS kvs1 --trace-to
129
+ json:\$ {TRACE_APP}.json
130
+
131
+ - test-runner-run/<run_identifier>/script-args: Specifies the arguments to be
132
+ passed to the test script.
133
+ - Example: --storage-path admin_storage.json --commissioning-method
134
+ on-network --discriminator 1234 --passcode 20202021 --trace-to
135
+ json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
136
+
137
+ This structured format ensures that all necessary configurations are clearly
138
+ defined and easily understood, allowing for consistent and reliable test
139
+ execution.
140
+
77
141
## Cluster Codegen
78
142
79
143
- [ Objects.py] ( https://github.com/project-chip/connectedhomeip/blob/master/src/controller/python/chip/clusters/Objects.py )
0 commit comments