@LocalData
  @Test
  public void setDescription() throws Exception {
    FreeStyleBuild build = project.scheduleBuild2(0).get(10, TimeUnit.SECONDS);

    CaseResult caseResult = build.getAction(TestResultAction.class).getFailedTests().get(0);
    String url =
        build.getUrl()
            + "/testReport/"
            + caseResult.getRelativePathFrom(caseResult.getTestResult());

    testSetDescription(url, caseResult);

    ClassResult classResult = caseResult.getParent();
    url =
        build.getUrl()
            + "/testReport/"
            + classResult.getParent().getSafeName()
            + "/"
            + classResult.getSafeName();
    testSetDescription(url, classResult);

    PackageResult packageResult = classResult.getParent();
    url = build.getUrl() + "/testReport/" + classResult.getParent().getSafeName();
    testSetDescription(url, packageResult);
  }
Exemplo n.º 2
0
 /** Gets the version of {@link #getName()} that's URL-safe. */
 public @Override synchronized String getSafeName() {
   if (safeName != null) {
     return safeName;
   }
   StringBuilder buf = new StringBuilder(testName);
   for (int i = 0; i < buf.length(); i++) {
     char ch = buf.charAt(i);
     if (!Character.isJavaIdentifierPart(ch)) buf.setCharAt(i, '_');
   }
   Collection<CaseResult> siblings =
       (classResult == null ? Collections.<CaseResult>emptyList() : classResult.getChildren());
   return safeName = uniquifyName(siblings, buf.toString());
 }