Forum Discussion

kaiiii's avatar
kaiiii
Regular Contributor
5 years ago

Alerternative of Runner.Stop

When I am executing test Items. In that condition few test cases have Runner.Stop after an error come.

Like there are 1 to 10 scripts in test item and no2 have condition where an error comes and due to this we can not land on next page so we put after this Runner.Stop.

 

But due to this whole execution stops and further items in test item does'nt execute.

Is there any specific method that will stop only that item execution and continue for further.

  • Wamboo's avatar
    Wamboo
    Community Hero

    Hi,


    Runner.Stop methods do always holding executing of next test item in the queue.


    What You can do is use try{throw} catch(e) {}


    In conditions, You can Log Error message and run the next test item function.


    Do not use test item tree for this one, it's impossible to re-run all specific test item elements after calling it in function in catch(e).


    In my opinion you can do is:

    1. grab all there functions in array or object in one function.

     

    function main() {
      var arrayFun = [fun1, fun2, fun3]
      // here run these functions in loop with specific try{} catch{}
      // when run remember the index of this array and when error occours run next function from array by index
    }

     


    I did not test this solution but maybe this is something that can help you.

    • Wamboo's avatar
      Wamboo
      Community Hero

      "Runner.Stop(true) ?" really?

       

      I'm gonna have to test it!

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Wamboo :

         

        Hi,

         

        "Runner.Stop(true) ?" really?

        Ah, well, this will stop execution of the current test item and continue from the next sibling. Unfortunately, there is no way to continue either with the child or the parent test item.

        I.e. exactly as you wrote:

        Runner.Stop methods do always holding executing of next test item in the queue.

         

        (There is at least one feature request to be able to do the above, but I don't have its address at hand and have no idea if guys are going to implement it. Though this is a really useful enchancement.)

         

    • SangeetNenwani's avatar
      SangeetNenwani
      Contributor

      I am using Runner.stop (true) in general event. Using execution plan, to run the testing, but as I set flag to skip the next test items, but it stops complete execution. 
      Setting on error for project is to continue running