User Tools

Site Tools


for_developers:testing

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
for_developers:testing [2017/05/24 10:32] graffor_developers:testing [2020/07/02 12:00] – [Running the Tests] ursgraf
Line 1: Line 1:
 ====== Testing ====== ====== Testing ======
-We use [[https://github.com/google/googletest|Google Test]] as our test framework.+We use [[https://github.com/google/googletest|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. 
 +<code cpp> 
 +TEST(testName, testMethodName) { ... } 
 +</code> 
 +''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 ===== 
 +Make sure to compile the unit tests with the cmake argument ''-DUSE_TESTS=TRUE''. Navigate to the directory ''test'' of the build directory of eeros and run the tests as follows.:  
 +<code cpp> 
 +$ ./unitTests  --library sim                  // run all the tests using the simulator as hal 
 +$ ./unitTests  -l sim                         // run all the tests using the simulator, short option 
 +$ ./unitTests  -l flink                       // run all the tests using flink, short option 
 +$ ./unitTests  -l 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  -l sim --gtest_filter=hal*     // run all the tests in hal using the simulator 
 +</code> 
 + 
 +For the test with the HAL you need to install the [[getting_started:install_wrapper#simulator|]] and set the library path (see [[getting_started:deploy|]]) so that the simulator library can be found. 
for_developers/testing.txt · Last modified: 2021/05/25 14:11 by ursgraf