forked from biancini/boost.test-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
84 lines (56 loc) · 2.64 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
========================================================================
Introduction
========================================================================
This project includes simple samples illustrating basic use of
Boost.Test:
http://www.boost.org/doc/libs/1_38_0/libs/test/doc/html/index.html
The samples accompany the tutorial on alittlemadness.com:
http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/
========================================================================
Prerequisites
========================================================================
The samples assume a Un*x-like environment, and also require:
- a GNU-compatible make (for building)
- Boost 1.38.0 (possibly later versions, but they are not tested),
installed in the system include and library paths.
========================================================================
Building and Running
========================================================================
To build the samples, run make:
$ make
This creates five binaries, one for each test sample file. To
actually run the tests, use the `test' target:
$ make test
This will execute all of the binaries with arguments to make them
produce XML output, captured into report-*.xml files.
$ make coverage
This will execute all coverage tests and produce the relative reports.
Each file will have his own coverage report, but some overall report
is also generated (in coverage.info and in coverage-report.xml).
These overall reports are then used to populate a web interface that
shows coverage stas (on /var/www/html/coverage, folder that can be exported
by apache) with the command:
$ make coverage-html
When you're done, your can remove all built files by cleaning:
$ make clean
========================================================================
Samples
========================================================================
hello.cpp:
A "Hello, World"-style example: the simplest test case.
assertions.cpp:
Illustrates a higher-level assertion, of which there are several.
suites.cpp:
Illustrates the simplest way to group test cases into larger suites.
fixtures.cpp:
Illustrates how to apply common setup and teardown code to multiple
cases by using a fixture.
main.cpp:
An all-in-one sample that shows various Boost.Test features.
==================================
========================================================================
Integrating with Sonarqube
========================================================================
The resutls produced can be integrated in SonarQube using the Cxx plugin
freely availabe for community use here:
https://github.com/wenns/sonar-cxx