|
| 1 | +# 2. Define initial testing infrastructure |
| 2 | + |
| 3 | +Date: 2020-10-28 |
| 4 | + |
| 5 | +## Status |
| 6 | + |
| 7 | +Accepted |
| 8 | + |
| 9 | +## Context |
| 10 | + |
| 11 | +To raise the quality of the example maintained in this repository, contributors |
| 12 | +need a testing infrastructure available to validate new services proposed, |
| 13 | +extensions or bug fixes. |
| 14 | + |
| 15 | +### Unit testing |
| 16 | + |
| 17 | +Unit tests are isolated from the system and should run on desktop machines |
| 18 | +(Linux, MacOS, Windows). |
| 19 | +The unit tests will rely on mock and stub of BLE API, the test framework selected |
| 20 | +must support declaration of these kind of objects. |
| 21 | + |
| 22 | +Many C++ unit test framework are available (CppUTest, Catch2, Boost.test, |
| 23 | +google-test, ...) all with their qualities and weaknesses. |
| 24 | +Due to the use of google test in [Mbed OS](https://github.com/ARMmbed/mbed-os/tree/master/UNITTESTS) |
| 25 | +we propose to use google-test to unit test Bluetooth services. |
| 26 | + |
| 27 | +### CI integration |
| 28 | + |
| 29 | +To validate new submissions, it is important to exercise them automatically. |
| 30 | +Many CI providers exists for open source project (Circle CI, travis, ...). |
| 31 | +We propose to use Circle CI as it is used to compile ble-example and ble-testsuite |
| 32 | +submissions. It is easy to setup and approved by the ARMmbed organisation |
| 33 | + |
| 34 | +### Compilers |
| 35 | + |
| 36 | +GCC and Clang are both available to all machines targeted. |
| 37 | +We propose to use Clang as it provides better messages in case of compilation failure. |
| 38 | + |
| 39 | +### Code coverage |
| 40 | + |
| 41 | +To ensure tests submitted cover sufficciently the code submitted we propose to use the |
| 42 | +code coverage solution offered by the selected compiler (Clang). |
| 43 | + |
| 44 | +### Integration tests |
| 45 | + |
| 46 | +There is no definitive pattern for integration test of Bluetooth services. |
| 47 | +This should be described and defined in a subsequent architecture decision when consensus has emerged. |
| 48 | + |
| 49 | + |
| 50 | +## Decision |
| 51 | + |
| 52 | +We will use `google test` to unit test services proposed. The tests will be compiled |
| 53 | +with `Clang` and will generate a code coverage report when run. |
| 54 | +For pull request validation, the code and test suite will be compiled and run by `Circle CI`. |
| 55 | +Depending on results and code coverage, the submission will be rejected. |
| 56 | + |
| 57 | +## Consequences |
| 58 | + |
| 59 | +The base of the test infrastructure should be created, it must be based on google test, |
| 60 | +be compiled with clang run in Circle CI. |
0 commit comments