Forum Discussion
Lifeguard
13 years agoOccasional Contributor
Thanks to all again.
Ok so i did the following steps (and worked fine). I post them step by step so that any other person can read it. If I am wrong, just correct me
Mi PUT method was like http://services.test.mycompany/api/user ... mypassword
I really needed an "email" random value, cause it has to be "Unique".
So I did the following :
1. Go to the soapUI project, and select "New web Tescase"
2. Paste the root url without the variables : http://services.test.mycompany/api/userdata?
Uncheck "start recording"
Click "Ok"
3. Go to the recently created "Web testSuite", and click on "Setup script"
4. I pasted basically MartinSpammer's code (Many Thanks!!)
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()
}
testCase.setPropertyValue("newEmailName", userName("user"))
5. Next, I had two options :
--- Option 5.1 ---
Go to the http method, and add the parameters :
email ; Value = ${#TestCase#newEmailName}
password; Value = 1234
username; Value = userfake
method type : "PUT"
And that is all. Just go to the webtestcase and click on "Play"
--- Option 5.2 ---
Go to the http method and add the parameters
email ; ---empty---
password; Value = 1234
username; Value = userfake
method type : "PUT"
Go to the "test steps", click add "property transfer"
In "property transfer" Click "add a new property transfer" and type "username"
(related to testCase.setPropertyValue("newEmailName",----> userName <-----("user")) )
Click "Source" and select "Web Test Case" (or the name you set at the test-case creation) . Click Property and select "NewEmailName".
Click "Target" and select the http method. Click "Property" and select "email"
And that's all. Go to the webtestcase and just play.
Ok so i did the following steps (and worked fine). I post them step by step so that any other person can read it. If I am wrong, just correct me

Mi PUT method was like http://services.test.mycompany/api/user ... mypassword
I really needed an "email" random value, cause it has to be "Unique".
So I did the following :
1. Go to the soapUI project, and select "New web Tescase"
2. Paste the root url without the variables : http://services.test.mycompany/api/userdata?
Uncheck "start recording"
Click "Ok"
3. Go to the recently created "Web testSuite", and click on "Setup script"
4. I pasted basically MartinSpammer's code (Many Thanks!!)
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()
}
testCase.setPropertyValue("newEmailName", userName("user"))
5. Next, I had two options :
--- Option 5.1 ---
Go to the http method, and add the parameters :
email ; Value = ${#TestCase#newEmailName}
password; Value = 1234
username; Value = userfake
method type : "PUT"
And that is all. Just go to the webtestcase and click on "Play"
--- Option 5.2 ---
Go to the http method and add the parameters
email ; ---empty---
password; Value = 1234
username; Value = userfake
method type : "PUT"
Go to the "test steps", click add "property transfer"
In "property transfer" Click "add a new property transfer" and type "username"
(related to testCase.setPropertyValue("newEmailName",----> userName <-----("user")) )
Click "Source" and select "Web Test Case" (or the name you set at the test-case creation) . Click Property and select "NewEmailName".
Click "Target" and select the http method. Click "Property" and select "email"
And that's all. Go to the webtestcase and just play.