Package fitnesse.testsystems.slim

Examples of fitnesse.testsystems.slim.Table


  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);
    }
    assertions.addAll(st.getAssertions());
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

  @Test
  public void canSeeIfItIsASpecifcationsTable() throws Exception {
     String page = "<table><tr><td>Suite</td></tr><tr><td>Page</td><td>TestPageOne</td></tr><tr><td></td></tr></table>";
    HtmlTableScanner scanner = new HtmlTableScanner(page);
    Table table = scanner.getTable(0);
    assertTrue(SuiteSpecificationRunner.isASuiteSpecificationsTable(table));
    page = "<table><tr><td>no suite</td></tr><tr><td>Page</td><td>TestPageOne</td></tr></table>";
    scanner = new HtmlTableScanner(page);
    table = scanner.getTable(0);
    assertFalse(SuiteSpecificationRunner.isASuiteSpecificationsTable(table));
View Full Code Here

  @Test
  public void shouldBeAbleToParseASmallTableAndGetThePageName() throws Exception {
    String page = "<table><tr><td>Suite</td></tr><tr><td>Page</td><td>TestPageOne</td></tr><tr><td></td></tr></table>";
    HtmlTableScanner scanner = new HtmlTableScanner(page);
    Table table = scanner.getTable(0);
    assertTrue(runner.getImportantTableInformation(table));
    assertEquals("TestPageOne",runner.searchRoot.getName());
    assertEquals(0,runner.testPageList.size());
  }
View Full Code Here

  @Test
  public void shouldBeAbleToGetTheTitleRegExFromATable() throws Exception {
    String page = "<table><tr><td>Suite</td></tr><tr><td>Page</td><td>TestPageOne</td></tr><tr><td>Title</td><td>ChildPage</td></tr></table>";
    HtmlTableScanner scanner = new HtmlTableScanner(page);
    Table table = scanner.getTable(0);
    assertTrue(runner.getImportantTableInformation(table));
    assertEquals("TestPageOne", runner.searchRoot.getName());
    assertEquals("ChildPage", runner.titleRegEx);
  }
View Full Code Here

  @Test
  public void shouldBeAbleToGetTheContentRegExFromTable() throws Exception {
    String page = "<table><tr><td>Suite</td></tr><tr><td>Page</td><td>TestPageOne</td></tr><tr><td>Content</td><td>has.*content</td></tr></table>";
    HtmlTableScanner scanner = new HtmlTableScanner(page);
    Table table = scanner.getTable(0);
    assertTrue(runner.getImportantTableInformation(table));
    assertEquals("has.*content", runner.contentRegEx);
  }
View Full Code Here

TOP

Related Classes of fitnesse.testsystems.slim.Table

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.