Package fitnesse.testsystems.slim

Examples of fitnesse.testsystems.slim.SlimTestContextImpl


    when(table.getCellContents(0, 1)).thenReturn(tablename);
    when(table.getCellContents(1, 1)).thenReturn(type);
    when(table.getRowCount()).thenReturn(2);
    when(table.getColumnCountInRow(0)).thenReturn(1);
    when(table.getColumnCountInRow(1)).thenReturn(2);
    slimTableFactory.makeSlimTable(table, "0", new SlimTestContextImpl());
  }
View Full Code Here


      Constructor<T> constructor = getParameterizedClass().getConstructor(Table.class, String.class, SlimTestContext.class);
      WikiPageUtil.setPageContents(root, tableText);
      String html = root.getHtml();
      TableScanner<HtmlTable> ts = new HtmlTableScanner(html);
      Table t = ts.getTable(0);
      SlimTestContextImpl testContext = new SlimTestContextImpl();
      return constructor.newInstance(t, "id", testContext);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

    root = InMemoryPage.makeRoot("root");
    assertions = new ArrayList<SlimAssertion>();
  }

  private SlimTestContextImpl makeTables(String tableText) throws Exception {
    SlimTestContextImpl testContext = new SlimTestContextImpl();
    WikiPageUtil.setPageContents(root, tableText);
    TableScanner ts = new HtmlTableScanner(root.getHtml());
    Table t = ts.getTable(0);
    ScenarioTable st = new ScenarioTable(t, "s_id", testContext);
    t = ts.getTable(1);
View Full Code Here

    return testContext;
  }

  @Test
  public void bracesArountArgumentInTable() throws Exception {
    SlimTestContextImpl testContext = makeTables(
            "!|scenario|echo|user|giving|user_old|\n" +
                    "|check|echo|@{user}|@{user_old}|\n" +
                    "\n" +
                    "!|DT:EchoGiving|\n" +
                    "|user|user_old|\n" +
                    "|7|7|\n"
    );
    Map<String, Object> pseudoResults = SlimCommandRunningClient.resultToMap(
            asList(asList("decisionTable_did_0/scriptTable_s_id_0", "7"))
    );
    SlimAssertion.evaluateExpectations(assertions, pseudoResults);

    String scriptTable = dt.getChildren().get(0).getTable().toString();
    String expectedScript =
      "[[scenario, echo, user, giving, user_old], [check, echo, 7, pass(7)]]";
    assertEquals(expectedScript, scriptTable);
    String dtHtml = dt.getTable().toString();
    assertEquals(1, testContext.getTestSummary().getRight());
    assertEquals(0, testContext.getTestSummary().getWrong());
    assertEquals(0, testContext.getTestSummary().getIgnores());
    assertEquals(0, testContext.getTestSummary().getExceptions());
  }
View Full Code Here

    assertEquals(expectedInstructions, instructions());
  }

  @Test
  public void simpleInputAndOutputPassing() throws Exception {
    SlimTestContextImpl testContext = makeTables(
            "!|scenario|echo|input|giving|output|\n" +
                    "|check|echo|@input|@output|\n" +
                    "\n" +
                    "!|DT:EchoGiving|\n" +
                    "|input|output|\n" +
                    "|7|7|\n"
    );
    Map<String, Object> pseudoResults = SlimCommandRunningClient.resultToMap(
            asList(asList("decisionTable_did_0/scriptTable_s_id_0", "7"))
    );
    SlimAssertion.evaluateExpectations(assertions, pseudoResults);

    String scriptTable = dt.getChildren().get(0).getTable().toString();
    String expectedScript =
      "[[scenario, echo, input, giving, output], [check, echo, 7, pass(7)]]";
    assertEquals(expectedScript, scriptTable);
    String dtHtml = dt.getTable().toString();
    assertEquals(1, testContext.getTestSummary().getRight());
    assertEquals(0, testContext.getTestSummary().getWrong());
    assertEquals(0, testContext.getTestSummary().getIgnores());
    assertEquals(0, testContext.getTestSummary().getExceptions());
  }
