Forum Discussion

Jaroslaw's avatar
Jaroslaw
Contributor
12 years ago

[Res] What does DataSource "Restart On Run" actually mean?

It's either that I don't understand what the DataSource "Restart On Run" option supposed to do or there is a bug.

Test Case Scenario
Delete all records from an external data store by looping delete calls in batches of 10 until there are no rows left.

Test Steps
Request1 - Query 10 rows
DataSource1 - XML, grabs id values from above query response
PropertyTransfer1 - Transfer id value to DataSink1
DataSink1 - Creates an XML string of ids to delete, puts result into "ids" property
DataLoop1 - Target Step = PropertyTransfer1, DataSource = DataSource1
Request2 - Delete ids
ConditionalGoTo1 - If Request1 returned rows, go to Request1

Behaviour when DataSource1 "Restart On Run" = true
On first loop things work as expected. DataSink1 aggregates the 10 ids (id1...10) into an xml string which is used in Request2 to delete those records.
On the second loop, Request1 returns id11...20, and DataSource1 appends those ids to the previous list of ids (id1...10) causing DataSink1 to returns xml for id1...20.
I'd expect DataSource1 to "restart" (reset?) and only contain rows for id11...20.

Behaviour when DataSource1 "Restart On Run" = false
On first loop things work as expected (same as above).
On the second loop, Request1 returns id11...20 but DataSource1 throws error that there is no data (bug?).

Cheers

4 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    hmm.. I think this all sounds expected to me - isn't it that you need to reset the DataSink for each "page" also!? Try adding a script teststep between request2 and the conditional goto that calls

    testRunner.testCase.testSteps["DataSink1"].prepare( testRunner, context )

    Does that help?

    /Ole
    SmartBear Software
  • Adding your code to clear the data sink worked. I tried something similar before by setting the DataSink return value to empty but that didn't work.

    It would be nice to know what the various object methods in the API actually do. I've seen the datasink prepare method in the API Doc (http://www.soapui.org/apidocs/pro/com/e ... tStep.html) but without a description, the doc isn't very useful.

    Thanks
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    yes - the javadoc is really lacking - sorry about that - it's on our (very long) list of improvements...

    regards!

    /Ole
    SmartBear Software