Skip to content

Commit

Permalink
[FIXED JENKINS-9637] Make link on Job page to aggregated Test result …
Browse files Browse the repository at this point in the history
…appear correctly
  • Loading branch information
Stefan Wolf committed Sep 13, 2013
1 parent 7ec8787 commit dd2b4a1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
21 changes: 12 additions & 9 deletions core/src/main/resources/hudson/model/AbstractProject/main.jelly
Expand Up @@ -31,7 +31,7 @@ THE SOFTWARE.
</j:if>

<p:projectActionFloatingBox />

<table style="margin-top: 1em; margin-left:1em;">

<j:forEach var="act" items="${it.prominentActions}">
Expand All @@ -53,21 +53,24 @@ THE SOFTWARE.

<j:set var="tr" value="${it.lastCompletedBuild.testResultAction}"/>
<j:if test="${tr!=null}">
<j:if test="${tr.class.name != 'hudson.tasks.test.AggregatedTestResultAction'}">
<j:if test="${tr.class.name != 'hudson.tasks.test.AggregatedTestResultPublisher$TestResultAction'}">
<t:summary icon="clipboard.png">
<a href="lastCompletedBuild/${tr.urlName}/" class="model-link inside">${%Latest Test Result}</a>
<t:test-result it="${tr}" />
</t:summary>
</j:if>
</j:if>

<j:set var="atr" value="${it.lastCompletedBuild.aggregatedTestResultAction}"/>
<j:if test="${atr!=null}">
<t:summary icon="clipboard.png">
<a href="lastCompletedBuild/aggregatedTestReport/" class="model-link inside">${%Latest Aggregated Test Result}</a>
<t:test-result it="${atr}" />
</t:summary>
</j:if>
<j:forEach var="atr" items="${it.lastCompletedBuild.actions}">
<j:if test="${atr!=null}">
<j:if test="${atr.class.name == 'hudson.tasks.test.AggregatedTestResultPublisher$TestResultAction'}">
<t:summary icon="clipboard.png">
<a href="lastCompletedBuild/${atr.urlName}/" class="model-link inside">${%Latest Aggregated Test Result}</a>
<t:test-result it="${atr}" />
</t:summary>
</j:if>
</j:if>
</j:forEach>

</table>

Expand Down
Expand Up @@ -56,9 +56,10 @@ public void aggregatedTestResultsOnly() throws Exception {
buildAndSetupPageObjects();

projectPage.getLatestAggregatedTestReportLink()
.assertHasLatestTestResultText()
.assertHasLatestAggregatedTestResultText()
.assertHasTests()
.follow().hasLinkToTestResultOfBuild(TEST_PROJECT_NAME, 1);

projectPage.assertNoTestReportLink();

buildPage.getAggregatedTestReportLink()
Expand All @@ -80,15 +81,19 @@ public void testResultsOnly() throws Exception {
.assertHasLatestTestResultText()
.assertHasTests()
.follow();
projectPage.assertNoAggregatedTestReportLink();
projectPage.getLatestAggregatedTestReportLink()
.assertHasLatestAggregatedTestResultText()
.assertNoTests()
.follow();

buildPage.getTestReportLink()
.assertHasTestResultText()
.assertHasTests()
.follow();
buildPage.getAggregatedTestReportLink()
.assertHasAggregatedTestResultText()
.assertNoTests();
.assertNoTests()
.follow();
}

@LocalData
Expand All @@ -103,7 +108,10 @@ public void testResultsAndAggregatedTestResults() throws Exception {
.assertHasLatestTestResultText()
.assertHasTests()
.follow();
projectPage.assertNoAggregatedTestReportLink();
projectPage.getLatestAggregatedTestReportLink()
.assertHasLatestAggregatedTestResultText()
.assertHasTests()
.follow();

buildPage.getTestReportLink()
.assertHasTestResultText()
Expand All @@ -123,11 +131,15 @@ private void buildAndSetupPageObjects() throws Exception {
}

private void buildOnce() throws Exception {
build(1);
}

private void build(int numberOfDownstreamBuilds) throws Exception {
build = j.buildAndAssertSuccess(upstreamProject);
j.waitUntilNoActivity();

List<AbstractBuild<?, ?>> downstreamBuilds = ImmutableList.copyOf(build.getDownstreamBuilds(downstreamProject));
assertThat(downstreamBuilds, hasSize(1));
assertThat(downstreamBuilds, hasSize(numberOfDownstreamBuilds));
}


Expand Down Expand Up @@ -169,7 +181,7 @@ private void addJUnitResultArchiver(FreeStyleProject project) {
private void addFingerprinterToProject(FreeStyleProject project, String[] contents, String[] files) throws Exception {
StringBuilder targets = new StringBuilder();
for (int i = 0; i < contents.length; i++) {
project.getBuildersList().add(new Shell("echo " + contents[i] + " > " + files[i]));
project.getBuildersList().add(new Shell("echo $BUILD_NUMBER " + contents[i] + " > " + files[i]));
targets.append(files[i]).append(',');
}

Expand Down

0 comments on commit dd2b4a1

Please sign in to comment.