Package fitnesse.testsystems.slim

Examples of fitnesse.testsystems.slim.HtmlTableScanner


  }

  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);
    if (t.getCellContents(0,0).equals("script")) {
      script = new ScriptTable(t, "id", testContext);
    } else {
      script = new ScriptTableTest.LocalizedScriptTable(t, "id", testContext);
    }
View Full Code Here


        "!|scenario|Login user|name|with password|password|\n" +
        "|login|@name|with|@password|\n" +
        "\n" +
        "!|script|\n" +
        "|Login user Bob with password xyzzy|\n");
    TableScanner ts = new HtmlTableScanner(root.getHtml());
    ScenarioTable st1 = new ScenarioTable(ts.getTable(0), "s1_id", testContext);
    ScenarioTable st2 = new ScenarioTable(ts.getTable(1), "s2_id", testContext);
    script = new ScriptTable(ts.getTable(2), "id", testContext);
    assertions.addAll(st1.getAssertions());
    assertions.addAll(st2.getAssertions());
    assertions.addAll(script.getAssertions());
    List<CallInstruction> expectedInstructions =
            asList(new CallInstruction("scriptTable_id_0/scriptTable_s2_id_0", "scriptTableActor", "loginWith", new Object[]{"Bob", "xyzzy"}));
View Full Code Here

        "!|scenario|connect to |name|with password|password|\n" +
        "|login with username|@name |and Password|@password    |\n" +
        "\n" +
        "!|script|\n" +
        "|connect to  |Bob| with password| xyzzy|\n");
    TableScanner ts = new HtmlTableScanner(root.getHtml());
    ScenarioTable st1 = new ScenarioTable(ts.getTable(0), "s1_id", testContext);
    ScenarioTable st2 = new ScenarioTable(ts.getTable(1), "s2_id", testContext);
    script = new ScriptTable(ts.getTable(2), "id", testContext);
    assertions.addAll(st1.getAssertions());
    assertions.addAll(st2.getAssertions());
    assertions.addAll(script.getAssertions());
    List<CallInstruction> expectedInstructions =
            asList(new CallInstruction("scriptTable_id_0/scriptTable_s2_id_0", "scriptTableActor", "loginWithUsernameAndPassword", new Object[]{"Bob", "xyzzy"}));
View Full Code Here

        "!|scenario|connect to |name|with password|password|\n" +
        "|login with username|@name |and Password|@password    |\n" +
        "\n" +
        "!|script|\n" +
        "|connect to  |Bob| with password| xyzzy|\n");
    TableScanner ts = new HtmlTableScanner(root.getHtml());
    ScenarioTable st1 = new ScenarioTable(ts.getTable(0), "s1_id", testContext);
    ScenarioTable st2 = new ScenarioTable(ts.getTable(1), "s2_id", testContext);
    script = new ScriptTable(ts.getTable(2), "id", testContext);
    assertions.addAll(st1.getAssertions());
    assertions.addAll(st2.getAssertions());
    assertions.addAll(script.getAssertions());
    List<CallInstruction> expectedInstructions =
            asList(new CallInstruction("scriptTable_id_0/scriptTable_s2_id_0", "scriptTableActor", "loginWithUsernameAndPassword", new Object[]{"Bob", "xyzzy"}));
View Full Code Here

public class TableListComparerTest {
  private TableListComparer comparer;

  @Before
  public void setUp() {
    HtmlTableScanner leftHandScanner = new HtmlTableScanner("<table>empty</table>");
    HtmlTableScanner rightHandScanner = new HtmlTableScanner("<table>empty</table>");
    comparer = new TableListComparer(leftHandScanner,rightHandScanner);
  }
View Full Code Here

  }

    @Test
  public void shouldGetAScoreBackFromCompareTables() throws Exception {
    String table1text = "<table><tr><td>x</td></tr></table>";
    Table table1 = (new HtmlTableScanner(table1text)).getTable(0);
    String table2text = "<table><tr><td>x</td></tr></table>";
    Table table2 = (new HtmlTableScanner(table2text)).getTable(0);
    double score = comparer.compareTables(table1,table2);
    assertEquals(HistoryComparer.MAX_MATCH_SCORE,score, .01);
  }
View Full Code Here

  }

  @Test
  public void shouldCompareTwoSimpleEqualTables() throws Exception {
    String table1text = "<table><tr><td>x</td></tr></table>";
    Table table1 = (new HtmlTableScanner(table1text)).getTable(0);
    String table2text = "<table><tr><td>x</td></tr></table>";
    Table table2 = (new HtmlTableScanner(table2text)).getTable(0);
    assertTrue(comparer.theTablesMatch(comparer.compareTables(table1, table2)));
  }
View Full Code Here

  }

  @Test
  public void shouldCompareTwoSimpleUnequalTables() throws Exception {
    String table1text = "<table><tr><td>x</td></tr></table>";
    Table table1 = (new HtmlTableScanner(table1text)).getTable(0);
    String table2text = "<table><tr><td>y</td></tr></table>";
    Table table2 = (new HtmlTableScanner(table2text)).getTable(0);
    assertFalse(comparer.theTablesMatch(comparer.compareTables(table1, table2)));
  }
View Full Code Here

  }

  @Test
  public void shouldCompareTwoDifferentlySizedTables() throws Exception {
    String table1text = "<table><tr><td>x</td></tr></table>";
    Table table1 = (new HtmlTableScanner(table1text)).getTable(0);
    String table2text = "<table><tr><td>x</td><td>y</td></tr></table>";
    Table table2 = (new HtmlTableScanner(table2text)).getTable(0);
    assertFalse(comparer.theTablesMatch(comparer.compareTables(table1, table2)));
  }
View Full Code Here

  @Test
  public void shouldIgnoreCollapsedTables() throws Exception {
    String table1text = "<table><tr><td>has collapsed table</td></tr><tr class=\"scenario-detail\"><td><table><tr><td>bleh1</td></tr></table></td></tr></table>";
    String table2text = "<table><tr><td>has collapsed table</td></tr><tr class=\"scenario-detail\"><td><table><tr><td>HAHA</td></tr></table></td></tr></table>";
    Table table1 = (new HtmlTableScanner(table1text)).getTable(0);
    Table table2 = (new HtmlTableScanner(table2text)).getTable(0);
    double score = comparer.compareTables(table1, table2);
    assertEquals(HistoryComparer.MAX_MATCH_SCORE, score, .01 );
    assertTrue(comparer.theTablesMatch(score));
  }
View Full Code Here

TOP

Related Classes of fitnesse.testsystems.slim.HtmlTableScanner

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.