Permalink
Browse files

Merge pull request #139 from paulbakker/test-reports

Fixes for junit test reports
  • Loading branch information...
2 parents be2c90c + d1a3d21 commit d42429ee0742532916c3b94a0a5a6f3fc48394bf @pkriens pkriens committed Mar 16, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 biz.aQute.junit/src/aQute/junit/JunitXmlReport.java
@@ -17,6 +17,9 @@
long startTime;
long testStartTime;
int tests = 0;
+ int failures = 0;
+ int errors = 0;
+ int skipped = 0;
PrintWriter out;
boolean finished;
boolean progress;
@@ -122,6 +125,9 @@ public void end() {
if (!finished) {
finished = true;
testsuite.addAttribute("tests", tests);
+ testsuite.addAttribute("failures", failures);
+ testsuite.addAttribute("errors", errors);
+ testsuite.addAttribute("skipped", skipped);
testsuite.addAttribute("time",
getFraction(System.currentTimeMillis() - startTime, 1000));
testsuite.addAttribute("timestamp", df.format(new Date()));
@@ -173,6 +179,8 @@ public void addError(Test test, Throwable t) {
else
testcase.addContent(error);
progress(" e");
+
+ errors++;
}
private void progress(String s) {
@@ -206,17 +214,19 @@ public void addFailure(Test test, AssertionFailedError t) {
failure.addContent(getTrace(t));
testcase.addContent(failure);
progress(" f");
+
+ failures++;
}
public void endTest(Test test) {
String[] outs = basic.getCaptured();
if (outs[0] != null) {
- Tag sysout = new Tag(testcase, "sys-out");
+ Tag sysout = new Tag(testcase, "system-out");
sysout.addContent(outs[0]);
}
if (outs[1] != null) {
- Tag sysout = new Tag(testcase, "sys-err");
+ Tag sysout = new Tag(testcase, "system-err");
sysout.addContent(outs[1]);
}

0 comments on commit d42429e

Please sign in to comment.