Example #1
0
  /**
   * @param report
   * @param previous
   * @return
   */
  public static String createReportSummary(Report report, Report previous) {
    StringBuilder builder = new StringBuilder();
    builder.append(Messages.Testopia_Utils_Run(report.getRunId()));
    builder.append(Messages.Testopia_Utils_Build(report.getBuildId()));
    builder.append(Messages.Testopia_Utils_Environment(report.getEnvId()));
    builder.append("<p><a href=\"" + TestopiaBuildAction.URL_NAME + "\">");

    Integer total = report.getTestsTotal();
    Integer previousTotal = previous != null ? previous.getTestsTotal() : total;
    Integer passed = report.getPassed();
    Integer previousPassed = previous != null ? previous.getPassed() : passed;
    Integer failed = report.getFailed();
    Integer previousFailed = previous != null ? previous.getFailed() : failed;
    Integer blocked = report.getBlocked();
    Integer previousBlocked = previous != null ? previous.getBlocked() : blocked;
    Integer notRun = report.getNotRun();
    Integer previousNotRun = previous != null ? previous.getNotRun() : notRun;

    builder.append(
        Messages.Testopia_Utils_Totals(
            (total + getPlusSignal(total, previousTotal)),
            (passed + getPlusSignal(passed, previousPassed)),
            (failed + getPlusSignal(failed, previousFailed)),
            (blocked + getPlusSignal(blocked, previousBlocked)),
            (notRun + getPlusSignal(notRun, previousNotRun))));

    builder.append("</p>");

    return builder.toString();
  }
Example #2
0
 /**
  * @param statusId
  * @return
  */
 private static String getExecutionStatusTextColored(Integer statusId) {
   Status executionStatus = Status.get((statusId != null ? statusId : Status.IDLE.getValue()));
   String executionStatusTextColored = "Undefined";
   if (executionStatus == Status.FAILED) {
     executionStatusTextColored = Messages.Testopia_Utils_Failed();
   }
   if (executionStatus == Status.PASSED) {
     executionStatusTextColored = Messages.Testopia_Utils_Passed();
   }
   if (executionStatus == Status.BLOCKED) {
     executionStatusTextColored = Messages.Testopia_Utils_Blocked();
   }
   if (executionStatus == Status.IDLE) {
     executionStatusTextColored = Messages.Testopia_Utils_NotRun();
   }
   return executionStatusTextColored;
 }
Example #3
0
  /**
   * @param report
   * @param previousReport
   * @return
   */
  public static String createReportSummaryDetails(Report report, Report previousReport) {
    final StringBuilder builder = new StringBuilder();

    builder.append(Messages.Testopia_Utils_Summary());
    builder.append("<table border=\"1\">\n");
    builder.append("<tr><th>");
    builder.append("Test Case ID");
    builder.append("</th><th>");
    builder.append("Status");
    builder.append("</th></tr>\n");

    for (TestCaseWrapper tc : report.getTestCases()) {
      builder.append("<tr>\n");

      builder.append("<td>" + tc.getId() + "</td>");
      builder.append("<td>" + Utils.getExecutionStatusTextColored(tc.getStatusId()) + "</td>\n");

      builder.append("</tr>\n");
    }

    builder.append("</table>");
    return builder.toString();
  }