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:
{{{
Posted by Unknown on January 07, 2004 at 02:38 AM 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 07, 2004 at 05:31 AM MST #
Posted by Unknown on January 07, 2004 at 06:25 AM MST #
Posted by Jochen on January 07, 2004 at 10:06 AM MST #
Posted by Paul King on May 25, 2005 at 12:54 AM MDT #