Forum Discussion
MartinSpamer
14 years agoFrequent Contributor
Write Groovy Test Step to create your Random Data.
Then put the value into a property readily accessible by the request. e.g.
The put the following into the request
testCase = context.testCase
def userName(String prefix)
{
Random rand = new Random()
def alphaNumPool = ['a'..'z',0..9].flatten()
def randomChars = (0..6).collect { alphaNumPool[rand.nextInt(alphaNumPool.size())] }
return prefix + randomChars.join()
}
Then put the value into a property readily accessible by the request. e.g.
testCase.setPropertyValue("newUserName", userName("user-"))
The put the following into the request
${#TestCase#newUserName}