Testing Web Applications

by Sean Dawson and Kristin Kerr



Listing One



getTestContext().setBaseUrl("http://localhost");

beginAt("/main");

setField("username", username);

setField("password", password);

assertSubmitButtonPresent("login");

assertSubmitButtonPresent("reset");

submit("login");





Listing Two



private void gotoProjectAdmin() {

   login();

   followLink("System Administration");

   followLink("Manage Projects");

}





Listing Three



protected void addProject(String parentProject, String project, String url) {

   gotoProjectAdmin();

   followLink("Create a project");

   assertFormPresent();

   setField("projectName", project);

   setField("parentProject", parentProject);

   setField("courseURL", url);

   submit("create");

}





1



