• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

config/H03-May-2022-1,2861,101

content/H03-May-2022-1812

core/H03-May-2022-993763

database/H03-May-2022-472293

mock/H30-Sep-2021-138109

scripting/H03-May-2022-3,2072,402

util/H03-May-2022-567397

README.mdH A D30-Sep-20211.6 KiB6945

README.md

1# Gerbera Test
2
3This file outlines how the Gerbera system uses the **GoogleTest**
4framework to provide unit testing for the C++ code-base.
5
6## Required Software
7
8- CMake ^3.9
9- GoogleTest
10
11## Enable Testing
12
13The CMake build enables testing using the `WITH_TESTS` flag
14
15```text
16$ cmake ../gerbera -DWITH_TESTS=1
17```
18
19## Running All Tests
20
21Build the project and run all the tests
22
23```
24$ make && make test
25```
26
27The tests output looks similar to below:
28
29```
30Running tests...
31Test project /development/gerbera/build
32    Start 1: testdictionary
331/2 Test #1: testdictionary ...................   Passed    0.02 sec
34    Start 2: testruntime
352/2 Test #2: testruntime ......................   Passed    0.02 sec
36
37100% tests passed, 0 tests failed out of 2
38
39Total Test time (real) =   0.05 sec
40
41```
42
43## Running Specific Test
44
45You can run specific tests by using `ctest`. Below is an example of running the
46**testdictionary** test only.
47
48
49```
50$ ctest -R testdictionary
51Test project /development/gerbera/build
52    Start 1: testdictionary
531/1 Test #1: testdictionary ...................   Passed    0.02 sec
54
55100% tests passed, 0 tests failed out of 1
56
57Total Test time (real) =   0.03 sec
58```
59
60## Creating a New Test
61
62Adding a new test to Gerbera is easy.  The process amounts to a few steps:
63
641. Create a new feature test folder similar to `/test/test_myfeature`
652. Create `CMakeLists.txt` within your new folder.
663. Create a `main.cc` Google Test file
674. Add your files to your `CMakeLists.txt` within your `/test/test_myfeature` folder
684. Add sub-directory `test_myfeature` to the parent `/test/CMakeLists.txt` file
69