Forum Discussion

hafizimraan's avatar
hafizimraan
Occasional Contributor
5 years ago

How to run next test step/case while previous one is still running in SoapUI Pro?

Hi Community Members

Under one test suite I have multiple test cases i.e.1 to 10. Upon running of test suite Soapui does have option to run in parallel/serial but my scenario requires to run test suite in serial mode and then the real problems comes that it is required in my scenario to run test case 3 while test case 2 is still in running state. But so far am unable get the solution because in test suite while running in serial its waits to complete the execution of step 2 then moves to step 3. So is there any way that I just trigger the test case 2 using script etc & test suite proceeds to next step instead of waiting of response (Step 2).

 

Let me know if you guys have any ambiguity regarding above problem statement.

Regards  

 

  • hafizimraan's avatar
    hafizimraan
    5 years ago

    Got the solution by adding following code under groovy step.

    Thread.start {
    	testRunner.runTestStepByName("Test Step 1")
    }
    testRunner.runTestStepByName("Test Step 2")

    What does this code do: 
    Thread.start will run Test Step 1 & will move to Test Step 2 without waiting for the result/response of Test Step 1.
    nmrao HimanshuTayal  Thanks Guys for your help. Really appreciated.

     

  • nmrao's avatar
    nmrao
    Champion Level 3

    Not sure why tests are designed like that. It is important that each test case is independent.
    1. What is your use case or functionality that you are trying to achieve?
    2. Would it be possible to update the tests so that no dependency between the tests?

     

    YOu may use Run Test case step instead if you still need to re-use existing test case. Refer documentation

    https://support.smartbear.com/readyapi/docs/soapui/steps/run-test-case.html

  • hafizimraan : As nmrao  is saying, every TestCase should be independant but if there is any dependancy in which you want to execute some other Test Case then:

     

    1. Create Test Suite name Reusable step,

    2. Then place all the dependent Test Step in that Test Suite,

    3. Then write groovy Script to Run that particular Test Step instead of calling it from another Test Case, place all the dependent Test Steps in seperate place.

     

     

    • hafizimraan's avatar
      hafizimraan
      Occasional Contributor

      HimanshuTayal 

      Got your point and already tried similar approach to achieve this but the porblem is with groovy that i used "testRunner.runTestStepByName(ABC)" but this function requires Test Step Result upon execution then move to next line of script. 
      Would be better if you can provide any piece of script that will just trigger test case & move to next line of script instead of wait for test step result. This will resolve my problem. 


      Even i tried Thread call using groovy but it doesn't trigger the test step. 
      Here is the thread script i tried.

       

      new java.lang.Thread(new Runnable() {
      void run(){
      println ("Start")
      log.info "Starting Thread";
      testcaserun = testRunner.runTestStepByNamepByName("Request1"); 
      }
      }).start();

       

      • HimanshuTayal's avatar
        HimanshuTayal
        Community Hero

        hafizimraan : Where are you writing this code in groovy script or in events of Soapui pro?

        and could you please share any screenshot of the error.