Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Jubula » Skip a test case based on variable(Is there a "go to" or "if else" capability in Jubula)
Skip a test case based on variable [message #1112414] Thu, 19 September 2013 17:05 Go to next message
Todd P is currently offline Todd PFriend
Messages: 10
Registered: October 2012
Junior Member
Hello

I am fairly new user of Jubula. I am running test cases successfully. I have run into the situation where I want to grab a login (yes/no) state and then either preform the login test case or skip it if I am already logged in.

This is more to prepare the tool for other testing than to test the login itself.

Is there a way to tell Jubula to skip the next test case? Or am I over thinking this?

Thanks
Re: Skip a test case based on variable [message #1112771 is a reply to message #1112414] Fri, 20 September 2013 06:28 Go to previous messageGo to next message
Mike Airey is currently offline Mike AireyFriend
Messages: 11
Registered: July 2013
Junior Member
Hi,

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,
2) fails,
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.

HTH,
Mike


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 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
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:
http://testing.bredex.de/deal-with-occasional-dialog.html

(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!
Alex
Re: Skip a test case based on variable [message #1113081 is a reply to message #1112414] Fri, 20 September 2013 16:03 Go to previous message
Todd P is currently offline Todd PFriend
Messages: 10
Registered: October 2012
Junior Member
Thank you so much for your posts. Now it seems so simple after looking at your examples Smile In my case, I can simply perform the login and retry in the event handler. This works perfectly.
Previous Topic:Observed "org.eclipse.swt.SWTException: Widget is disposed" multiple time while running au
Next Topic:64 bit Problem
Goto Forum:
  


Current Time: Sat Apr 20 03:00:20 GMT 2024

Powered by FUDForum. Page generated in 0.03125 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top