Forum Discussion

mermet's avatar
mermet
Occasional Contributor
17 years ago

How to share data between Test Cases belonging to the same Test Suite

Hi,  I want to share data between all Test Cases that are in my Test Suite.
I just found out that the scope of Context properties are only for the Test Case.

Properties can be read from file (or Database I suppose), but I want to share pre-processed data between Test Cases. Not only data directly accessed from a File.

For instance my Test Suite includes an initialisation Test Case that is responsible to prepare some list (or even things like myXML). I want to have those data to be available for each Test Case so they can be used in Groovy script to set the requests for instance.

How can this be achieved ?
Thanks a lot.

3 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi mermet,

    this is what TestSuite properties are for.. you first TestCase should write the desired value to corresponding TestSuites properties and the following TestCases can read the values from there..

    ie do the following:

    1) Define the desired properties at the TestSuite level in the TestSuite editor
    2) Write the desired values to these properties in your first TestCase, either using a PropertyTransfer or a groovy script;

    testRunner.testCase.testSuite.setPropertyValue( .., .. )

    3) access these properties in your following testcases with property-transfers, property-expansion or a groovy script..

    Hope this makes sense / helps!

    regards,

    /Ole
    eviware.com
  • mermet's avatar
    mermet
    Occasional Contributor
    Thanks a lot. Makes a great sense, but I can't find the way to define new Test Suite Properties. I can see the Test Suite properties pane, but it seems to be read only
    (there is a single property which is the name of the Test Suite).
    The Test Suite Editor does not provide any facility either to create new properties.
    I have soapUI Pro v.1.7.6.

    Sorry but I'm very frustrated !