Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Jubula » Multi-path logic needed in test case(Test should not fail as long as one of the conditions is satisfied)
Multi-path logic needed in test case [message #1061919] Tue, 04 June 2013 17:28 Go to next message
David Hickernell is currently offline David HickernellFriend
Messages: 85
Registered: October 2012
Member
I have a test case that needs to execute one of three other test cases, conditional upon the value selected in a particular Combo component. I tried one way of accomplishing this, testing for each of the three values and executing the appropriate test case for the condition that is satisfied, but then the two conditions that are not satisfied throw errors, which causes the entire test to count as failed.

I thought I had figured out a way of fixing this, using a variable check and a Retry event handler, but then I discovered that the behavior that I was counting on (being able to modify the variable inside the event handler) was considered incorrect and patched out.

I downloaded a project (attached to the bug in question) that supposedly demonstrates a workaround, but I must not have imported it correctly because there seems to be a lot missing from it.

So, is there some relatively straightforward way to implement this kind of multi-path logic in a test case without getting errors from the paths not taken? Or do I need to resort to the above mentioned variable-check workaround (after finding out how it actually works)?

Thanks!
Re: Multi-path logic needed in test case [message #1062099 is a reply to message #1061919] Wed, 05 June 2013 23:42 Go to previous messageGo to next message
David Hickernell is currently offline David HickernellFriend
Messages: 85
Registered: October 2012
Member
I believe that I have finally figured out a way to implement this. It is not exactly straightforward, but as far as I can tell, it works, and should theoretically be extensible to any number of paths and values to be validated.

First, each value to be compared or validated must be stored in its own variable. Then, a test case should be defined for each valid value of the conditional variable, and each case should make all of its checks (starting with the conditional) using the values stored in the variables.

Then, each case after the first should be added to its preceding case as an event handler, with Event Type=Check Failed, reentry type=RETRY, and number of retries=1. This ensures that when one of the cases passes all of its checks, no more cases will be tried.

The trick is, at the end of each case after the first, you need to set EACH variable to a value that will satisfy the preceding case, in order for each previously-failed case to succeed upon retry. This way, the test will only end up failed if there is NO case that passes all of its checks.

I have attached a relatively simple but hopefully illustrative example, added to the project mentioned in the OP, and I will be happy to explain how to use it if it is not clear. It makes use of the two text fields in the SimpleAdder (the path to the jarfile must be corrected in the configuration).

I hope this proves helpful to someone! Smile
  • Attachment: multipath.xml
    (Size: 67.95KB, Downloaded 437 times)
Re: Multi-path logic needed in test case [message #1062303 is a reply to message #1062099] Fri, 07 June 2013 06:53 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
Hi David,

Thanks for your feedback and for your example. You may also be interested in this enhancement request.

Best regards,
Alex
Re: Multi-path logic needed in test case [message #1083151 is a reply to message #1062303] Fri, 09 August 2013 14:47 Go to previous messageGo to next message
Eric Schellhammer is currently offline Eric SchellhammerFriend
Messages: 6
Registered: July 2013
Junior Member
Situations like this with conditional execution would be much easier to implement if there was a reentry type like "SUCCESS" or "ACCEPT" which, after executing the event handler, simply marked the test case as successful and continued with the next.
You would not have to work around the multiple execution of the current test case and still have it marked green in the test results.
Re: Multi-path logic needed in test case [message #1085268 is a reply to message #1083151] Mon, 12 August 2013 17:26 Go to previous message
David Hickernell is currently offline David HickernellFriend
Messages: 85
Registered: October 2012
Member
I was actually considering writing an extension that defines "Store Check" modules, that correspond to the Check modules but store the result in a specified variable as "true" or "false" instead of just returning it. This would make conditional logic much easier to implement as well. I just need to find the time.
Previous Topic:Newly created project version is not visible on the list
Next Topic:Eclipse variables
Goto Forum:
  


Current Time: Wed Apr 24 16:29:39 GMT 2024

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

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

Back to the top