Forum Discussion

LennSar's avatar
LennSar
Contributor
3 years ago

finish test case as is. Not canceled, not failed!

Hi there,

 

I have a test case that makes the use of conditional go to's. Unfortunately I cannot configure the <conditional go to> to end the test case. A work around would be to add a dummy test step at the end of the test case where I could jump but that's not really what I want. I also thought about using a groovy script but I can't find a way so that the groovy script ends the test case with whatever status is has based on the earlier assertion results.

 

Any suggestions would be highly appreciated!

  • Hi,

     

    we are using in this case a Delay-Step with 1ms 🙂 Easy and it works (Better a dummy request)

  • Hey LennSar. Would it be possible for you to share a screenshot of the test case so I can get a better idea of the flow? Thanks!

    • LennSar's avatar
      LennSar
      Contributor

      Hi joejoyce,

      hope this helps:

      At some point the test case reaches the top of the screenshot <finishTestCase>. At this test step I'd like to decide whether or not I need to do the final steps. <finishTestCase> now is a groovy script with a goTo statement. So basically it's the same as a conditional goTo test step. Both go to the <end test case dummy request> if I don't need to execute the final test steps. What I would like to have is a possibility that doesn't need the final <end test case dummy request> but simply ends the test case with whatever status it has (Pass or fail) once it reaches the test step <finishTestCase>

  • mkrausem's avatar
    mkrausem
    Occasional Contributor

    Hi,

     

    we are using in this case a Delay-Step with 1ms 🙂 Easy and it works (Better a dummy request)

    • LennSar's avatar
      LennSar
      Contributor

      Yeah a delay might be a good choice as well but I was hoping for a different approach 😛  

      • joejoyce's avatar
        joejoyce
        Staff

        Hey LennSar, I've been looking into this and checking some internal resources but so far it seems like the only methods for 'forcing' a test case to stop involve it either being cancelled or failed. I'm waiting for confirmation as to whether or not this is possible or would need to be an enhancement request. Will let you know asap! 

    • JoostDG's avatar
      JoostDG
      Frequent Contributor

      Unless I'm missing something, I don't fully understand why you make your goto statement go to a rest test step (<end test case dummy request>). mkrausem sugges a delay-step. I use in those cases a groovy test step.

      So let to <finishTestCase> go to <end test case dummy groovy test step>.

      You could even let the groovy test step log something like "Final test steps executed yes/no" depending on your condition (if you don't like dummy steps).

      • LennSar's avatar
        LennSar
        Contributor

        at the end it simply doesn't matter whether it's a rest call or a delay or a groovy script that I jump to. It's all the same approach which isn't my prefered way to begin with.

        What I was hoping for was something like testRunner.finishSuccessfully or something like that but unfortunately there is no such thing.... 

  • Whatever the case, I don't think testrunner is the answer, as it only has two methods that can stop a test run: 

     

     

    • LennSar's avatar
      LennSar
      Contributor

      yeah I realised those but I try to finish the test case successfully.