Package com.meterware.httpunit

Examples of com.meterware.httpunit.WebTable


        // render the page for the first time
        rd.forward(request, response);
    }

    public void endSimpleRender(WebResponse response) throws Exception {
        WebTable tables[] = response.getTables();
        assertEquals(1, tables.length);
        WebTable table = tables[0];
        System.err.println("table = " + table);
        // the table has 2 rows because of the way that httpunit parses it
        assertEquals(2, table.getRowCount());
    }
View Full Code Here


        return lifecycleId != null ? lifecycleId
                : LifecycleFactory.DEFAULT_LIFECYCLE;
    }

    public void endAddARow(WebResponse response) throws Exception {
        WebTable tables[] = response.getTables();
        assertEquals(1, tables.length);
        WebTable table = tables[0];
        System.err.println("table = " + table);
        // the table has 3 rows because of the way that httpunit parses it
        assertEquals(3, table.getRowCount());
    }
View Full Code Here

        HTMLElement divtotal = response.getElementWithID("divtotal");
        Assert.assertEquals("7.0", divtotal.getText());

        WebTable[] tables = response.getTables();
        Assert.assertEquals("Wrong number of tables.", 1, tables.length);
        WebTable table = tables[0];
        Assert.assertEquals("Wrong number of rows.", 5, table.getRowCount());
        Assert.assertEquals("Total not found in las row.", "7.0", table.getCellAsText(4, 0));

    }
View Full Code Here

        response = runner.getResponse(request);

        WebTable[] tables = response.getTables();
        Assert.assertEquals("Wrong number of tables.", 1, tables.length);
        WebTable table = tables[0];

        Assert.assertEquals("invalid id", "idX", table.getID());

        Assert.assertEquals("invalid attribute value", "cellspacingX", table.getAttribute("cellspacing"));
        Assert.assertEquals("invalid attribute value", "cellpaddingX", table.getAttribute("cellpadding"));
        Assert.assertEquals("invalid attribute value", "frameX", table.getAttribute("frame"));
        Assert.assertEquals("invalid attribute value", "rulesX", table.getAttribute("rules"));
        Assert.assertEquals("invalid attribute value", "styleX", table.getAttribute("style"));
        Assert.assertEquals("invalid attribute value", "summaryX", table.getAttribute("summary"));
        Assert.assertEquals("invalid attribute value", "classX table", table.getAttribute("class"));

        TableCell cell = table.getTableCell(1, 0);
        Assert.assertEquals("invalid attribute value", "styleX", cell.getAttribute("style"));
        Assert.assertEquals("invalid attribute value", "classX", cell.getAttribute("class"));

    }
View Full Code Here

        WebTable[] tables = response.getTables();
        Assert.assertEquals("Wrong number of tables.", 4, tables.length);

        for (int j = 0; j < tables.length; j++)
        {
            WebTable table = tables[j];
            Assert.assertEquals("Wrong number of columns in table." + j, 2, table.getColumnCount());
            Assert.assertEquals("Wrong number of rows in table." + j, 5, table.getRowCount());

            for (int u = 1; u < 5; u++)
            {
                Assert.assertEquals("Wrong value in table cell.", Integer.toString(u), table.getCellAsText(u, 1));
            }
        }

    }
View Full Code Here

        WebTable[] tables = response.getTables();
        Assert.assertEquals("Wrong number of tables in result.", 4, tables.length);

        for (int j = 0; j < tables.length; j++)
        {
            WebTable table = tables[j];
            Assert.assertEquals("Wrong number of rows in table " + (j + 1), 2, table.getRowCount());
            Assert.assertEquals("Wrong content in cell for table " + (j + 1), "ant", table.getCellAsText(1, 0));
            Assert.assertEquals("Wrong content in cell for table " + (j + 1), "bee", table.getCellAsText(1, 1));
        }
    }
View Full Code Here

        WebTable[] tables = response.getTables();
        Assert.assertEquals("Wrong number of tables.", 4, tables.length);

        for (int j = 0; j < tables.length; j++)
        {
            WebTable table = tables[j];
            Assert.assertEquals("Wrong number of columns in table." + j, 2, table.getColumnCount());
            Assert.assertEquals("Wrong number of rows in table." + j, 5, table.getRowCount());

            for (int u = 1; u < 5; u++)
            {
                Assert.assertEquals("Wrong value in table cell.", Integer.toString(u), table.getCellAsText(u, 1));
            }
        }

    }
View Full Code Here

            Assert.assertEquals(
                "Content in cell [" + j + ",2] in main table is wrong",
                KnownValue.BEE,
                tables[0].getCellAsText(j, 2));

            WebTable nested = tables[0].getTableCell(j, 3).getFirstMatchingTable(new HTMLElementPredicate()
            {

                @Override
                public boolean matchesCriteria(Object htmlElement, Object criteria)
                {
                    return true;
                }
            }, null);

            Assert.assertNotNull("Nested table not found in cell [" + j + ",3]", nested);
            Assert.assertEquals("Wrong number of columns in nested table", 3, nested.getColumnCount());
            Assert.assertEquals("Wrong number of rows in nested table", 4, nested.getRowCount());

            for (int x = 1; x < nested.getRowCount(); x++)
            {
                Assert.assertEquals(
                    "Content in cell [" + x + ",0] in nested table is wrong",
                    Integer.toString(x),
                    nested.getCellAsText(x, 0));
                Assert.assertEquals(
                    "Content in cell [" + x + ",1] in nested table is wrong",
                    KnownValue.ANT,
                    nested.getCellAsText(x, 1));
                Assert.assertEquals(
                    "Content in cell [" + x + ",2] in nested table is wrong",
                    KnownValue.CAMEL,
                    nested.getCellAsText(x, 2));
            }

        }

    }
View Full Code Here

        assertEquals("on", form.getParameterValue("searchForm:searchTags"));
        String searchText = "cat";
        form.setParameter("searchForm:searchString", searchText);
        form.submit();
        resp = wc.getCurrentPage();
        WebTable resultTable = resp.getTableStartingWithPrefix("Map");
        assertTrue(resultTable.getRowCount() > 2);
    }
View Full Code Here

        tester.setFormElement("startTime[" + slot + "]", startTime);
        tester.selectOption("person1Id[" + slot + "]", firstPersonInitials);
        tester.submit();
        tester.assertOnTaskPage();
        tester.assertTextInTable("time_entries", startTime);
        WebTable table = tester.getDialog().getWebTableBySummaryOrId("time_entries");
        assertTrue("endTime not empty", StringUtils.isBlank(table.getCellAsText(1, 1)));
        assertTrue("duration not empty", StringUtils.isBlank(table.getCellAsText(1, 3)));
    }
View Full Code Here

TOP

Related Classes of com.meterware.httpunit.WebTable

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.