move system output into the testcase elements in junit xml
This commit is contained in:
@ -136,8 +136,20 @@ function JenkinsReporter(runner) {
|
|||||||
name: test.title,
|
name: test.title,
|
||||||
time: test.duration,
|
time: test.duration,
|
||||||
pass: test.state === 'passed',
|
pass: test.state === 'passed',
|
||||||
test: test
|
test: test,
|
||||||
|
stdout: stack[0].stdout,
|
||||||
|
stderr: stack[0].stderr
|
||||||
});
|
});
|
||||||
|
stack[0].stdout = stack[0].stderr = '';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
runner.on('hook end', function (hook) {
|
||||||
|
if (hook.title.indexOf('"after each"') > -1 && stack[0] && stack[0].results.length) {
|
||||||
|
var result = _.last(stack[0].results);
|
||||||
|
result.stdout += stack[0].stdout;
|
||||||
|
result.stderr += stack[0].stderr;
|
||||||
|
stack[0].stdout = stack[0].stderr = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -78,19 +78,29 @@ function makeJUnitXml(runnerName, testDetails) {
|
|||||||
type: 'TestError'
|
type: 'TestError'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
giveOutput(testcase, testInfo);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (suiteInfo.suites) {
|
if (suiteInfo.suites) {
|
||||||
_.each(suiteInfo.suites, serializeSuite);
|
_.each(suiteInfo.suites, serializeSuite);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (suiteInfo.stdout.trim()) {
|
giveOutput(suite, suiteInfo);
|
||||||
suite.ele('system-out', {}).cdata(chalk.stripColor(suiteInfo.stdout));
|
|
||||||
}
|
|
||||||
if (suiteInfo.stderr.trim()) {
|
|
||||||
suite.ele('system-err', {}).cdata(chalk.stripColor(suiteInfo.stderr));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return suites.toString({ pretty: true});
|
return suites.toString({ pretty: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function giveOutput(el, info) {
|
||||||
|
var out = info.stdout.trim();
|
||||||
|
var err = info.stderr.trim();
|
||||||
|
|
||||||
|
if (out) {
|
||||||
|
el.ele('system-out', {}).cdata(chalk.stripColor(out));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
el.ele('system-err', {}).cdata(chalk.stripColor(err));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user