@@ -69,6 +69,10 @@ void XmlJoiner::processFile(const QString absolutePath)
69
69
}
70
70
else if (xml.name () == " failure" )
71
71
{
72
+ processTestFailureAttrs (xml.attributes ());
73
+ xml.readNext ();
74
+ Q_ASSERT (xml.isCDATA ());
75
+ processTestCDataAttrs (xml.text ());
72
76
}
73
77
}
74
78
}
@@ -86,6 +90,9 @@ void XmlJoiner::processTestSuiteAttrs(const QXmlStreamAttributes attrs)
86
90
attrs.value (" tests" ).toString ().toInt (),
87
91
attrs.value (" failures" ).toString ().toInt (),
88
92
attrs.value (" errors" ).toString ().toInt ());
93
+
94
+ // / \todo set "disabled" field
95
+ // / \todo set "time" field
89
96
_suites.push_back (suite);
90
97
}
91
98
@@ -107,6 +114,18 @@ void XmlJoiner::processTestCaseAttrs(const QXmlStreamAttributes attrs)
107
114
suite->_cases .push_back (testCase);
108
115
}
109
116
117
+ void XmlJoiner::processTestFailureAttrs (const QXmlStreamAttributes attrs)
118
+ {
119
+ TestCase *testCase = _suites.back ()->_cases .back ();
120
+ testCase->_failureMsg = attrs.value (" message" ).toString ();
121
+ }
122
+
123
+ void XmlJoiner::processTestCDataAttrs (const QStringRef text)
124
+ {
125
+ TestCase *testCase = _suites.back ()->_cases .back ();
126
+ testCase->_cDATA .append (text);
127
+ }
128
+
110
129
void XmlJoiner::writeOutput (const QString pathFile)
111
130
{
112
131
QFile outFile (pathFile);
@@ -150,12 +169,22 @@ void XmlJoiner::outputXmlElements(QXmlStreamWriter &writer)
150
169
writer.writeAttribute (" failures" , QString::number (testSuite->_failures ));
151
170
writer.writeAttribute (" errors" , QString::number (testSuite->_errors ));
152
171
153
- foreach (const auto testCase, testSuite->_cases )
172
+ for (const auto & testCase: testSuite->_cases )
154
173
{
155
174
writer.writeStartElement (" testcase" );
156
175
writer.writeAttribute (" name" , testCase->_name );
157
176
writer.writeAttribute (" status" , testCase->_valid );
158
177
writer.writeAttribute (" classname" , testSuite->_name );
178
+
179
+ if (testCase->_failureMsg .isEmpty () == false )
180
+ {
181
+ writer.writeStartElement (" failure" );
182
+ writer.writeAttribute (" message" , testCase->_failureMsg );
183
+ writer.writeAttribute (" type" , " " );
184
+ writer.writeCDATA (testCase->_cDATA );
185
+ writer.writeEndElement ();
186
+ }
187
+
159
188
writer.writeEndElement ();
160
189
}
161
190
0 commit comments