Dashboard > Struts University > Home > MailReader Training Course > Topics > Menu-Notes
Menu-Notes
Added by Ted Husted, last edited by Ted Husted on Jul 14, 2007  (view change)
Labels: 
(None)


Once we know the business layer is sound, we can test the presentation layer too.

Presentation - Test Driving Web Development

How does Selenium IDE fit into an overall testing strategy? What does Selenium actually do? How does it work? Can Selenium help simplify testing? Are there any best practices?

We explore and install a popular testing tool called Selenium IDE.

  • Testing MVC
  • How Selenium Works
  • Simplifying Test Scripts
  • Best Practices

Workshop - Menu

Story: Subscribers can select available tasks from a list, including edit Profile and Logout.

  • Create a menu page for registered users
  • Utilize Struts tags to display user's name
  • Create a Selenium IDE tests to prove the menu page works!
  • Install Selenium IDE add-on for FireFox
  • Utilize Canoo WebTest to verify navigation within the application.

Prerequisites

  • property tag
  • "chain" result type
  • Selenium IDE concepts

Exercises

  • Review the Menu user case.
  • Add a Menu.jsp to display the Edit and Logout tasks
    • Include the user's name in the page
  • Add a Menu action.
  • On a successful registration, go to the Menu action.
  • If your action did not utilize MailReaderSupport, try it again with class="MailReaderSupport"
  • Install Selenium IDE into FireFox https://addons.mozilla.org/en-US/firefox/addon/2079
  • Record test that Register's Trillian with the application
    • See Register user case for sample data
    • To reset database after a test run, open Debug perspective, and from the Servers view, stop, clean, and start Tomcat
Hint code

To show the newly registered user's name, use the property tag on the Menu page.

<h3>Main Menu Options for <s:property value="fullName"/></h3>

And "chain" to the menu page from the Register_save action.

<action name="Register_save" class="Register" method="save">
    <result name="input">/pages/Register.jsp</result>
    <result type="chain">Menu</result>
    </action>

As to Selenium IDE

  • Change the default Web Browser in Eclipse (under Windows), or open FireFox separately after starting the Server
  • Open Selenium IDE under FireFox Tools
  • Change the Selenium IDE Options to "Record AssertTitle automatically"
  • When playing back and editing a test, turn the recorder off (toggle round red button "up")
  • When a clicking on a control changes the page, change "Click" to "ClickAndWait"

Accomplishments

  • Created menu page with dynamic elements
  • Utilized Selenium IDE to verify navigation within the application.

Extra Credit

  • Run the test again? Does it fail, as expected?
  • Change the Selenium IDE mode from Run to Walk, and then to Step. What happens?
    • Remember to reset the database in between test runs!
  • Try running the test with the "Selenium Test Runner" (see button bar).
  • Export the HTML script to Java, install Selenium Remote Control, and run the test under JUnit (if you dare!)

Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators