Global input file and variables
Hi
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.
import com.eviware.soapui.support.GroovyUtils; 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?
Thanks
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
rich