Package fitnesse.testsystems.slim

Examples of fitnesse.testsystems.slim.SlimTestContextImpl


    assertEquals(expectedInstructions, instructions());
  }

  @Test
  public void simpleInputAndOutputPassing() throws Exception {
    SlimTestContextImpl testContext = makeTables(
            "echo|input|giving|output|\n" +
                    "|check|echo|@input|@output",
            "EchoGiving|\n" +
                    "|input|output|\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, input, giving, output], [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


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

  @Test
  public void simpleInputAndOutputFailing() throws Exception {
    SlimTestContextImpl testContext = makeTables(
            "echo|input|giving|output|\n" +
                    "|check|echo|@input|@output",
            "EchoGiving|\n" +
                    "|input|output|\n" +
                    "|7|8"
    );
    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, input, giving, output], [check, echo, 7, fail(a=7;e=8)]]";
    assertEquals(expectedScript, scriptTable);
    assertEquals(0, testContext.getTestSummary().getRight());
    assertEquals(1, testContext.getTestSummary().getWrong());
    assertEquals(0, testContext.getTestSummary().getIgnores());
    assertEquals(0, testContext.getTestSummary().getExceptions());
  }
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

  }


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

    SlimAssertion.evaluateExpectations(assertions, pseudoResults);

    String scriptTable = script.getChildren().get(0).getTable().toString();
    String expectedScript =
      "[[scenario, echo, input, giving, output], [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

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

  @Test
  public void differentScriptSimpleInputAndOutputPassing() throws Exception {
    SlimTestContextImpl testContext = makeTables(
            "!|scenario|echo|input|giving|output|\n" +
                    "|localized check|echo|@input|@output|\n" +
                    "\n" +
                    "!|localisedScript|\n" +
                    "|echo|7|giving|7|\n"
    );
    Map<String, Object> pseudoResults = SlimCommandRunningClient.resultToMap(
            asList(asList("localizedScriptTable_id_0/localizedScriptTable_s_id_0", "7"))
    );

    SlimAssertion.evaluateExpectations(assertions, pseudoResults);

    String scriptTable = script.getChildren().get(0).getTable().toString();
    String expectedScript =
            "[[scenario, echo, input, giving, output], [localized 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

    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" +
        "!|script|\n" +
        "|echo|7|giving|8|\n"
    );
    Map<String, Object> pseudoResults = SlimCommandRunningClient.resultToMap(
            asList(asList("scriptTable_id_0/scriptTable_s_id_0", "7"))
    );
    SlimAssertion.evaluateExpectations(assertions, pseudoResults);

    String scriptTable = script.getChildren().get(0).getTable().toString();
    String expectedScript =
      "[[scenario, echo, input, giving, output], [check, echo, 7, fail(a=7;e=8)]]";
    assertEquals(expectedScript, scriptTable);
    assertEquals(0, testContext.getTestSummary().getRight());
    assertEquals(1, 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 inputAndOutputWithSymbol() throws Exception {
    SlimTestContextImpl testContext = makeTables(
      "!|scenario|echo|input|giving|output|\n" +
        "|check|echo|@input|@output|\n" +
        "\n" +
        "!|script|\n" +
        "|$V=|echo|7|\n" +
View Full Code Here

    assertEquals(expectedScript, scriptTable);
  }

  @Test
  public void scenarioExtraArgumentsAreIgnored() throws Exception {
    SlimTestContextImpl testContext = makeTables(
      "!|scenario|echo|input|giving|output||output2|\n" +
        "|check|echo|@input|@output|\n" +
        "\n" +
        "!|script|\n" +
        "|echo|7|giving|7|\n"
    );
    Map<String, Object> pseudoResults = SlimCommandRunningClient.resultToMap(
            asList(asList("scriptTable_id_0/scriptTable_s_id_0", "7"))
    );

    SlimAssertion.evaluateExpectations(assertions, pseudoResults);

    String scriptTable = script.getChildren().get(0).getTable().toString();
    String expectedScript =
      "[[scenario, echo, input, giving, output, , output2], [check, echo, 7, pass(7)]]";
    assertEquals(expectedScript, scriptTable);
    String dtHtml = script.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 matchesScenarioWithMostArguments() throws Exception {
    SlimTestContextImpl testContext = new SlimTestContextImpl();
    WikiPageUtil.setPageContents(root, "" +
        "!|scenario|Login user|name|\n" +
        "|should not get here|\n" +
        "\n" +
        "!|scenario|Login user|name|with password|password|\n" +
View Full Code Here

    assertEquals(expectedInstructions, instructions());
  }

  @Test
  public void doesntMatchScenarioWithNoArgumentsThatSharesFirstWord() throws Exception {
    SlimTestContextImpl testContext = new SlimTestContextImpl();
    WikiPageUtil.setPageContents(root, "" +
        "!|scenario|login |\n" +
        "|should not get here|\n" +
        "\n" +
        "!|scenario|connect to |name|with password|password|\n" +
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.