This is version 217.
It is not the current version, and thus it cannot be edited.
[Back to current version]
[Restore this version]
public class UserWebTest extends WebTestCase {
public UserWebTest(String name) {
super(name);
getTestContext().setBaseUrl("http://localhost:8080/myusers");
}
// should there be a setup method that adds a user
// before each test/method is called?
public void testWelcomePage() {
beginAt("/");
assertTitleEquals("MyUsers ~ Welcome");
}
public void testAddUser() {
beginAt("/editUser.html");
assertTitleEquals("MyUsers ~ User Details");
setFormElement("firstName", "Spring");
setFormElement("lastName", "User");
submit("save");
assertTextPresent("saved successfully");
}
public void testListUsers() {
beginAt("/users.html");
// check that table is present
assertTablePresent("userList");
// check that a set of strings are present somewhere in table
assertTextInTable("userList",
new String[] {"Spring", "User"});
}
public void testEditUser() {
beginAt("/editUser.html?id=1");
assertFormElementEquals("firstName", "Spring");
submit("save");
assertTitleEquals("MyUsers ~ User List");
}
public void testDeleteUser() {
beginAt("/editUser.html?id=1");
assertTitleEquals("MyUsers ~ User Details");
submit("delete");
assertTitleEquals("MyUsers ~ User List");
}
}
|
Attachments:
|