Exemplo n.º 1
0
 private void initializeTest() {
   symbols.clear();
   scenarios.clear();
   testSummary.clear();
   allExpectations.clear();
   allInstructionResults.clear();
   allInstructions.clear();
   allTables.clear();
   exceptions.resetForNewTest();
 }
Exemplo n.º 2
0
  private void processException(String resultKey, String resultString) {
    testSummary.exceptions++;
    boolean isStopTestException = resultString.contains(SlimServer.EXCEPTION_STOP_TEST_TAG);
    if (isStopTestException) {
      exceptions.setStopTestCalled();
    }

    Matcher exceptionMessageMatcher = exceptionMessagePattern.matcher(resultString);
    if (exceptionMessageMatcher.find()) {
      String prefix = (isStopTestException) ? MESSAGE_FAIL : MESSAGE_ERROR;
      String exceptionMessage = exceptionMessageMatcher.group(1);
      instructionResults.put(resultKey, prefix + translateExceptionMessage(exceptionMessage));
    } else {
      exceptions.addException(resultKey, resultString);
      instructionResults.put(resultKey, exceptionResult(resultKey));
    }
  }
Exemplo n.º 3
0
  private String processTablesAndGetHtml(
      List<SlimTable> tables, SlimTable startWithTable, SlimTable nextTable) throws Exception {
    expectations.clear();

    testTables = tables;
    instructions = createInstructions(tables);
    if (!exceptions.stopTestCalled()) {
      instructionResults = slimClient.invokeAndGetResponse(instructions);
    }
    String html = createHtmlResults(startWithTable, nextTable);
    acceptOutputFirst(html);

    // update all lists
    allExpectations.addAll(expectations);
    allInstructions.addAll(instructions);
    allInstructionResults.putAll(instructionResults);

    return html;
  }
Exemplo n.º 4
0
 public ScenarioTable getScenario(String scenarioName) {
   return scenarios.get(scenarioName);
 }
Exemplo n.º 5
0
 public void addScenario(String scenarioName, ScenarioTable scenarioTable) {
   scenarios.put(scenarioName, scenarioTable);
 }
Exemplo n.º 6
0
 public void setSymbol(String symbolName, String value) {
   symbols.put(symbolName, value);
 }
Exemplo n.º 7
0
 public String getSymbol(String symbolName) {
   return symbols.get(symbolName);
 }
Exemplo n.º 8
0
 private void replaceExceptionWithExceptionLink(String resultKey) {
   Object result = instructionResults.get(resultKey);
   if (result instanceof String) replaceIfUnignoredException(resultKey, (String) result);
 }
Exemplo n.º 9
0
 protected void replaceExceptionsWithLinks() {
   Set<String> resultKeys = instructionResults.keySet();
   for (String resultKey : resultKeys) replaceExceptionWithExceptionLink(resultKey);
 }