You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build-systems.md
+45Lines changed: 45 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,50 @@
1
1
# Integration with build systems
2
2
3
+
Build Systems may refer to low-level tools, like CMake, or larger systems that run on servers, like Jenkins or TeamCity. This page will talk about both.
4
+
5
+
# Continuous Integration systems
6
+
7
+
Probably the most important aspect to using Catch with a build server is the use of different reporters. Catch comes bundled with three reporters that should cover the majority of build servers out there - although adding more for better integration with some is always a possibility (as has been done with TeamCity).
8
+
9
+
Two of these reporters are built in (XML and JUnit) and the third (TeamCity) is included as a separate header. It's possible that the other two may be split out in the future too - as that would make the core of Catch smaller for those that don't need them.
10
+
11
+
## XML Reporter
12
+
```-r xml```
13
+
14
+
The XML Reporter writes in an XML format that is specific to Catch.
15
+
16
+
The advantage of this format is that it corresponds well to the way Catch works (especially the more unusual features, such as nested sections) and is a fully streaming format - that is it writes output as it goes, without having to store up all its results before it can start writing.
17
+
18
+
The disadvantage is that, being specific to Catch, no existing build servers understand the format natively. It can be used as input to an XSLT transformation that could covert it to, say, HTML - although this loses the streaming advantage, of course.
19
+
20
+
## JUnit Reporter
21
+
```-r junit```
22
+
23
+
The JUnit Reporter writes in an XML format that mimics the JUnit ANT schema.
24
+
25
+
The advantage of this format is that the JUnit Ant schema is widely understood by most build servers and so can usually be consumed with no additional work.
26
+
27
+
The disadvantage is that this schema was designed to correspond to how JUnit works - and there is a significant mismatch with how Catch works. Additionally the format is not streamable (because opening elements hold counts of failed and passing tests as attributes) - so the whole test run must complete before it can be written.
28
+
29
+
## TeamCity Reporter
30
+
```-r teamcity```
31
+
32
+
The TeamCity Reporter writes TeamCity service messages to stdout. In order to be able to use this reporter an additional header must also be included.
33
+
34
+
```catch_reporter_teamcity.hpp``` can be found in the ```include\reporters``` directory. It should be included in the same file that ```#define```s ```CATCH_CONFIG_MAIN``` or ```CATCH_CONFIG_RUNNER```. The ```#include``` should be placed after ```#include```ing Catch itself.
35
+
36
+
e.g.:
37
+
38
+
```
39
+
#define CATCH_CONFIG_MAIN
40
+
#include "catch.hpp"
41
+
#include "catch_reporter_teamcity.hpp"
42
+
```
43
+
44
+
Being specific to TeamCity this is the best reporter to use with it - but it is completely unsuitable for any other purpose. It is a streaming format (it writes as it goes) - although test results don't appear in the TeamCity interface until the completion of a suite (usually the whole test run).
45
+
46
+
# Low-level tools
47
+
3
48
## CMake
4
49
5
50
You can use the following CMake script to automatically fetch Catch from github and configure it as an external project:
0 commit comments