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
Use the `mbed unittest` command to build and run unit tests, and to generate files for new unit tests.
733
+
Use the `mbed unittest` command to build and run unit tests, or to generate files for new unit tests.
734
734
735
735
Build and run unit tests with `mbed unittest`. The arguments are:
736
736
@@ -747,6 +747,46 @@ Build and run unit tests with `mbed unittest`. The arguments are:
747
747
748
748
Generate files for a new unit test with `mbed unittest --new <FILE>`.
749
749
750
+
### Building and running unit tests
751
+
752
+
You can specify to only **build** the unit tests by using the `--skip-run` option:
753
+
754
+
```
755
+
$ mbed unittest --skip-run
756
+
```
757
+
758
+
You can specify to only **run** the unit tests by using the `--skip-build` option:
759
+
760
+
```
761
+
$ mbed unittest --skip-build
762
+
```
763
+
764
+
If you do not specify any of these, `mbed unittest` will build all available unit tests and run them.
765
+
766
+
### Running a subset of tests
767
+
768
+
You can run a **limited set** of unit tests by using the `-r` or `--regex` option. This takes a regular expression, which it compares against the test names. For example to run all cellular unit tests you can specify:
769
+
770
+
```
771
+
$ mbed unittest -r cellular
772
+
```
773
+
774
+
### Getting code coverage
775
+
776
+
You can generate a code coverage report by using the `--coverage` option. For example to create an html report you can specify:
777
+
778
+
```
779
+
$ mbed unittest --coverage html
780
+
```
781
+
782
+
### Creating new unit tests
783
+
784
+
All unit tests are under `mbed-os/UNITTESTS` directory. You can **generate** the necessary files for a unit test by using the `--new` option. For example to create the files for `rtos/Semaphore.cpp` you can specify:
0 commit comments