Beispiel #1
0
 private void initializeTest() {
   symbols.clear();
   scenarios.clear();
   testSummary.clear();
   allExpectations.clear();
   allInstructionResults.clear();
   allInstructions.clear();
   allTables.clear();
   exceptions.resetForNewTest();
 }
Beispiel #2
0
 private List<SlimTable> createSlimTables(TableScanner tableScanner) {
   List<SlimTable> allTables = new LinkedList<SlimTable>();
   for (Table table : tableScanner) {
     String tableId = "" + allTables.size();
     SlimTable slimTable = makeSlimTable(table, tableId, this);
     if (slimTable != null) {
       allTables.add(slimTable);
     }
   }
   return allTables;
 }
Beispiel #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;
  }
Beispiel #4
0
  String processAllTablesOnPage(PageData pageData) throws Exception {
    tableScanner = scanTheTables(pageData);
    allTables = createSlimTables(tableScanner);
    testResults = pageData;

    boolean runAllTablesAtOnce = false;
    String htmlResults = "";
    if (runAllTablesAtOnce || (allTables.size() == 0)) {
      htmlResults = processTablesAndGetHtml(allTables, START_OF_TEST, END_OF_TEST);
    } else {
      List<SlimTable> oneTableList = new ArrayList<SlimTable>(1);
      for (int index = 0; index < allTables.size(); index++) {
        SlimTable theTable = allTables.get(index);
        SlimTable startWithTable = (index == 0) ? START_OF_TEST : theTable;
        SlimTable nextTable =
            (index + 1 < allTables.size()) ? allTables.get(index + 1) : END_OF_TEST;

        oneTableList.add(theTable);
        htmlResults += processTablesAndGetHtml(oneTableList, startWithTable, nextTable);
        oneTableList.clear();
      }
    }
    return htmlResults;
  }
Beispiel #5
0
 public void addExpectation(SlimTable.Expectation e) {
   expectations.add(e);
 }