Forum Discussion

krogold's avatar
krogold
Regular Contributor
7 years ago

conditional goto with groovy does not work properly

Hello,

I'm trying to do conditional workflow with groovy steps as I need to trigger on property value. Here is my testcase:

initial property value: fail_count = 0

 

- soap - Authenticate

- groovy - recover session id

- first branch : if fail_count == 0 testRunner.gotoStep(SetBlock)

                        if fail_count == 2 : increase fail_count and testRunner.gotoStep(GetPendingRequest)  // do not do SetBlock twice

- soap - SetBlock (asynchronous call)

- soap - GetPendingRequest - checks if result is 'success'

- second branch : if pending : loop on GetPendingRequest - increase fail_count

                            if fail_count = 2 : testRunner.runTestStepByName("Disconnect")

                                                         testRunner.gotoStep(Authenticate) in order to authenticate, recover session_id, etc.

                            if fail_count > 2 : do nothing, carry on looping to await for 'success' status

- Disconnect      

 

I clearly see when Disconnect is called, but it seems that it does not go back to the first step for re-authentifying. 

Does the gotoStep function really branches onto the specified step or is there another way to proceed ?

 

thank you                                                

2 Replies

    • krogold's avatar
      krogold
      Regular Contributor

      Hi,

      thanks but I tried another way, instead of going back to the step, I changed to

      - run disconnect step

      - run authentication step, wait until response is not null (with a while loop)

      - run recover session id, then goto my GetPendingSession step ...

       

      this works pretty well.

      Actually I don't remember if I made the mistake of not setting "" around my steps name, but I guess not as I used it for other steps successfully. I'll give it a try when I'll have some spare time.

       

      thanks again  ;)