Skip to content

Commit 92c57c7

Browse files
author
Amanda Butler
authored
Merge pull request #703 from theotherjimmy/unittests
Document Unit Testing
2 parents 4b1cde8 + 1763b6a commit 92c57c7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/tools/offline/cli-test-debug.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ As shown above, tests exist inside `TESTS\testgroup\testcase\` directories. Plea
214214

215215
### Unit testing
216216

217-
Use the `mbed unittest` command to build and run unit tests, or to generate files for new unit tests.
217+
Use the `mbed test --unittests` command to build and run unit tests, or to generate files for new unit tests.
218218

219-
Build and run unit tests with `mbed unittest`. The arguments are:
219+
Build and run unit tests with `mbed test --unittests`. The arguments are:
220220

221221
* `--compile` to only compile unit tests.
222222
* `--run` to only run unit tests.
@@ -229,46 +229,46 @@ Build and run unit tests with `mbed unittest`. The arguments are:
229229
* `--build <PATH>` to specify build directory.
230230
* `-v` or `--verbose` for verbose diagnostic output.
231231

232-
Generate files for a new unit test with `mbed unittest --new <FILE>`.
232+
Generate files for a new unit test with `mbed test --unittests --new <FILE>`.
233233

234234
### Building and running unit tests
235235

236236
You can specify to only **build** the unit tests by using the `--compile option:
237237

238238
```
239-
$ mbed unittest --compile
239+
$ mbed test --unittests --compile
240240
```
241241

242242
You can specify to only **run** the unit tests by using the `--run` option:
243243

244244
```
245-
$ mbed unittest --run
245+
$ mbed test --unittests --run
246246
```
247247

248-
If you do not specify any of these, `mbed unittest` builds all available unit tests and runs them.
248+
If you do not specify any of these, `mbed test --unittests` builds all available unit tests and runs them.
249249

250250
### Running a subset of tests
251251

252252
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:
253253

254254
```
255-
$ mbed unittest -r cellular
255+
$ mbed test --unittests -r cellular
256256
```
257257

258258
### Getting code coverage
259259

260260
You can generate a code coverage report by using the `--coverage` option. For example, to create an html report, you can specify:
261261

262262
```
263-
$ mbed unittest --coverage html
263+
$ mbed test --unittests --coverage html
264264
```
265265

266266
### Creating new unit tests
267267

268268
All unit tests are under the `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:
269269

270270
```
271-
$ mbed unittest --new rtos/Semaphore.cpp
271+
$ mbed test --unittests --new rtos/Semaphore.cpp
272272
```
273273

274274
### Troubleshooting

0 commit comments

Comments
 (0)