-
Notifications
You must be signed in to change notification settings - Fork 362
/
Copy pathxunit.rnc
113 lines (96 loc) · 3.51 KB
/
xunit.rnc
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#
# The following is a grammar in Relax NG Compact syntax for
# JUnit-compatible report files which sonar-cxx is able to import.
# Many test frameworks are able to generate output which is JUnit-compatible
# or at least, 'JUnit-inspirated'. The following grammar
# combines the flavors implemented by JUnit itself and Googletest.
#
# It can be used to validate xunit-reports, i.e. to determine, if
# a report is valid according to the expectations of sonar-cxx.
# It can be done as follows:
#
# $ rnv xunit.rnc <your xml report>
#
# rnv is a XML validator which can be obtained here:
# http://www.davidashen.net/rnv.html
#
start = TestSuites
TestSuites = element testsuites {
# The following attributes are accepted but ignored, thus 'optional'
attribute tests { text } ?,
attribute failures { text } ?,
attribute disabled { text } ?,
attribute errors { text } ?,
attribute time { text } ?,
attribute name { text } ?,
attribute ignored { text } ?,
TestSuite*
}
# The output from a single testsuite. The way how testcases are
# composed into testsuites is framework dependend.
TestSuite = element testsuite {
attribute name { text },
# This is our extension which helps to locate test resources. If
# present, the value of this attribute is interpreted as path to
# the source file which contains the testcases inside this
# testsuite.
#
attribute filename { text }?,
# The following attributes are accepted but ignored, thus 'optional'
attribute tests { text } ?,
attribute failures { text } ?,
attribute disabled { text } ?,
attribute errors { text } ?,
attribute time { text } ?,
attribute skipped { text } ?,
# Defined properties (name-value pairs) at test execution.
# Ignored by the plugin, thus optional.
element properties {
element property {
attribute name { text },
attribute value { text }
}+
}?,
(TestSuite* | TestCase*)
}
TestCase = element testcase {
# Name of the testcase which is displayed in the UI.
attribute name { text },
# The value of the classname attribute varies quite a lot across test frameworks.
# supported: unqualified classname or classname
# qualified name: ((namespacename|structname|classname)::)*(namespacename|structname|classname)
attribute classname { text },
# Execution time of the testcase in ms. Is parsed and passed to SQ.
attribute time { text },
# If present, the value of this attribute is interpreted as path to
# the source file which contains the testcases
# (supersede the filename of the testsuite).
#
attribute filename { text }?,
# Status is evaluated optionally: googletest marks skipped tests
# with status="notrun"
attribute status { text }?,
# Test failed
# Indicates that the test failed. A failure is a test which
# the code has explicitly failed by using the mechanisms for
# that purpose. For example via an assertEquals.
( element failure {
attribute message { text },
attribute type { text } ?,
text
# Test errored
# Indicates that the test errored. An errored test is one
# that had an unanticipated problem. For example an unchecked
# throwable or a problem with the implementation of the test.
} | element error {
attribute message { text },
attribute type { text } ?,
text
# Test was skipped (JUnit-style)
} | element skipped {
attribute message { text } ?,
attribute type { text } ?,
text?
# Test was successfull
} | empty )
}