Outputting additional information into the JUnit XML
Since it is available and seems to be desired by the JUnit spec [ http://stackoverflow.com/questions/4922867/junit-xml-format-specification-that-hudson-supports ]
This commit is contained in:
parent
8e85e593bd
commit
ef8f191c46
@ -42,16 +42,17 @@
|
||||
function(expectation)
|
||||
{
|
||||
if (!expectation.passed()) {
|
||||
failureMessages.push((failureMessages.length + 1) + ': ' + expectation.message);
|
||||
failureMessages.push(expectation.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
return {
|
||||
assertions: spec.results().items_.length,
|
||||
className: getNestedSuiteName(spec.suite),
|
||||
name: spec.description,
|
||||
time: spec.duration / 1000,
|
||||
failureMessage: failureMessages.join(' ')
|
||||
failureMessages: failureMessages
|
||||
};
|
||||
}
|
||||
)
|
||||
|
@ -209,36 +209,37 @@
|
||||
function(suite)
|
||||
{
|
||||
var failures = 0,
|
||||
data = {
|
||||
name: getNestedSuiteName(suite),
|
||||
time: suite.duration / 1000,
|
||||
timestamp: suite.timestamp,
|
||||
tests: suite.specs().length,
|
||||
errors: 0, // TODO: These exist in the JUnit XML but not sure how they map to jasmine things
|
||||
testcases: suite.specs().map(
|
||||
function(spec)
|
||||
{
|
||||
var failureMessages = [];
|
||||
if (spec.results().failedCount) {
|
||||
failures ++;
|
||||
spec.results().items_.forEach(
|
||||
function(expectation)
|
||||
{
|
||||
if (!expectation.passed()) {
|
||||
failureMessages.push((failureMessages.length + 1) + ': ' + expectation.message);
|
||||
}
|
||||
data = {
|
||||
name: getNestedSuiteName(suite),
|
||||
time: suite.duration / 1000,
|
||||
timestamp: suite.timestamp,
|
||||
tests: suite.specs().length,
|
||||
errors: 0, // TODO: These exist in the JUnit XML but not sure how they map to jasmine things
|
||||
testcases: suite.specs().map(
|
||||
function(spec)
|
||||
{
|
||||
var failureMessages = [];
|
||||
if (spec.results().failedCount) {
|
||||
failures ++;
|
||||
spec.results().items_.forEach(
|
||||
function(expectation)
|
||||
{
|
||||
if (!expectation.passed()) {
|
||||
failureMessages.push(expectation.message);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
return {
|
||||
className: getNestedSuiteName(spec.suite),
|
||||
name: spec.description,
|
||||
time: spec.duration / 1000,
|
||||
failureMessage: failureMessages.join(' ')
|
||||
};
|
||||
}
|
||||
)
|
||||
};
|
||||
return {
|
||||
assertions: spec.results().items_.length,
|
||||
className: getNestedSuiteName(spec.suite),
|
||||
name: spec.description,
|
||||
time: spec.duration / 1000,
|
||||
failureMessages: failureMessages
|
||||
};
|
||||
}
|
||||
)
|
||||
};
|
||||
data.failures = failures;
|
||||
return data;
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
<% testsuites.forEach(function(testsuite) { %>
|
||||
<testsuite name="<%- testsuite.name %>" errors="<%= testsuite.errors %>" tests="<%= testsuite.tests %>" failures="<%= testsuite.failures %>" time="<%= testsuite.time %>" timestamp="<%= testsuite.timestamp %>">
|
||||
<% testsuite.testcases.forEach(function(testcase) { %>
|
||||
<testcase classname="<%- testcase.classname %>" name="<%- testcase.name %>" time="<%= testcase.time %>">
|
||||
<% if (testcase.failureMessage) { %>
|
||||
<failure><%= testcase.failureMessage %></failure>
|
||||
<% } %>
|
||||
<testcase assertions="<%= testcase.assertions %>" classname="<%- testcase.classname %>" name="<%- testcase.name %>" time="<%= testcase.time %>">
|
||||
<% testcase.failureMessages.forEach(function(message) { %>
|
||||
<failure><%= message %></failure>
|
||||
<% }) %>
|
||||
</testcase>
|
||||
<% }) %>
|
||||
</testsuite>
|
||||
|
Loading…
Reference in New Issue
Block a user