提交 2472b1d8 编写于 作者: K kohsuke

fixed #174. also improved the test result summary display.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1358 71c3de6d-444a-0410-be80-ed276b4c234a
上级 6a2dad38
...@@ -8,6 +8,7 @@ import hudson.util.ChartUtil; ...@@ -8,6 +8,7 @@ import hudson.util.ChartUtil;
import hudson.util.DataSetBuilder; import hudson.util.DataSetBuilder;
import hudson.util.ShiftedCategoryAxis; import hudson.util.ShiftedCategoryAxis;
import hudson.util.ColorPalette; import hudson.util.ColorPalette;
import hudson.Functions;
import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart; import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.CategoryAxis;
...@@ -51,6 +52,16 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio ...@@ -51,6 +52,16 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
*/ */
public abstract int getTotalCount(); public abstract int getTotalCount();
/**
* Gets the diff string of failures.
*/
public final String getFailureDiffString() {
T prev = getPreviousResult();
if(prev==null) return ""; // no record
return " / "+Functions.getDiffString(this.getFailCount()-prev.getFailCount());
}
public String getDisplayName() { public String getDisplayName() {
return "Test Result"; return "Test Result";
} }
...@@ -63,6 +74,9 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio ...@@ -63,6 +74,9 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
return "clipboard.gif"; return "clipboard.gif";
} }
/**
* Gets the test result of the previous build, if it's recorded, or null.
*/
public T getPreviousResult() { public T getPreviousResult() {
return (T)getPreviousResult(getClass()); return (T)getPreviousResult(getClass());
} }
......
...@@ -33,14 +33,17 @@ ...@@ -33,14 +33,17 @@
<t:summary icon="clipboard.gif"> <t:summary icon="clipboard.gif">
<a href="testReport/">Latest Test Result</a> <a href="testReport/">Latest Test Result</a>
<j:choose> <j:choose>
<j:when test="${tr.totalCount==0}">
(no tests)
</j:when>
<j:when test="${tr.failCount==0}"> <j:when test="${tr.failCount==0}">
(no failures) (no failures)
</j:when> </j:when>
<j:when test="${tr.failCount==1}"> <j:when test="${tr.failCount==1}">
(1 failure) (1 failure ${tr.failureDiffString})
</j:when> </j:when>
<j:otherwise> <j:otherwise>
(${tr.failCount} failures) (${tr.failCount} failures ${tr.failureDiffString})
</j:otherwise> </j:otherwise>
</j:choose> </j:choose>
</t:summary> </t:summary>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册