diff --git a/core/src/main/java/hudson/tasks/junit/CaseResult.java b/core/src/main/java/hudson/tasks/junit/CaseResult.java index 6d26431fc3..9a034a9811 100644 --- a/core/src/main/java/hudson/tasks/junit/CaseResult.java +++ b/core/src/main/java/hudson/tasks/junit/CaseResult.java @@ -47,6 +47,15 @@ public final class CaseResult extends TestObject implements Comparable + * Depending on the tool that produced the XML report, this method works somewhat inconsistently. + * With some tools (such as Maven surefire plugin), you get the accurate information, that is + * the stdout from this test case. With some other tools (such as the JUnit task in Ant), this + * method returns the stdout produced by the entire test suite. + * + *

+ * If you need to know which is the case, compare this output from {@link SuiteResult#getStdout()}. + * @since 1.294 + */ + @Exported + public String getStdout() { + if(stdout!=null) return stdout; + return getParent().getStdout(); + } + + /** + * The stderr of this test. + * + * @see #getStdout() + * @since 1.294 + */ + @Exported + public String getStderr() { + if(stderr!=null) return stderr; + return getParent().getStderr(); + } + @Override public CaseResult getPreviousResult() { SuiteResult pr = parent.getPreviousResult(); diff --git a/core/src/main/java/hudson/tasks/junit/SuiteResult.java b/core/src/main/java/hudson/tasks/junit/SuiteResult.java index a926752b92..76411b5897 100644 --- a/core/src/main/java/hudson/tasks/junit/SuiteResult.java +++ b/core/src/main/java/hudson/tasks/junit/SuiteResult.java @@ -143,7 +143,7 @@ public final class SuiteResult implements Serializable { // one wants to use @name from , // the other wants to use @classname from . - addCase(new CaseResult(this,classname,e)); + addCase(new CaseResult(this, e, classname)); } } @@ -163,11 +163,10 @@ public final class SuiteResult implements Serializable { } /** - * The stdout of this test. Note that due to the design of the format, - * stdout for the entire {@link SuiteResult} is reported, - * and Hudson cannot tell what portion of the output corresponds to this test. + * The stdout of this test. * * @since 1.281 + * @see CaseResult#getStdout() */ @Exported public String getStdout() { @@ -175,11 +174,10 @@ public final class SuiteResult implements Serializable { } /** - * The stderr of this test. Note that due to the design of the format, - * stdout for the entire {@link SuiteResult} is reported, - * and Hudson cannot tell what portion of the output corresponds to this test. - * + * The stderr of this test. + * * @since 1.281 + * @see CaseResult#getStderr() */ @Exported public String getStderr() { diff --git a/core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly b/core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly index b24704d294..274bbb6668 100644 --- a/core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly +++ b/core/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly @@ -66,14 +66,14 @@ THE SOFTWARE.

${%Stacktrace}

- +

${%Standard Output}

-
+
- +

${%Standard Error}

-
+