Package fitnesse.testsystems.slim.results

Examples of fitnesse.testsystems.slim.results.SlimTestResult


  private void assertExpectationMessage(String expected, String value, String message) throws Exception {
    TableScanner ts = new HtmlTableScanner("<table><tr><td>x</td></tr></table>");
    Table t = ts.getTable(0);
    SlimTable slimTable = new DecisionTable(t, "id", testContext);
    SlimTable.RowExpectation expectation = slimTable.new ReturnedValueExpectation(0, 0);
    SlimTestResult testResult = expectation.evaluationMessage(value, expected);
    assertEquals(message, testResult.toString(expected));
    //assertEquals(message, expectation.getEvaluationMessage());
    assertEquals(0, expectation.getRow());
    assertEquals(0, expectation.getCol());
  }
View Full Code Here


    final List<Object> rowList = tableResults.get(resultRow);
    for (int col = 0; col < rowList.size(); col++) {
      int tableRow = resultRow + 1;
      String contents = table.getCellContents(col, tableRow);
      String result = (String) rowList.get(col);
      SlimTestResult testResult = getTestResult(result, replaceSymbolsWithFullExpansion(contents));
      table.updateContent(col, tableRow, testResult);
      testSummary.add(testResult.getExecutionResult());
    }
  }
View Full Code Here

      testSummary.add(testResult.getExecutionResult());
    }
  }

  private SlimTestResult getTestResult(String message, String content) {
    SlimTestResult result;
    if (message.equalsIgnoreCase("no change") || message.length() == 0)
      result = SlimTestResult.plain(content);
    else if (message.equalsIgnoreCase("pass"))
      result = SlimTestResult.pass(content);
    else if (message.equalsIgnoreCase("fail"))
View Full Code Here

  public class TableTableExpectation implements SlimExpectation {

    @Override
    public TestResult evaluateExpectation(Object tableReturn) {
      SlimTestResult testResult;
      if (tableReturn == null || "null".equals(tableReturn)) {
        testResult = SlimTestResult.ignore("No results from table");
        table.updateContent(table.getColumnCountInRow(0) - 1, 0, testResult);
      } else if (tableReturn instanceof String) {
        testResult = SlimTestResult.error((String) tableReturn);
        table.updateContent(0, 0, testResult);
      } else {
        TestSummary testSummary = resizeTableAndEvaluateRows(tableReturn);
        getTestContext().increment(testSummary);
        testResult = new SlimTestResult(ExecutionResult.getExecutionResult(testSummary));
        testResult.setVariables(getSymbolsToStore());
      }
      getTestContext().increment(testResult.getExecutionResult());
      return testResult;
    }
View Full Code Here

    }
  }

  protected void markMissingRow(int missingRow) {
    replaceAllvariablesInRow(missingRow);
    SlimTestResult testResult = SlimTestResult.fail(null, table.getCellContents(0, missingRow), "missing");
    table.updateContent(0, missingRow, testResult);
    getTestContext().increment(testResult.getExecutionResult());
  }
View Full Code Here

  protected ExecutionResult markSurplusRows(final QueryResults queryResults, List<Integer> unmatchedRows) {
    ExecutionResult result = ExecutionResult.PASS;
    for (int unmatchedRow : unmatchedRows) {
      List<String> surplusRow = queryResults.getList(fieldNames, unmatchedRow);
      int newTableRow = table.addRow(surplusRow);
      SlimTestResult testResult = SlimTestResult.fail(surplusRow.get(0), null, "surplus");
      table.updateContent(0, newTableRow, testResult);
      getTestContext().increment(ExecutionResult.FAIL);
      markMissingFields(surplusRow, newTableRow);
      result = ExecutionResult.FAIL;
    }
View Full Code Here

  private void markMissingFields(List<String> surplusRow, int newTableRow) {
    for (int col = 0; col < surplusRow.size(); col++) {
      String surplusField = surplusRow.get(col);
      if (surplusField == null) {
        String fieldName = fieldNames.get(col);
        SlimTestResult testResult = SlimTestResult.fail(String.format("field %s not present", fieldName));
        table.updateContent(col, newTableRow, testResult);
        getTestContext().increment(testResult.getExecutionResult());
      }
    }
  }
View Full Code Here

    if (col >= fieldNames.size())
      return null; // ignore strange table geometry.
    String fieldName = fieldNames.get(col);
    String actualValue = queryResults.getCell(fieldName, matchedRow);
    String expectedValue = table.getCellContents(col, tableRow);
    SlimTestResult testResult;
    if (fieldName.startsWith(COMMENT_COLUMN_MARKER))
      testResult = SlimTestResult.plain();
    else if (actualValue == null)
      testResult = SlimTestResult.fail(String.format("field %s not present", fieldName), expectedValue);
    else if (expectedValue == null || expectedValue.length() == 0)
      testResult = SlimTestResult.ignore(actualValue);
    else {
      String symbolName = ifSymbolAssignment(expectedValue);
      if (symbolName != null) {
        setSymbol(symbolName, actualValue, true);
        testResult = SlimTestResult.ignore(String.format("$%s<-[%s]", symbolName, actualValue));
      } else {
        testResult = matchMessage(actualValue, expectedValue);
        if (testResult == null)
          testResult = SlimTestResult.fail(actualValue, replaceSymbolsWithFullExpansion(expectedValue));
        else if (testResult.getExecutionResult() == ExecutionResult.PASS)
          testResult = markMatch(tableRow, matchedRow, col, testResult.getMessage());
      }
    }
    table.updateContent(col, tableRow, testResult);
    getTestContext().increment(testResult.getExecutionResult());
    return testResult;
  }
View Full Code Here

  public class QueryTableExpectation implements SlimExpectation {

    @Override
    public TestResult evaluateExpectation(Object queryReturn) {
      SlimTestResult testResult;
      if (queryReturn == null) {
        testResult = SlimTestResult.testNotRun();
      } else if (queryReturn instanceof List) {
        testResult = new SlimTestResult(scanRowsForMatches((List<List<List<Object>>>) queryReturn));
        testResult.setVariables(getSymbolsToStore());
      } else {
        testResult = SlimTestResult.error(String.format("The query method returned: %s", queryReturn));
        table.updateContent(0, 0, testResult);
        getTestContext().increment(testResult.getExecutionResult());
      }
      return testResult;
    }
View Full Code Here

      ExecutionResult testStatus = ((ScenarioTestContext) scriptTable.getTestContext()).getExecutionResult();
      if (outputs.isEmpty() || testStatus != ExecutionResult.PASS){
        // if the scenario has no output parameters
        // or the scenario failed
        // then the whole line should be flagged
        parent.getTable().updateContent(getRow(), new SlimTestResult(testStatus));
      }
      return null;
    }
View Full Code Here

TOP

Related Classes of fitnesse.testsystems.slim.results.SlimTestResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.