View Full Code Here

    assertEquals(0, testContext.getTestSummary().getExceptions());
  }

  @Test
  public void simpleInputAndOutputFailing() throws Exception {
    SlimTestContextImpl testContext = makeTables(
            "!|scenario|echo|input|giving|output|\n" +
                    "|check|echo|@input|@output|\n" +
                    "\n" +
                    "!|DT:EchoGiving|\n" +
                    "|input|output|\n" +
                    "|7|8|\n"
    );
    Map<String, Object> pseudoResults = SlimCommandRunningClient.resultToMap(
            asList(asList("decisionTable_did_0/scriptTable_s_id_0", "7"))
    );
    SlimAssertion.evaluateExpectations(assertions, pseudoResults);

    String scriptTable = dt.getChildren().get(0).getTable().toString();
    String expectedScript =
      "[[scenario, echo, input, giving, output], [check, echo, 7, fail(a=7;e=8)]]";
    assertEquals(expectedScript, scriptTable);
    String dtHtml = dt.getTable().toString();
    assertEquals(0, testContext.getTestSummary().getRight());
    assertEquals(1, testContext.getTestSummary().getWrong());
    assertEquals(0, testContext.getTestSummary().getIgnores());
    assertEquals(0, testContext.getTestSummary().getExceptions());
  }
View Full Code Here

  private ScriptTable makeScriptTable(String tableText) throws Exception {
    WikiPageUtil.setPageContents(root, tableText);
    TableScanner ts = new HtmlTableScanner(root.getHtml());
    Table t = ts.getTable(0);
    SlimTestContextImpl testContext = new SlimTestContextImpl();
    return new HtmlScriptTable(t, "id", testContext);
  }
View Full Code Here

  private TableTable makeTableTable(String tableText) throws Exception {
    WikiPageUtil.setPageContents(root, tableText);
    TableScanner ts = new HtmlTableScanner(root.getHtml());
    Table t = ts.getTable(0);
    SlimTestContextImpl testContext = new SlimTestContextImpl();
    return new TableTable(t, "id", testContext);
  }
View Full Code Here

    root = InMemoryPage.makeRoot("root");
    assertions = new ArrayList<SlimAssertion>();
  }

  private SlimTestContextImpl makeTables(String scenarioText, String scriptText) throws Exception {
    SlimTestContextImpl testContext = new SlimTestContextImpl();
    String tableText = "!|" + SCEN_EXTENSION_NAME + "|" + scenarioText + "|\n"
            + "\n"
            + "!|DT:" + scriptText + "|\n";
    WikiPageUtil.setPageContents(root, tableText);
    TableScanner ts = new HtmlTableScanner(root.getHtml());
View Full Code Here

    return testContext;
  }

  @Test
  public void bracesAroundArgumentInTable() throws Exception {
    SlimTestContextImpl testContext = makeTables(
      "echo|user|giving|user_old|\n" +
        "|check|echo|@{user}|@{user_old}",
      "EchoGiving|\n" +
        "|user|user_old|\n" +
        "|7|7"
    );
    Map<String, Object> pseudoResults = SlimCommandRunningClient.resultToMap(
            asList(
                    asList("decisionTable_did_0/diffScriptTable_s_id_0", "7")
            )
    );
    SlimAssertion.evaluateExpectations(assertions, pseudoResults);

    String scriptTable = dt.getChildren().get(0).getTable().toString();
    String expectedScript =
      "[[diffScriptScenario, echo, user, giving, user_old], [check, echo, 7, pass(7)]]";
    assertEquals(expectedScript, scriptTable);
    assertEquals(1, testContext.getTestSummary().getRight());
    assertEquals(0, testContext.getTestSummary().getWrong());
    assertEquals(0, testContext.getTestSummary().getIgnores());
    assertEquals(0, testContext.getTestSummary().getExceptions());
  }
View Full Code Here

TOP

Related Classes of fitnesse.testsystems.slim.SlimTestContextImpl

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.