Ejemplo n.º 1
0
  @Override
  public void afterRun(TestCaseRunner testRunner, TestCaseRunContext runContext) {
    log.info(
        "Finished running SoapUI testcase ["
            + testRunner.getTestCase().getName()
            + "], time taken: "
            + testRunner.getTimeTaken()
            + "ms, status: "
            + testRunner.getStatus());

    if (testRunner.getStatus() == Status.FAILED) {
      failedTests.add(testRunner.getTestCase());
    }

    testCaseCount++;
  }
  @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);
    }
  }
Ejemplo n.º 3
0
 @Override
 public void beforeRun(TestCaseRunner testRunner, TestCaseRunContext runContext) {
   log.info("Running SoapUI testcase [" + testRunner.getTestCase().getName() + "]");
 }
 public void testCaseStarted(TestCaseRunner runner) {
   if (runner.getTestCase() == getModelItem().getTestCase()) {
     setEnabled(false);
   }
 }