Forum Discussion

joelgluth's avatar
joelgluth
Contributor
16 years ago

DataSources across TestSuites

I realise this is a Pro question, but since I'm using an evaluation license, I don't have a Pro forum account. So bear with me; my experience with using Pro to solve my problems has been mixed, but I'll buy it if I can convince myself it will work

What I want is to be able to get the "next" value from a DataSource in more than one place, and to iterate over the DataSource in ways other than "loop over all the values until they're done".

One example of this might be having a DataSource at TestSuite scope. If I have a bunch of entities in my database and a file containing a list of known IDs for those entities, I want to be able to try and retrieve a different one each time, even though I'm not always performing the same operation. This could include being retrieved in a load test.

A simpler example might be having an API call that takes two arguments: foo(a, b), taken from dataSourceA and dataSourceB, respectively. I don't mind iterating over all the possible values of 'a', but I still want to get a fresh value of 'b' each time as well (though I don't care about covering all of them - I just want to ensure a cache miss).

Maybe I could access this through a Groovy dynamic property... some kind of getDataSourceStepByName("datasourceA").next() kind of idiom maybe?

Does this make sense? And is it possible?

J
  • You could try something like this in the Groovy step:

    def dsStep = testRunner.testCase.testSteps["DataSource"]
    dsStep.next( testRunner, context )

    That will get the next value from the DataSource.

    I hope that helps, thank you for taking the time to evaluate SoapUI

    /Nenad
    http://eviware.com
  • That's exactly what I was after.

    Thanks for your help

    (Since it's kind of what I guessed might be there but didn't find it, is there somewhere in the documentation I should have been looking? I may be developing suboptimal paths through the User Guide.)