Skip to content

Commit 4b1c5fe

Browse files
committed
Update README.md
Update TOC
1 parent 8f63a71 commit 4b1c5fe

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* [Mock command line examples](#mock-command-line-examples)
2222
* [Mocking example with Freescale K64F platform](#mocking-example-with-freescale-k64f-platform)
2323
* [mbed-ls unit testing](#mbed-ls-unit-testing)
24+
* [Code coverage](#code-coverage)
2425
* [Configure mbed-enabled device to work with your host](#configure-mbed-enabled-device-to-work-with-your-host)
2526
* [Windows serial port configuration](#windows-serial-port-configuration)
2627
* [Mounting with sync](#mounting-with-sync)
@@ -528,6 +529,37 @@ Ran 18 tests in 0.302s
528529
OK
529530
```
530531

532+
## Code coverage
533+
534+
We can measure code coverage for unit tests deployed together with ```mbed-ls```. To do so we can use popular Python ```coverage``` tools.
535+
First install ```coverage``` tool on your system:
536+
```
537+
$ pip install coverage --upgrade
538+
```
539+
540+
Next go to ```mbed-ls``` local directory and execute coverage for unit tests:
541+
```
542+
$ cd mbed-ls
543+
$ coverage run setup.py test
544+
```
545+
546+
Above command will execute test cases and will grab code coverage numbers. Now we are ready to print code coverage for all tests we've run:
547+
548+
```
549+
$ coverage report
550+
Name Stmts Miss Cover
551+
-----------------------------------------------------------
552+
mbed_lstools\__init__.py 2 0 100%
553+
mbed_lstools\lstools_base.py 246 169 31%
554+
mbed_lstools\lstools_darwin.py 88 77 13%
555+
mbed_lstools\lstools_linux_generic.py 148 51 66%
556+
mbed_lstools\lstools_ubuntu.py 5 0 100%
557+
mbed_lstools\lstools_win7.py 112 60 46%
558+
mbed_lstools\main.py 90 63 30%
559+
-----------------------------------------------------------
560+
TOTAL 691 420 39%
561+
```
562+
531563
# Configure mbed-enabled device to work with your host
532564

533565
## Windows serial port configuration

0 commit comments

Comments
 (0)