Forum Discussion
- jmistrikOccasional ContributorThis might help (for simple variable/property use): http://www.soapui.org/Scripting-Propert ... nsion.html
- letstestthisfasOccasional ContributorGot a little confused by the article
So, If I want to use variables in the following request, how do i do that? -
{
"eventType": "check",
"emailAddress": "email@emailtesting.com",
"source": "mobile",
"customerSegment": "gold",
"custId": "1111111111"
} - jmistrikOccasional Contributordepends where "do the variables belong"
- you choose a scope eg. custId (i believe it is sth like customerID) in TestCase scope, if you need the custId visible in all teststeps
Lets have the example on TestCase scope - you go to Custom Properties tab in soapui (left bottom corner), create there a property (variable) you need = "custId" with value "1111". Then this variable is accessible in all testSteps:
{
"eventType": "check",
"emailAddress": "email@emailtesting.com",
"source": "mobile",
"customerSegment": "gold",
"custId": "${#TestCase#custId}" [-> will expand to 1111]
} - letstestthisfasOccasional ContributorGetting closer here
I am in the box that says Workspace properties at the bottom left corner, how do I add a new property? I dont see a way to do that. What am i missing? - letstestthisfasOccasional ContributorI was at the wrong level. Thanks for your help! this worked
And just in case this helps others - you can set this up at Project, TestSuite, TestCase levels like this -
"emailAddress": "${#Project#emailAddress}", for Project
"emailAddress": "${#TestSuite#emailAddress}", for TestSuite
"emailAddress": "${#TestCase#emailAddress}", for TestCase