Exemplo n.º 1
0
  protected void notifyLoadTestFinished(LoadTestRunner runner) {
    runningLoadTests.remove(runner.getLoadTest().getTestCase());

    if (listeners.isEmpty()) return;

    TestMonitorListener[] l = listeners.toArray(new TestMonitorListener[listeners.size()]);
    for (int c = 0; c < l.length; c++) {
      l[c].loadTestFinished(runner);
    }
  }
  public String assertResult(
      LoadTestRunner loadTestRunner,
      LoadTestRunContext context,
      TestStepResult result,
      TestCaseRunner testRunner,
      TestCaseRunContext runContext) {
    WsdlLoadTest loadTest = (WsdlLoadTest) loadTestRunner.getLoadTest();
    LoadTestStatistics statisticsModel = loadTest.getStatisticsModel();

    TestStep step = result.getTestStep();
    if (targetStepMatches(step)) {
      int index = step.getTestCase().getIndexOfTestStep(step);

      long average = statisticsModel.getStatistic(index, Statistic.AVERAGE);
      long count = statisticsModel.getStatistic(index, Statistic.AVERAGE);
      if (count > minRequests && (count % sampleInterval == 0) && average >= maxAverage) {
        return returnErrorOrFail(
            "Average [" + average + "] exceeds limit [" + maxAverage + "]",
            maxErrors,
            loadTestRunner,
            context);
      }
    } else if (ALL_TEST_STEPS.equals(getTargetStep())) {
      long average = statisticsModel.getStatistic(LoadTestStatistics.TOTAL, Statistic.AVERAGE);
      long count = statisticsModel.getStatistic(LoadTestStatistics.TOTAL, Statistic.COUNT);
      if (count > minRequests && (count % sampleInterval == 0) && average >= maxAverage) {
        return returnErrorOrFail(
            "Average [" + average + "] exceeds limit [" + maxAverage + "]",
            maxErrors,
            loadTestRunner,
            context);
      }
    }

    return null;
  }
 public void loadTestStarted(LoadTestRunner runner) {
   if (runner.getLoadTest().getTestCase() == getModelItem().getTestCase()) {
     setEnabled(false);
   }
 }