You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tools/testing/testing_greentea.md
+41-31Lines changed: 41 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
## Greentea testing applications
2
2
3
-
Greentea is the automated testing tool for Arm Mbed OS development. It's a test runner that automates the process of flashing development boards, starting tests, and accumulating test results into test reports. Developers use it for local development as well as for automation in a Continuous Integration environment.
3
+
Greentea is the automated testing tool for Arm Mbed OS development. It's a test runner that automates the process of flashing development boards, starting tests, and accumulating test results into test reports. Developers use it for local development as well as for automation in a continuous integration environment.
4
4
5
5
Greentea tests run on embedded devices, but Greentea also supports 'host tests'. These are Python scripts that run on a computer and can communicate back to the embedded device. You can for example verify that a value was actually written to the cloud when the device said it did so.
6
6
@@ -81,9 +81,17 @@ Let's write your first test. Use Mbed CLI to create a new project:
81
81
$ mbed new first-greentea-test
82
82
```
83
83
84
-
As specified above, there is a convention where all tests live in the `TESTS/` directory. In the `first-greentea-test` folder create a folder `TESTS/tests/simple-test/`.
84
+
As specified above, there is a convention where all tests live in the `TESTS/` directory. In the `first-greentea-test` folder create a folder `TESTS/test-group/simple-test/`.
85
85
86
-

86
+
```
87
+
first-greentea-test/
88
+
└── TESTS/
89
+
└── test-group/
90
+
└── simple-test/
91
+
└── main.cpp
92
+
```
93
+
94
+
*Test structure for Greentea tests*
87
95
88
96
In this folder, create a file `main.cpp`. In here you can use UNITY, utest and the Greentea Client to write your test:
89
97
@@ -95,7 +103,7 @@ In this folder, create a file `main.cpp`. In here you can use UNITY, utest and t
After compilation you can use the `--run-list` argument to list all tests that are ready to be ran.
347
+
338
348
#### Executing all tests
339
349
340
350
The default action of Greentea using `mbed test` is to execute all tests that are found. You can also add `-v` to make the output more verbose.
@@ -347,10 +357,10 @@ You can select test cases by name using the `-n` argument. This command executes
347
357
$ mbed test -n tests-mbedmicro-rtos-mbed-mail
348
358
```
349
359
350
-
When using the `-n` argument, you can use the `*` character at the end of a test name to match all tests that share a prefix. This command executes all tests that start with `tests-mbedmicro-rtos`:
360
+
When using the `-n` argument, you can use the `*` character as a wildcard. This command executes all tests that start with `tests-` and have `-rtos-` in them.
351
361
352
362
```
353
-
$ mbed test -n tests-mbedmicro-rtos-*
363
+
$ mbed test -n tests-*-rtos-*
354
364
```
355
365
356
366
You can use a comma (`,`) to separate test names (argument `-n`) and build names (argument `-t`). This command executes the tests `tests-mbedmicro-rtos-mbed-mail` and `tests-mbed_drivers-c_strings` for the `K64F-ARM` and `K64F-GCC_ARM` builds in the test specification:
You can limit which boards Greentea uses for testing by using the `--use-tids` argument.
365
375
366
376
```
367
-
$ mbed test --use-tids 02400203C3423E603EBEC3D8,024002031E031E6AE3FFE3D2
377
+
$ mbed test --use-tids 02400203C3423E603EBEC3D8,024002031E031E6AE3FFE3D2 --run
368
378
```
369
379
370
380
Where `02400203C3423E603EBEC3D8` and `024002031E031E6AE3FFE3D` are the target IDs of platforms attached to your system.
371
381
372
-
You can view target IDs using Mbed CLI:
382
+
You can view target IDs using [mbed-ls](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-ls), which is installed as part of Mbed CLI.
0 commit comments