Forum Discussion

SKoneru's avatar
SKoneru
Contributor
11 years ago

[Res]DataSource loop to continue with next record whn test f

Hi,

When data source loop is opted and we provide multiple rows, which means each row represents one unique data set. Noticed the test case fails and doesn't loop with the default test case option "Abort on Error"(this is true). If I uncheck this option then it executes all the data records even when the test case fails for any data set.

Now the scenario I am looking at is, each row(data set) in data source should be treated as a separate test case. So when "Abort on Error" is set to true then the further test steps should not be executed for that data set but the data loop should continue to fetch the next row.
Currently the test execution stops for the test case and doesn't continue with the next entry in data source loop.
How can I achieve this?

Thanks

6 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Here's a solution hopefully better tailored to your problem:

    1) Go to the Events tab, found in the Project view.
    2) Add a new TestRunListener.afterStep event to your project.
    3) Have it run the following script:
    import com.eviware.soapui.model.testsuite.TestStepResult;

    if (testStepResult.status == TestStepResult.TestStepStatus.FAILED)
    {
    testRunner.gotoStepByName("DataSource Loop") //Or whatever else your DataSource loops are called
    }

    VoilĂ ! If your DataSource Loops all have different names, you can use TestCase properties instead of directly referencing the name in the script.

    I hope this helps. Let me know if you have any more questions, and we'll try to help out.

    Regards,
    Arian
    SmartBear Sweden
    • cauvery's avatar
      cauvery
      Contributor

      I have more than one datasource loop with different names. How can use Test case in that case as you mentioned SmartBear_Suppo

       

      Or can I provide more than one datasource loop in the event listener like below

       

      import com.eviware.soapui.model.testsuite.TestStepResult;

      if (testStepResult.status == TestStepResult.TestStepStatus.FAILED)
      {
      testRunner.gotoStepByName("DataSource Loop 1")
      testRunner.gotoStepByName("DataSource Loop 2")
      }

       

      Thank you.

  • Any suggestions on this will be helpful.
    Thanks in advance.
  • I can not create a conditional test step after each test step. We never know which test step fails. So as and when any test step fails then the next row in the data source should be picked up.