|Re: Skip a test case based on variable [message #1112771 is a reply to message #1112414]
||Fri, 20 September 2013 06:28
| Mike Airey
Registered: July 2013
This is the method I use to fake up conditional test case execution, applied to your example:
1) TEST STEP: Store "true" or "false" in string variable $LOGGED_IN according to your login state
2) TEST STEP: Use string comparison to check if $LOGGED_IN == "true"
---> 2a) TEST CASE AS EVENT HANDLER: Perform login and then set $LOGGED_IN to "true". Event handler type: Check failed, Retry (once).
After doing this your AUT should be logged in, whether or not it was already, with no errors reported.
If it was already logged in, only 1) and 2) are run.
If it was not logged in:
1) and 2) run,
2a) handles the failure (logs in and sets $LOGGED_IN="true"), and
Jubula retries 2) which then succeeds.
Note: you must use a Test Step for 2), not a Test Case, otherwise $LOGGED_IN will not be re-evaluated when 2) is retried.
P.S. If anyone can improve on this method, please let us know. I'd like a more elegant solution if possible.
[Updated on: Fri, 20 September 2013 06:29]
Report message to a moderator
|Re: Skip a test case based on variable [message #1112779 is a reply to message #1112771]
||Fri, 20 September 2013 06:44
| Alexandra Schladebeck
Registered: July 2009
Thanks for the example Mike! |
For things like "login if you need to", "close the dialog if it's there" etc, then you can probably also structure the test without using the variables:
- Check existence of username field / login window (set to false)
-- Event Handler: check failed & retry - perform login
This way, if the dialog is there, then the login is performed, then the check is retried -> successfully.
If the login dialog isn't there, then the check is successful first time around.
There's an example of this for an "occasional dialog" on the testing portal:
(login may be required).
For other cases, the variable approach is the only way, but if there's something in the GUI you can orient to in the test, then it saves the variable steps.
Hope that helps!
Powered by FUDForum
. Page generated in 0.01808 seconds