User Tools

Site Tools


for_developers:testing

Testing

We use Google Test as our test framework. Read https://github.com/google/googletest/blob/master/googletest/docs/Primer.md to understand how to use the available macros for defining test cases.

Naming

All the tests must be named in the following manner.

TEST(testName, testMethodName) { ... }

testName should include the name of the package, e.g. controlDeMuxBlock or safetyEventTest. This allows for running only the tests in a certain package. testMethodName can be any meaningful name to identify the test method.

Running the Tests

Navigate to the directory test of the build directory of eeros and run the tests as follows.:

$ ./unitTests  --library sim                  // run all the tests using the simulator as hal
$ ./unitTests  -lib sim                       // run all the tests using the simulator, short option
$ ./unitTests  -lib flink                     // run all the tests using flink, short option
$ ./unitTests  -lib comedi                    // run all the tests using comedi, short option
$ ./unitTests  --gtest_filter=control*        // run all the tests in control
$ ./unitTests  --gtest_filter=math*           // run all the tests in math
$ ./unitTests  --gtest_filter=mathMatrix*     // run all the tests in math/Matrix
$ ./unitTests  --gtest_filter=-hal*           // run all the tests without hal
$ ./unitTests  -lib sim --gtest_filter=hal*   // run all the tests in hal using the simulator
for_developers/testing.txt · Last modified: 2017/05/26 08:44 (external edit)