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, or to generate files for new unit tests.
733
+
Use the `mbed test --unittests` command to build and run unit tests, or to generate files for new unit tests.
734
734
735
-
Build and run unit tests with `mbed unittest`. The arguments are:
735
+
Build and run unit tests with `mbed test --unittests`. The arguments are:
736
736
737
737
*`--compile` to only compile unit tests.
738
738
*`--run` to only run unit tests.
739
739
*`-c` or `--clean` to clean build directory.
740
-
*`-d` or `--debug` to prepare debug build.
740
+
*`--profile debug` to prepare debug build.
741
741
*`--coverage <TYPE>` to generate code coverage report where TYPE can be "html", "xml" or "both".
742
742
*`-m <NAME>` or `--make-program <NAME>` to select which make build tool to use where NAME can be "make", "gmake", "mingw32-make" or "ninja".
743
743
*`-g <NAME>` or `--generator <NAME>` to select which CMake generator to use where NAME can be "Unix Makefiles", "MinGW Makefiles" or "Ninja".
744
744
*`-r <EXPRESSION>` or `--regex <EXPRESSION>` to run tests matching the regular expression.
745
745
*`--build <PATH>` to specify build directory.
746
746
*`-v` or `--verbose` for verbose diagnostic output.
747
747
748
-
Generate files for a new unit test with `mbed unittest --new <FILE>`.
748
+
Generate files for a new unit test with `mbed test --unittests --new <FILE>`.
749
749
750
750
### Building and running unit tests
751
751
752
752
You can specify to only **build** the unit tests by using the `--compile option:
753
753
754
754
```
755
-
$ mbed unittest --compile
755
+
$ mbed test --unittests --compile
756
756
```
757
757
758
758
You can specify to only **run** the unit tests by using the `--run` option:
759
759
760
760
```
761
-
$ mbed unittest --run
761
+
$ mbed test --unittests --run
762
762
```
763
763
764
-
If you do not specify any of these, `mbed unittest` will build all available unit tests and run them.
764
+
If you do not specify any of these, `mbed test --unittests` will build all available unit tests and run them.
765
765
766
766
### Running a subset of tests
767
767
768
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
769
770
770
```
771
-
$ mbed unittest -r cellular
771
+
$ mbed test --unittests -r cellular
772
772
```
773
773
774
774
### Getting code coverage
775
775
776
776
You can generate a code coverage report by using the `--coverage` option. For example to create an html report you can specify:
777
777
778
778
```
779
-
$ mbed unittest --coverage html
779
+
$ mbed test --unittests --coverage html
780
780
```
781
781
782
782
### Creating new unit tests
783
783
784
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