Forum Discussion

jonathon's avatar
5 years ago

Global input file and variables



I'm a new ReadyAPI user handling a migration project. Currently the 3-4 examples we've been given had a lot of repetitive data tasks in there. For example each test have the following repeated tests

1 - Data generator (a Java UUID generator), these do need to be unique per test so they can stay

2 - Date + Time input script

4 - Input data script => This is a very long file that reads in the values of an xml file on a users machine and creates test data to use for SOAP requests.


What's the correct way to  have some global variables defined once per project?


I have tried the following as a test suite setup script as an example. But it didn't seem to work as the variable in the SOAP request wasn't populated.



def dataGenerator =UUID.randomUUID().toString()
 runner.testSuite.setPropertyValue("dgen", dataGenerator)

 // Get the default value from a project property
def dgen = runner.testSuite.project.getPropertyValue("dgen")

So not sure what I'm doing wrong here?


As a related relevant side note, this is all going source controlled as it needs to be deployed remotely to CI machines. The setup I've been given requires a file on the host machine. Is there a way to keep that test data xml file within the project?




  • Hi jonathon 


    yep = the value you need to specify for the GUID is ${=java.util.UUID.randomUUID()}


    so for my payload I have a testcase level property setup on the ehctemplateid attribute in my payload as follows:


    "name" : "TestCaseNumber003",
    "ehctemplateid" : "${#TestCase#ehctemplateid}",
    "ehcstatus" : 814250000,
    "ehcversion" : "1.0",
    "countersignature" : false


    and I have a testcase property entitled ehctemplateid with a value of ${=java.util.UUID.randomUUID()}


    this will dynamically generate the GUID automatically - I just ran the test and the payload in the RAW request is as follows:


    "name" : "TestCaseNumber003",
    "ehctemplateid" : "00b188a2-068c-494f-99d1-8faaa7be6303",
    "ehcstatus" : 814250000,
    "ehcversion" : "1.0",
    "countersignature" : false


    nice one



4 Replies

  • nmrao's avatar
    Champion Level 3
    Looks the above is in setup script of test suite.

    If you want to use "dgen" in soap request,
    • jonathon's avatar

      Yes, it's in the test suite setup - however I open to other ideas if better.


      Do I replace TestSuite with my test suite's name? If so how do I handles spaces in the test suite name

      • richie's avatar
        Community Hero
        Hi jonathon,

        If you use ${#TestSuite#property} you don't need use the testsuite's name...this syntax means 'current testsuite level'.

        If you use ${TestSuite#property}, you would replace 'TestSuite' with the testsuite's name.

        See the following link

        Btw. It should handle spaces in testsuite name just just need to remember to not add the extra # character in there if youre specifying testsuite name rather than testsuite level

        By the way, there's a dynamic scripting option to dynamically create java uuid/guids in your payload rather than using a couple of lines of groovy.
        nmrao provided me the info to do this (all cred goes to Rao) the value you need to hardcode in your payload is something like ${=java.util.UUID.randomUUID()}...i'm going to a funeral at moment but i'll check on my laptop when i get back.

        Nice one,