@Override
  public void afterRun(TestCaseRunner testRunner, SecurityTestRunContext runContext) {
    TestCase testCase = testRunner.getTestCase();

    SecurityTest securityTest = ((SecurityTestRunner) testRunner).getSecurityTest();

    JUnitReport report = new JUnitReport();
    report.setIncludeTestProperties(includeTestPropertiesInReport);

    String reportName = securityTest.getName();
    report.setTestSuiteName(reportName);
    report.setPackage(testCase.getTestSuite().getProject().getName());
    int errorCount = 0;

    for (TestStep ts : testCase.getTestStepList()) {
      SecurityTestStepResult secuTestStepResult =
          securityTest.getSecurityTestStepResultMap().get(ts);
      if (secuTestStepResult != null) {
        for (SecurityScanResult scanResult : secuTestStepResult.getSecurityScanResultList()) {

          HashMap<String, String> testProperties = getTestPropertiesAsHashMap(securityTest);

          List<SecurityScanRequestResult> resultList = scanResult.getSecurityRequestResultList();
          Testcase secTestCase =
              report.addTestCase(
                  ts.getName() + " - " + scanResult.getSecurityScanName(),
                  scanResult.getTimeTaken(),
                  testProperties);

          secTestCase.setPackage(testCase.getTestSuite().getProject().getName());

          for (int i = 0; i < resultList.size(); i++) {
            SecurityScanRequestResult scanRequestResult = resultList.get(i);
            if (scanRequestResult.getStatus() == ResultStatus.FAILED) {
              StringBuffer result = new StringBuffer();
              result
                  .append("<pre>")
                  .append(XmlUtils.entitize(scanRequestResult.getChangedParamsInfo(i + 1)))
                  .append("</pre>");

              for (String message : scanRequestResult.getMessages()) {
                result.append("<pre>").append(XmlUtils.entitize(message)).append("</pre>");
              }

              secTestCase.addNewError().setStringValue(result.toString());
              errorCount++;
            }
          }
        }
      }

      report.setNoofErrorsInTestSuite(errorCount);
      report.setTotalTime(testRunner.getTimeTaken());

      reports.put(reportName, report);
    }
  }
  public void perform(SecurityTest securityTest, Object param) {
    if (dialog == null) {
      XFormDialogBuilder builder = XFormFactory.createDialogBuilder("SecurityTest Options");
      form = builder.createForm("Basic");
      form.addCheckBox(FAIL_ON_ERROR, "Fail on error")
          .addFormFieldListener(
              new XFormFieldListener() {

                public void valueChanged(XFormField sourceField, String newValue, String oldValue) {
                  form.getFormField(FAIL_SECURITYTEST_ON_ERROR)
                      .setEnabled(!Boolean.parseBoolean(newValue));
                }
              });
      form.addCheckBox(FAIL_SECURITYTEST_ON_ERROR, "Fail SecurityTest if it has failed TestSteps");

      dialog =
          builder.buildDialog(
              builder.buildOkCancelHelpActions(HelpUrls.SECURITYTESTEDITOR_HELP_URL),
              "Specify general options for this SecurityTest",
              UISupport.OPTIONS_ICON);
    }

    StringToStringMap values = new StringToStringMap();

    values.put(FAIL_ON_ERROR, String.valueOf(securityTest.getFailOnError()));
    values.put(
        FAIL_SECURITYTEST_ON_ERROR, String.valueOf(securityTest.getFailSecurityTestOnScanErrors()));
    values = dialog.show(values);

    if (dialog.getReturnValue() == XFormDialog.OK_OPTION) {
      try {
        securityTest.setFailOnError(Boolean.parseBoolean(values.get(FAIL_ON_ERROR)));
        securityTest.setFailSecurityTestOnScanErrors(
            Boolean.parseBoolean(values.get(FAIL_SECURITYTEST_ON_ERROR)));

      } catch (Exception e1) {
        UISupport.showErrorMessage(e1.getMessage());
      }
    }
  }
  public void release() {
    securityTest.removeSecurityTestRunListener(internalTestRunListener);

    securityTest = null;
    testStep = null;
  }