Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed: Added back package names in certain places where they were hel…
…pful (see JENKINS-19217)
  • Loading branch information
nullin committed Jul 21, 2014
1 parent 4675eb5 commit a10f639
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README
Expand Up @@ -16,6 +16,9 @@ graph and all details about which tests that failed are also presented.
Release Notes
-------

### 1.8
* Fixed: Added back package names in certain places where they were helpful (see JENKINS-19217)

### 1.7
* Fixed: JENKINS-23285 - All links on trend graph map are wrong on "testngreports" subpage
* Fixed: JENKINS-19217 - Change class names to not contain package names on result pages
Expand Down
Expand Up @@ -103,7 +103,7 @@ private static String printTestsUrls(AbstractBuild<?,?> owner, List<MethodResult
if (methodResult.getParent() instanceof ClassResult) {
htmlStr.append("<a href=\"").append(methodResult.getUpUrl());
htmlStr.append("\">");
htmlStr.append(methodResult.getParent().getName());
htmlStr.append(((ClassResult)methodResult.getParent()).getCanonicalName());
htmlStr.append(".").append(methodResult.getName()).append("</a>");
} else {
htmlStr.append(methodResult.getName());
Expand Down
Expand Up @@ -39,7 +39,7 @@ if (my.result.failCount != 0) {
}
text(" ")
a(href:"${failedTest.upUrl}") {
text("${failedTest.parent.name}.${failedTest.name}")
text("${failedTest.parent.canonicalName}.${failedTest.name}")
}
div(id:"${failedTest.id}", style: "display:none", class: "hidden") {
text("Loading...")
Expand Down Expand Up @@ -180,7 +180,7 @@ def printMethods(type, tableName, methodList, showMoreArrows) {
text(" ")
}
a(href:"${method.upUrl}") {
text("${method.parent.name}.${method.name}")
text("${method.parent.canonicalName}.${method.name}")
}
if (showMoreArrows) {
div(id:"${method.id}", style: "display:none", class: "hidden") {
Expand Down
Expand Up @@ -15,7 +15,7 @@ div(id: "report") {
h1("${my.name}")
text("(from ")
a(href: "${my.parent.upUrl}", id: "parent") {
text("${my.parent.name}")
text("${my.parent.canonicalName}")
}
text(" took ${my.durationString})")

Expand Down
Expand Up @@ -7,6 +7,7 @@
import hudson.model.BuildListener;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.plugins.testng.util.TestResultHistoryUtil;
import hudson.tasks.test.TestResult;
import junit.framework.Assert;
import org.junit.Test;
Expand Down Expand Up @@ -66,5 +67,8 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
Assert.assertFalse(projAction.getEscapeTestDescp());
Assert.assertTrue(projAction.getEscapeExceptionMsg());
Assert.assertSame(testResult, projAction.getLastCompletedBuildAction().getResult());

String summary = TestResultHistoryUtil.toSummary(projAction.getLastCompletedBuildAction());
Assert.assertTrue(summary.contains("gov.nasa.jpl.FoobarTests.b"));
}
}
Expand Up @@ -14,6 +14,7 @@
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.model.Result;
import hudson.plugins.testng.results.ClassResult;
import hudson.plugins.testng.results.MethodResult;
import hudson.plugins.testng.results.PackageResult;
import hudson.plugins.testng.results.TestNGResult;
Expand Down Expand Up @@ -71,6 +72,8 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
MethodResult mr = testngResult.getFailedTests().get(0);
assertEquals(super.getURL() + mr.getOwner().getUrl() + mr.getId(),
elements.get(0).getAttribute("href"));
assertEquals(((ClassResult)mr.getParent()).getCanonicalName() + "." + mr.getName(),
elements.get(0).getTextContent());

//ensure only one failed config method
elements = page.selectNodes("//table[@id='fail-config-tbl']/tbody/tr/td/a");
Expand All @@ -79,13 +82,17 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
mr = testngResult.getFailedConfigs().get(0);
assertEquals(super.getURL() + mr.getOwner().getUrl() + mr.getId(),
elements.get(2).getAttribute("href"));
assertEquals(((ClassResult)mr.getParent()).getCanonicalName() + "." + mr.getName(),
elements.get(2).getTextContent());

//ensure only one skipped test method
elements = page.selectNodes("//table[@id='skip-tbl']/tbody/tr/td/a");
assertEquals(1, elements.size());
mr = testngResult.getSkippedTests().get(0);
assertEquals(super.getURL() + mr.getOwner().getUrl() + mr.getId(),
elements.get(0).getAttribute("href"));
assertEquals(((ClassResult)mr.getParent()).getCanonicalName() + "." + mr.getName(),
elements.get(0).getTextContent());

//ensure no skipped config
elements = page.selectNodes("//table[@id='skip-config-tbl']");
Expand Down
Expand Up @@ -251,7 +251,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
HtmlElement element = page.getElementById("parent");
String contents = element.getTextContent();
//information about class and time taken
assertStringContains(contents, "Test1");
assertStringContains(contents, "test.Test1");
assertTrue(element.getAttribute("href").endsWith(urlPrefix + "/test/Test1"));

//duration string
Expand Down

0 comments on commit a10f639

Please sign in to comment.