コード例 #1
0
  private static String _replaceCommandVars(String token, Element element) throws Exception {

    Matcher matcher = _pattern.matcher(token);

    while (matcher.find() && PoshiRunnerVariablesUtil.containsKeyInExecuteMap(matcher.group(1))) {

      String varName = matcher.group(1);

      String varValue = PoshiRunnerVariablesUtil.getValueFromExecuteMap(varName);

      if ((element.attributeValue("function") != null) && varName.startsWith("locator")) {

        varName = StringUtil.replace(varName, "locator", "locator-key");

        String locatorKey = PoshiRunnerVariablesUtil.getValueFromExecuteMap(varName);

        if (Validator.isNotNull(locatorKey)) {
          StringBuilder sb = new StringBuilder();

          sb.append("<em title=\"");
          sb.append(varValue);
          sb.append("\">");
          sb.append(locatorKey);
          sb.append("</em>");

          varValue = sb.toString();
        }
      }

      token = StringUtil.replace(token, matcher.group(), varValue);
    }

    return token;
  }
コード例 #2
0
  public static String getSummary() throws Exception {
    String summaryHTMLContent = _readResource("META-INF/resources/html/summary.html");

    _summaryContentWrapperLoggerElement.addChildLoggerElement(_getSummaryContentLoggerElement());

    summaryHTMLContent =
        StringUtil.replace(
            summaryHTMLContent,
            "<div id=\"summaryContentContainer\" />",
            _summaryContentContainerLoggerElement.toString());

    LoggerElement summaryTestDescriptionLoggerElement = _getSummaryTestDescriptionLoggerElement();

    summaryHTMLContent =
        StringUtil.replace(
            summaryHTMLContent,
            "<p id=\"summaryTestDescription\" />",
            summaryTestDescriptionLoggerElement.toString());

    LoggerElement summaryTestNameLoggerElement = _getSummaryTestNameLoggerElement();

    summaryHTMLContent =
        StringUtil.replace(
            summaryHTMLContent,
            "<h3 id=\"summaryTestName\" />",
            summaryTestNameLoggerElement.toString());

    summaryHTMLContent =
        StringUtil.replace(
            summaryHTMLContent,
            "<ul id=\"summaryTitleContainer\" />",
            _summaryTitleContainerLoggerElement.toString());

    return summaryHTMLContent;
  }