HTML and CSS Reference
In-Depth Information
Code View:
import junit.framework.TestCase;
import net.sourceforge.jwebunit.junit.*;
public class LinkChecker extends TestCase {
private WebTester tester;
public LinkChecker(String name) {
super(name);
tester = new WebTester();
tester.getTestContext().setBaseUrl(
"http://www.elharo.com/");
}
public void testFormSubmission() {
// start at this page
tester.beginAt("/blog/");
// check that the form we want is on the page
tester.assertFormPresent("searchform");
/// check that the input element we expect is present
tester.assertFormElementPresent("s");
// type something into the input element
tester.setTextField("s", "Linux");
// send the form
tester.submit();
// we're now on a different page; check that the
// text on that page is as expected.
tester.assertTextPresent("Windows Vista");
}
}
FitNesse
FitNesse ( http://fitnesse.org/ ) is a Wiki designed to enable business users to write tests in table format.
Business users like spreadsheets. The basic idea of FitNesse is that tests can be written as tables, much like a
spreadsheet. Thus, FitNesse tests are not written in Java. Instead, they are written as a table in a Wiki.
You do need a programmer to install and configure FitNesse for your site. However, once it's running and a few
sample fixtures have been written, it is possible for savvy business users to write more tests. FitNesse works
best in a pair environment, though, where one programmer and one business user can work together to define
the business rules and write tests for them.
For web app acceptance testing, you install Joseph Bergin's HtmlFixture
( http://fitnesse.org/FitNesse.HtmlFixture ) . It too is based on HtmlUnit. It supplies instructions that are useful
for testing web applications such as typing into forms, submitting forms, checking the text on a page, and so
forth.
 
Search WWH ::




Custom Search