"Fossies" - the Fresh Open Source Software Archive

Member "opensaf-5.21.09/00-README.unittest" (31 May 2021, 1575 Bytes) of package /linux/misc/opensaf-5.21.09.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 Support for using google unit test and google mock in openSAF. Using unit test and mocking during e.g. refactoring
    2 to identify units and make code unit testable should improve the overall code quality and robustness.
    3 Regarding google unit test, see:
    4 https://code.google.com/p/googletest/
    5 
    6 To get and install google test do the following:
    7 
    8 git clone https://github.com/google/googletest.git
    9 cd googletest
   10 
   11 autoreconf -vi
   12 ./configure --with-pthreads
   13 make -j 4
   14 
   15 export GTEST_DIR=`pwd`/googletest
   16 export GMOCK_DIR=`pwd`/googlemock
   17 
   18 configure openSAF as usual, for example:
   19 ./bootstrap.ch
   20 ./configure CFLAGS="-DRUNASROOT -O2" CXXFLAGS="-DRUNASROOT -O2" --enable-tipc
   21 
   22 make -j 4
   23 
   24 To build and run the unit tests
   25 make check
   26 
   27 A unit test report will be written on the console. Unit test logs etc. can be found under the tests directory.
   28 
   29 Gtest unit test code to be placed at each service under service/saf/"service"/tests, example:
   30 
   31 services/saf/amf/
   32 ├── amfd
   33 │   ├── include
   34 │   ├── scripts
   35 │   └── tests
   36 ├── amfnd
   37 │   ├── include
   38 │   ├── scripts
   39 │   └── tests
   40 ├── amfwdog
   41 │   ├── scripts
   42 │   └── tests
   43 └── config
   44 
   45 The test code to have the following naming convention as below:
   46 tests will be in file xxxx_test.cc, where xxxx is the name of the unit test case,
   47 mocks will be in file mock_xxxx.cc, where xxxx is the name of the mock.
   48 No need to call the RUN_ALL_TESTS() macro, it is included in gtest_main and gmock_main
   49 and are automatically linked with the unit test cases.
   50 
   51 
   52