Tuesday January 06, 2004
HowTo: Get an input field's value with Canoo's WebTest
I should start this by saying that I love Canoo's WebTest. It allows you to test clicking through your webapp as if you're using a browser. You simply write your tests in an XML file (which is really an Ant build file), and then run it with Ant. Usually, in my webapps, I write simple tests for CRUD on entities - i.e. EditUser (tests pulling up the edit screen), SavePosition (edit and save, verifies next screen's title), SearchUsers (verifies list screen's title).
One of the issues I had this morning was testing a wizard with WebTest. This was because I didn't know how to get the id of the new record after it was added. Now I found a way. Let's say you have a Create a Job wizard. On the first screen, you enter the job, and on the second, you add the required skills, on the third, you view a summary. To get the new id of the job, you can use XPath to get the hidden field named "jobId" - to do with what you may (i.e. click on a link to the third screen). Here's how:
{{{
Search This Site
Recent Entries
- Wine Tasting in Napa Valley
- How to build a Shot-Ski
- Bus Project Update
- Farewell to the 2011-2012 Ski Season
- Cruising around the Western Caribbean
- Spring Break!
- A Spectacular Trip to Stockholm and Madrid
- Comparing Web Frameworks and HTML5 with Play Scala at Jfokus 2012
- Play Framework 2.0 with Peter Hilton at Jfokus
- Secure JSON Services with Play Scala and SecureSocial
Posted by Unknown on January 06, 2004 at 08:38 PM MST #
There are many testing tools like MaxQ that can record mouse clicks, etc. but I'll leave that up to the QA department (now I just have to find one of those ;-).
Posted by Matt Raible on January 06, 2004 at 11:31 PM MST #
Posted by Unknown on January 07, 2004 at 12:25 AM MST #
Posted by Jochen on January 07, 2004 at 04:06 AM MST #
Posted by Paul King on May 24, 2005 at 06:54 PM MDT #