[Webtest] newB confusion on storeregex

Lisa Crispin webtest@lists.canoo.com
Wed, 14 Jul 2004 22:11:11 +0000


I don't completely understand what you're trying to do.  I don't know if it will help but here is a simple example of how I use storeregex.

	<storeregex stepid="get check number to select"
		text=".*input name=&quot;check([0-9]+)&quot;"
		property="checkNbr"
		group="1"
		/>
Here is the relevant HTML:

<td valign="top" class="tblCellOddBox3" align="center" width="5%"><span class="tblValueText3"><input name="check36863" type="checkbox" class="control" value="36863"></span></td>

My hope is to learn xpath because maybe I could do this with storexpath!
-- Lisa

-------------- Original message from "Mike D'Ambrogia" : -------------- 
All,

Enjoying the webtest testing so far.  But I'm confused over how to use the storeregex element.  I'm trying to build a dynamic variable to store the name of the page so that should the page test fail it will return the page name in the output.  I've stuffed a span element at the bottom of each page onthe site, and built a reusable xml file that tests for it via:

<verifyxpath stepid="look for the bottom of the #{pagename} page"
  xpath="//span[@id='end_of_doc']"/>

and returns true when I find the span html tag with an id="end_of_doc".  that all works great.  the problem is in the reporting when it fails, right now I just get a msg stating that :

Test step verifyxpath named "look for the bottom of the #{pagename} page" failed
 with message "xpath test: //span[@id='end_of_doc'] matched no nodes"

but I have no idea of which of the many, many pages it failed on.  I'm trying to stuff a page name into #{pagename} into the pagename dynamic variable prior to calling the verifyxpath step.   but the example for storeregex makes no sense to me.  I'm somewhat savvy with regex, but I'm lost on the example.

I know this is wrong, but have no idea how to fix it:

<storeregex 
 stepid="store the variable case.asp to the pagename dynamic property"
  text="case.asp"
  group="1"
  property="pagename" />


hopefully all this makes sense

mike