Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Main
TextFormattingRules
WhatIsWiki




JSPWiki v2.2.33

[RSS]


Hide Menu

SandBox


This is version 222. 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");
    }
}

quaker parrots pacific parrotlet scarlet macaw cockatiels blue and gold macaw


Attachments:


Go to top   More info...   Attach file...
This particular version was published on 06-Nov-2006 13:52:35 MST by 61.30.47.22.