development:lifecycle-process:processes:sw-dev-process:unit-tests:lib-ebeecomm

The one header framework DOCTEST is used. Documentation can be found here: https://github.com/doctest/doctest/blob/master/doc/markdown/readme.md

Some tests are already integrated it into our META projects: * `make run-unit-tests` can be used to let run all unit tests incl. libebee_common ones. * `make run-unit-tests UNITTEST_TEST=libebee_common` can be used to run libebee_common ones only

Unit tests of libebee_common can easily be built and executed by executing the script build-unit-tests.sh. By default the script builds the unit test program tests for the host. You may directly execute tests. It is also possible to instruct build-unit-tests.sh to automatically execute tests after successful build by specifying option “-e”.

By default the host test application is built with sanitizers (address, undefined behaviour). This may conflict with tools like valgrind. Building without sanitizers can be enforced by using option “-n”. More options are available. Please run “build-unit-tests.sh -h” to get the full list of options.

On host the execution of the test application also generates coverage information. When specifying the option “-c” the test application will be built and executed. In case of successful execution the coverage information gets processed by lcov and rendered into html into the “coverage” directory. Open “coverage/index.html” in Your favorite browser. This happens automatically in case the environment variable BROWSER is set to the browser executable. Please note, that the lcov package need to be installed on the host for this.

Unit tests for a certain component can be added to the corresponding directory under directory unit_tests, i.e. tests for functions in “string/util.c” are located in “unit_tests/string/tests_util.cpp”.

New components need to be added to the variable LIBS in file “unit_tests.mk”.

The unit test application uses doctest as test framework. Please read the documentation https://github.com/doctest/doctest#documentation and take a look at the existing unit tests on how to use it.

  • development/lifecycle-process/processes/sw-dev-process/unit-tests/lib-ebeecomm.txt
  • Last modified: 2022/11/08 16:36
  • by gianpietro-battistutti