Forum Discussion

saprao's avatar
saprao
Occasional Contributor
8 years ago

what is method for stop testsuite execution in runtime through Groovy scripting

Hi,

 

Am able to stop the execution in test case level by using testrunner.cancel in run time through Groovy.

 

then same thing i have applied on test suite level but it won't worked out.

 

Please suggest me if any possibilities to stop testsuite level in run time through Groovy.

 

Thanks

 

8 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    What is your use case? Where do you want to keep this script in the test suite?

    Can you also show how you are doing it for test case currently (script + test case screen shot with steps) would help better.
    • saprao's avatar
      saprao
      Occasional Contributor
      Basically, I need to validate whether services are up and running or not through Groovy. Ex : Assume my Test Suite contains 3 or more test cases(Operations) and executing all the operations in test suite level. If one service soap response is getting +ve then execute all the operations. Otherwise stop the execution entirely in test suite level Through below code it is stopping execution in test case level but continuing to next test case. if(assertion.assertable.getAssertionByName("SOAP Response").assertionStatus.toString() == "FAILED") { for( e in assertion.errors ) { def Val_Prop_Message=e.message.toString(); //log.info "Message" + Val_Prop_Message; tc.setPropertyValue("Validation1",Val_Prop_Message); tc.setPropertyValue("Description1","**Services is down **"); } } else if(assertion.assertable.getAssertionByName("SOAP Response").assertionStatus.toString() == "VALID" ) { tc.setPropertyValue("Validation1","**Service Up and running**"); tc.setPropertyValue("Description1"," "); testRunner.cancel(); /* test case level*/ } Thanks
      • saprao's avatar
        saprao
        Occasional Contributor

        Hi Rao,

         

        My use case is validate whether service is up and running or not in run time then continue to execute the remain test cases in test suite level.

         

        Ex: My test suite contains 3 or more test cases(Operations) and execute all the operations in test suite level.

        if first operation soap response is valid then execute all the operation otherwise stop the execution.

         

        Above scenario i did on test case level then it was stopped one operation but it wouldn't stop the remaining operations.

         

        Below script i have written in one of the test case then it was stopped one operation successfully but it is continue to execution to other test cases

         

        if(assertion.assertable.getAssertionByName("SOAP Response").assertionStatus.toString() == "FAILED") {

        for( e in assertion.errors ) {

        def Val_Prop_Message=e.message.toString();

        //log.info "Message" + Val_Prop_Message;

        tc.setPropertyValue("Validation1",Val_Prop_Message);

        tc.setPropertyValue("Description1","**Services is down **"); } }

        else if(assertion.assertable.getAssertionByName("SOAP Response").assertionStatus.toString() == "VALID" ) { tc.setPropertyValue("Validation1","**Services is down **");

        tc.setPropertyValue("Description1"," ");

        testRunner.cancel(); /* test case level*/ }

         

        Now, I need to stop the entire execution if soap response failed.

         

        Thanks