[Webtest] newB confusion on storeregex

Mike D'Ambrogia webtest@lists.canoo.com
Thu, 15 Jul 2004 06:15:55 -0700


I know that it fails on the bottom_of_page step, what I don't know is
the name of the page that the step ran against since it is not returned
in the ANT error msg.  

I setup an example to help demonstrate what I'm facing, all of these
files are at http://dev.snfv.org/webtest/example.zip but you supply your
own definition.xml file.

/example.xml:
---------------
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "./include/WebTest.dtd"[
	<!ENTITY definition		SYSTEM
"./include/definition.xml">
	<!ENTITY example-config	SYSTEM "./config/example-config.xml">
	<!ENTITY bop			SYSTEM
"file:./modules/bottom_of_page.xml">
	<!ENTITY cashpg			SYSTEM
"file:./modules/cash.xml">
	<!ENTITY effortpg		SYSTEM
"file:./modules/effort.xml">
	<!ENTITY stonepg		SYSTEM
"file:./modules/stone.xml">
]>

<project name="ExampleDemo" basedir="." default="Check snfv.org">
	&definition;
	<target name="Check snfv.org">
		<testSpec name="snfv">
		&example-config;
			<steps>
				&cashpg;
				&effortpg;
				&stonepg;
			</steps>
		</testSpec>
	</target>
</project>


/config/example-config.xml:
----------------------------
<config 
	host="dev.snfv.org"
	port="80"
	protocol="http"
	basepath="webtest"
/>


/modules/bottom_of_page.xml:
------------------------------
<verifyxpath stepid="look for the bottom of the page"
		xpath="//span[@id='end_of_doc']"/>


/modules/cash.xml:
--------------------
<invoke 
	stepid="Go to the cash page"
	url="cash.htm" />
<!--check for the bottom of the page-->
&bop;

/modules/effort.xml:
---------------------_
<invoke 
	stepid="Go to the effort page"
	url="effort.htm" />
<!--check for the bottom of the page-->
&bop;


/modules/stone.xml:
---------------------
<invoke 
	stepid="Go to the stone page"
	url="stone.htm" />
<!--check for the bottom of the page-->
&bop;

The 3 .htm pages all look the same, they all look like:

http://dev.snfv.org/webtest/effort.htm:
-----------------------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Untitled</title>
</head>

<body>

this is the effort.htm page

<span id="end_of_doc">&nbsp;</span>
</body>
</html>


The problem is that in one of the 3 .htm files I changed the id of the
<span> tag to force an error for this example.  When I run the test via
"ant -buildfile example.xml" the message that I get back from ANT
states:

Check snfv.org:

BUILD FAILED
Test step verifyxpath named "look for the bottom of the page" failed
with messag
e "xpath test: //span[@id='end_of_doc'] matched no nodes"

So which of the 3 files is it??  How do I set webtest up so that when it
throws an error I can get the page name back?  I need a way to set a
property that contains the name of the page prior to calling the &bop;
so that if &bop; fails I can display the page name within the step name
as part of the error msg.

What I want to see in the error msg is:

Check snfv.org:

BUILD FAILED
Test step verifyxpath named "look for the bottom of the cash.htm page"
failed with messag
e "xpath test: //span[@id='end_of_doc'] matched no nodes"

Thanks in advance for the help

Mike