Perhaps I should have clarified this better and shown a current code snippit.
---------------------------------------------------------------
...
<storeXPath
description="Extract StatusCode"
property="StatusCode"
xpath="//@statusCode"
/>
<storeProperty property="test" value="#{StatusCode}" eval="false"/>
<ifStep description="if StatusCode == 200 do the following:">
<condition>
<verifyProperty property="test" text="200"/>
</condition>
<!-- This executes when the StatusCode returned was 200 -->
<storeXPath
description="Extract session ID for use with future calls"
property="sessionID"
xpath="//@id"
/>
<invoke
url="http://${HOST}:${PORT}/familytree/${VERSION}/person/me/?sessionId=#{sessionID}"
description="Get person"
/>
...
<!-- Need some way to cause the test to fail if the StatusCode was not 200 -->
...
</ifStep>
...
---------------------------------------------------------------
How do I best cause the test to fail if the original condition is not true?
Regards,
Doug
>>> "Douglas Beattie" <[EMAIL PROTECTED]> 02/13/08 8:29 AM >>>
Thanks William.
This works for the most part.
How would I get a failure condition (perhaps the "not" of this) to cause the
test to fail for me too?
Regards,
Doug
>>> "Soula, William" <[EMAIL PROTECTED]> 02/13/08 6:46 AM >>>
See if this helps. You can use the <condition> tags which is a "Group of steps
which if successful should cause inner steps to be executed." Below is an
example:
<storeProperty property="test" value="200" eval="false"/>
<ifStep>
<condition>
<verifyProperty property="test" text="200"/>
</condition>
<invoke url=""/>
</ifStep>
If you set the property #{test} to 20 then the invoke will never occur because
the condition failed but if it is set to 200 like I have it, the invoke will
occurr because the condition passed.
William Soula
QA Analyst
Pointserve, Inc.
110 Wild Basin Road
Suite 300
Austin, Texas 78746
O: 512.617.5311
F: 512.617.0466
----- Original Message-----
From: webtest- [EMAIL PROTECTED] [mailto:webtest- [EMAIL PROTECTED] On Behalf
Of Douglas Beattie
Sent: Tuesday, February 12, 2008 3:39 PM
To: [email protected]
Subject: [Webtest] Help needed on <ifStep ... />
I have a test with the following in it:
-----------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "../../dtd/Project.dtd"> <project
name="getMeWithValidSessionId" default="test">
<target name="test">
<webtest name="Get 'Me' With Valid SessionId">
<config>
<option name="ThrowExceptionOnFailingStatusCode" value="false"/>
</config>
<steps>
<invoke url="http://${HOST}:${PORT}/identity/${VERSION}/login"
username="${VALIDUSER}" password="${VALIDPASSWORD}"
description="Get 'Me' With Valid SessionId"
/>
<verifyXPath
description="Check login status code equals 200"
xpath="//@statusCode='200'"
/>
<storeXPath
description="Extract StatusCode"
property="StatusCode"
xpath="//@statusCode"
/>
<echo message="#{StatusCode}"/>
<ifStep description="if StatusCode == 200 do the following:"
test="#{StatusCode}==200">
<storeXPath
description="Extract session ID for use with future calls"
property="sessionID"
xpath="//@id"
/>
<echo message="#{sessionID}"/>
...
I am wondering how to get a "test=" evaluation done to see if the StatusCode is
equal to 200 before proceeding. The examples I've seen only evaluate a boolean
test value.
How can I use "test=" to work with an evaluation?
Thanks,
Doug
----------------------------------------------------------------------
NOTICE: This email message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies of
the original message.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
----------------------------------------------------------------------
NOTICE: This email message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies of
the original message.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
----------------------------------------------------------------------
NOTICE: This email message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies of
the original message.
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest