The verifyProperty won't work in the ifStep but you could but it after the
ifStep. I don't know what you are trying to do because you want the test to
fail if the statusCode is not 200 but you still want to run tests? I don't
think this is correct testing structure but I could be wrong :) I have coded
the below code and it fails after the ifStep, don't know if it will help or not
:)
<config host="www.google.com" protocol="http" port="80">
<option name="ThrowExceptionOnFailingStatusCode" value="false"/>
</config>
<storeProperty property="test" value="20" eval="false"/>
<ifStep>
<condition>
<verifyProperty property="test" text="200"/>
</condition>
<invoke url=""/>
</ifStep>
<verifyProperty property="test" text="200"/>
<invoke url="/pics/loginfiles"/>
<verifyTitle text="404 Not Found"/>
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Douglas Beattie
Sent: Wednesday, February 13, 2008 10:21 AM
To: [email protected]
Subject: RE: [Webtest] Help needed on <ifStep ... />
William,
I could possibly do this with the verifyProperty, but I have also set:
<config>
<option name="ThrowExceptionOnFailingStatusCode" value="false"/>
</config>
With this my test would still proceed even though I wouldn't have a valid
sessionId.
I'll try in a few minutes your other suggestion where you said "Perhaps put a
verifyProperty after the invoke in your ifStep". I have a standup meeting to
attend right now though.
There are some other things I would like to do later in the test, but perhaps I
should break them out into a separate test so I could just fail this test
without worrying about them.
Thanks for your help William.
Regards,
Doug
>>> "Soula, William" <[EMAIL PROTECTED]> 02/13/08 9:08 AM >>>
You want the test to fail if the satusCode is not 200? What's wrong with just
a verifyProperty property="statusCode" test="200"/> and then your code after
that. That way it will verify that the property is 200 and if it is the rest
of the code will execute and if its not the testscript will fail? The ifStep
is a good way to do stuff or not based on a value and continue testing but if
you want it to fail it seems like just a verifyProperty will solve your problem.
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: Wednesday, February 13, 2008 9:58 AM
To: [email protected]
Subject: RE: [Webtest] Help needed on <ifStep ... />
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
_______________________________________________
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
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest