Property Transfer Question
Hello,
I have a TestCase where I need to generate x number of unique strings. Let's say 10 email addresses. The way I am doing things now is I have 10 groovy script test steps that randomly create the email string and 10 Transfers. Is there a way to condense this? If I have one groovy script that generates the random string can I just evaluate it each time I do a property transfer? I have 6 other strings I need to generate as well (FirstName, LastName, etc...) so the way I am currently doing things I would have 70 test steps just for generating data.
Thanks!
I typically create a properties step and use a groovy script to write my properties to that with a groovy test step. If I need multiple of the same value per request, I name them differently.
Example:
CustomerEmail
ManagerEmail
etc.
If I need multiple data-sets for multiple requests, I'd have:
CustomerEmail1
ManagerEmail1
CustomerEmail2
ManagerEmail2
Then in my groovy script I have a for-loop that iterates through how many data-sets I need, and generates how many elements I need per dataset.
Here's a very quick groovy script example.
def propertiesStep = testCase.testSteps["Properties"]; def generateEmail() { // insert email generation script here
} for(int i = 1; i < 100; i++) { propertiesStep.setPropertyValue("CustomerEmail" + i, generateEmail()); propertiesStep.setPropertyValue("ManagerEmail" + i, generateEmail());
i++; }