Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions src/main/java/hudson/plugins/robot/model/RobotCaseResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

private RobotSuiteResult parent;
private int failedSince;
private int skippedSince;

/**
* Difference between string timevalues in format yyyyMMdd HH:mm:ss.SS (Java DateFormat).
Expand Down Expand Up @@ -232,41 +233,69 @@
return failedSince;
}

public int getSkippedSince() {
if (skippedSince == 0 && isSkipped()) {
RobotCaseResult previous = getPreviousResult();
if(previous != null && previous.isSkipped())
this.skippedSince = previous.getSkippedSince();
else if (getOwner() != null) {
this.skippedSince = getOwner().getNumber();
} else {
LOGGER.warn("trouble calculating getSkippedSince. We've got prev, but no owner.");
}
}
return skippedSince;
}

public void setSkippedSince(int skippedSince) {
this.skippedSince = skippedSince;
}

public void setFailedSince(int failedSince) {
this.failedSince = failedSince;
}

/**
* Gives the corresponding caseresult from previous build
* @return Previous result
*/
public RobotCaseResult getPreviousResult(){
if (parent == null) return null;
RobotSuiteResult prevParent = parent.getPreviousResult();
if(prevParent == null) return null;
RobotCaseResult result = prevParent.getCase(getDuplicateSafeName());
if (result==null)
result = prevParent.getCase(getOldFormatName());
return result;
}

/**
* Gives the run that this case first failed in
* @return run object
*/
public Run<?,?> getFailedSinceRun() {
return getOwner().getParent().getBuildByNumber(getFailedSince());
}

/**
* Get the number of builds this test case has failed for
* Gives the run that this case first skipped in
* @return run object
*/
public Run<?,?> getSkippedSinceRun() {
return getOwner().getParent().getBuildByNumber(getSkippedSince());

Check warning on line 285 in src/main/java/hudson/plugins/robot/model/RobotCaseResult.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 237-285 are not covered by tests
}

/**
* Get the number of builds this test case has failed/skipped for
* @return number of builds
*/
public int getAge(){
if(isPassed()) return 0;
Run<?,?> owner = getOwner();
if(owner != null)
return getOwner().getNumber() - getFailedSince() + 1;
if(owner != null) {

Check warning on line 295 in src/main/java/hudson/plugins/robot/model/RobotCaseResult.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 295 is only partially covered, one branch is missing
int previousStatusBuild = isSkipped() ? getSkippedSince() : getFailedSince();

Check warning on line 296 in src/main/java/hudson/plugins/robot/model/RobotCaseResult.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 296 is only partially covered, one branch is missing
return getOwner().getNumber() - previousStatusBuild + 1;
}
else return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ limitations under the License.
<div style="margin-bottom=20px;">
<u:failedCases />
</div>
<div style="margin-bottom=20px;">
<u:skippedCases />
</div>

<h2>Test Suites</h2>
<table class="pane sortable">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ limitations under the License.
<div style="margin-bottom=20px;">
<u:failedCases />
</div>
<div style="margin-bottom=20px;">
<u:skippedCases />
</div>
<h2>Nested Test Suites</h2>
<table class="pane sortable">
<tr>
Expand Down
45 changes: 45 additions & 0 deletions src/main/resources/hudson/plugins/robot/util/skippedCases.jelly
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:u="/util">
<script src="${rootURL}/plugin/robot/robot.js"/>
<j:if test="${!it.allSkippedCases.isEmpty()}">
<style>
td.pane {
vertical-align: top;
}
</style>
<h2>Skipped Test Cases</h2>
<table class="pane sortable">
<tr>
<td class="pane-header" title="Test case name. Click to sort.">Name</td>
<td class="pane-header" title="Duration. Click to sort.">Duration</td>
<td class="pane-header" style="text-align:center;" title="Number of skipped builds. Click to sort.">Age</td>
</tr>
<j:forEach var="case" items="${it.allSkippedCases}">
<j:set var="fullName" value="${case.getRelativePackageName(it)}" />
<j:set var="relativeId" value="${case.getRelativeId(it)}" />
<j:set var="escapedName" value="${h.escape(fullName)}" />
<tr>
<td class="pane">
<a id="${escapedName}-showlink" href="#" class="robot-expand" data-escaped-name="${escapedName}" data-relative-id="${relativeId}/summary"></a>
<a id="${escapedName}-hidelink" href="#" style="display:none" class="robot-collapse" data-escaped-name="${escapedName}"></a>
<st:nbsp/>
<a href="${relativeId}"><small>${case.getRelativeParent(it)}</small>${case.name}</a>
<div id="${escapedName}" class="hidden" style="display:none">
${%Loading...}
</div>
</td>
<td class="pane">${case.humanReadableDuration}</td>
<td class="pane" style="text-align:center;">
<j:if test="${case.skippedSinceRun != null}">
<a href="${rootURL}/${case.skippedSinceRun.url}">${case.age}</a>
</j:if>
<j:if test="${case.skippedSinceRun == null}">
${case.age}
</j:if>
</td>
</tr>
</j:forEach>
</table>
</j:if>
</j:jelly>