diff --git a/src/main/java/hudson/tasks/junit/CaseResult.java b/src/main/java/hudson/tasks/junit/CaseResult.java index 0e2ed0abe..dc52c2ca1 100644 --- a/src/main/java/hudson/tasks/junit/CaseResult.java +++ b/src/main/java/hudson/tasks/junit/CaseResult.java @@ -96,6 +96,13 @@ public class CaseResult extends TestResult implements Comparable { */ private /*final*/ int failedSince; + /** + * This test has been skipped since this build number (not id.) + * + * If {@link #isPassed() passing}, this field is left unused to 0. + */ + private int skippedSince; + private static float parseTime(Element testCase) { String time = testCase.attributeValue("time"); return new TimeToFloat(time).parse(); @@ -420,10 +427,40 @@ else if (getRun() != null) { } } + private void recomputeSkippedSinceIfNeeded() { + if (skippedSince==0 && getSkipCount()==1) { + CaseResult prev = getPreviousResult(); + if(prev!=null && prev.isSkipped()){ + this.skippedSince = prev.getSkippedSince(); + } + else if (getRun() != null) { + this.skippedSince = getRun().getNumber(); + } else { + LOGGER.warning("trouble calculating getSkippedSince. We've got prev, but no owner."); + // skippedSince will be 0, which isn't correct. + } + } + } + + /** + * If this test was skipped, then return the build number + * when this test was first skipped. + */ + @Exported(visibility=9) + public int getSkippedSince() { + // If we haven't calculated skippedSince yet, and we should, do it now. + recomputeSkippedSinceIfNeeded(); + return skippedSince; + } + public Run getFailedSinceRun() { return getRun().getParent().getBuildByNumber(getFailedSince()); } + public Run getSkippedSinceRun() { + return getRun().getParent().getBuildByNumber(getSkippedSince()); + } + /** * Gets the number of consecutive builds (including this) * that this test case has been failing. @@ -434,12 +471,14 @@ public Run getFailedSinceRun() { public int getAge() { if(isPassed()) return 0; - else if (getRun() != null) { + else if (isFailed() && getRun() != null) return getRun().getNumber()-getFailedSince()+1; + else if (isSkipped() && getRun() != null) { + return getRun().getNumber()-getSkippedSince()+1; } else { LOGGER.fine("Trying to get age of a CaseResult without an owner"); - return 0; - } + return 0; + } } /** diff --git a/src/main/java/hudson/tasks/test/MetaTabulatedResult.java b/src/main/java/hudson/tasks/test/MetaTabulatedResult.java index b4e93e3e9..4c9885fb1 100644 --- a/src/main/java/hudson/tasks/test/MetaTabulatedResult.java +++ b/src/main/java/hudson/tasks/test/MetaTabulatedResult.java @@ -1,18 +1,18 @@ /* * The MIT License - * + * * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Yahoo!, Inc. - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -25,10 +25,11 @@ import java.util.Collection; +import java.util.Collections; /** * The purpose of this class is to provide a good place for the - * jelly to bind to. + * jelly to bind to. * {@link TabulatedResult} whose immediate children * are other {@link TabulatedResult}s. * @@ -41,4 +42,11 @@ public abstract class MetaTabulatedResult extends TabulatedResult { */ public abstract Collection getFailedTests(); + /** + * All skipped tests. + */ + public Collection getSkippedTests() { + return Collections.emptyList(); + } + } diff --git a/src/main/resources/hudson/tasks/junit/CaseResult/summary.jelly b/src/main/resources/hudson/tasks/junit/CaseResult/summary.jelly index 25ce3acda..36b87e172 100644 --- a/src/main/resources/hudson/tasks/junit/CaseResult/summary.jelly +++ b/src/main/resources/hudson/tasks/junit/CaseResult/summary.jelly @@ -31,8 +31,8 @@ THE SOFTWARE. - - + +

${title} @@ -54,6 +54,7 @@ THE SOFTWARE. + diff --git a/src/main/resources/hudson/tasks/test/MetaTabulatedResult/body.jelly b/src/main/resources/hudson/tasks/test/MetaTabulatedResult/body.jelly index b99f42b29..b92907224 100644 --- a/src/main/resources/hudson/tasks/test/MetaTabulatedResult/body.jelly +++ b/src/main/resources/hudson/tasks/test/MetaTabulatedResult/body.jelly @@ -25,6 +25,44 @@ THE SOFTWARE. + + + + +

${%All Failed Tests}

@@ -95,4 +133,34 @@ THE SOFTWARE.
+ + +
${%Show all skipped tests} ${">>>"} +
+
+

${%All Skipped Tests}

+ + + + + + + + + + + + + +
${%Test Name}${%Duration}${%Age}
+ ${f.durationString} + + ${f.age} +
+
+
+ + diff --git a/src/main/resources/lib/hudson/test/failed-test.jelly b/src/main/resources/lib/hudson/test/failed-test.jelly index 78e95215e..461c46093 100644 --- a/src/main/resources/lib/hudson/test/failed-test.jelly +++ b/src/main/resources/lib/hudson/test/failed-test.jelly @@ -25,19 +25,19 @@ THE SOFTWARE. - Display link to the failed test. + Display link to the test. @since 1.538 - Path to the failed test. + Path to the test. - Failed test object + Test object - - + + @@ -95,7 +95,7 @@ THE SOFTWARE. -