Permalink
Browse files

- improve the jenkins test runner with time infromation

  • Loading branch information...
1 parent b7ee9f0 commit e2d814fb81610a6d533d3ff53f0646baeb7cf8c8 @renggli renggli committed Oct 8, 2012
Showing with 19 additions and 21 deletions.
  1. +19 −21 test/all_tests_jenkins.dart
@@ -13,34 +13,32 @@ void main() {
class JenkinsConfiguration extends Configuration {
- bool printed = false;
-
void onStart() {
- // nothing to do
+ print('<?xml version="1.0" encoding="UTF-8" ?>');
}
void onDone(int passed, int failed, int errors, List<TestCase> results, String uncaughtError) {
- if (!printed) {
- print('<?xml version="1.0" encoding="UTF-8" ?>');
- print('<testsuite name="All tests" tests="${results.length}" failures="$failed" errors="$errors">');
- for (var testcase in results) {
- print(' <testcase name="${_xml(testcase.description)}">');
- if (testcase.result == 'fail') {
- print(' <failure>${_xml(testcase.message)}</failure>');
- } else if (testcase.result == 'error') {
- print(' <error>${_xml(testcase.message)}</error>');
- }
- if (testcase.stackTrace != null && testcase.stackTrace != '') {
- print(' <system-err>${_xml(testcase.stackTrace)}</system-err>');
- }
- print(' </testcase>');
+ var totalTime = 0;
+ for (var testcase in results) {
+ totalTime += testcase.runningTime.inMilliseconds;
+ }
+ print('<testsuite name="All tests" tests="${results.length}" failures="$failed" errors="$errors" time="${totalTime / 1000.0}" timestamp="${new Date.now()}">');
+ for (var testcase in results) {
+ print(' <testcase id="${testcase.id}" name="${_xml(testcase.description)}" time="${testcase.runningTime.inMilliseconds / 1000.0}"> ');
+ if (testcase.result == 'fail') {
+ print(' <failure>${_xml(testcase.message)}</failure>');
+ } else if (testcase.result == 'error') {
+ print(' <error>${_xml(testcase.message)}</error>');
}
- if (uncaughtError != null && uncaughtError != '') {
- print(' <system-err>${_xml(uncaughtError)}</system-err>');
+ if (testcase.stackTrace != null && testcase.stackTrace != '') {
+ print(' <system-err>${_xml(testcase.stackTrace)}</system-err>');
}
- print('</testsuite>');
- printed = true;
+ print(' </testcase>');
+ }
+ if (uncaughtError != null && uncaughtError != '') {
+ print(' <system-err>${_xml(uncaughtError)}</system-err>');
}
+ print('</testsuite>');
}
String _xml(String string) {

0 comments on commit e2d814f

Please sign in to comment.