Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am trying to use SOAPUI to send to a REST API. Is there a way to use variables.

E.g if the post request has

{

"eventType": "check", "emailAddress": "email@emailtesting.com", "source": "mobile", "customerSegment": "gold", "custId": "1111111111" }

Can I use variables instead of "gold" ?

share|improve this question
    
Answered a similar question on Stackoverflow. You may find it useful. stackoverflow.com/questions/11647467/how-to-use-the-properrty/… –  Steve Miskiewicz Aug 19 '12 at 1:52
add comment

2 Answers

up vote 1 down vote accepted

SoapUI supports something called "properties" which are essentially the variables you asked for. After setting a property, whether manually or by a Groovy script, properties can be included in your individual test steps. SoapUI will expand a properties reference to whatever the property's value is. Property references look like this: ${property_name}.

Property: CustSegment = Gold
{ "eventType": "check", 
"emailAddress": "email@emailtesting.com", 
"source": "mobile", 
"customerSegment": "${CustSegment}", 
"custId": "1111111111" }
share|improve this answer
add comment

Got an answer from the SoapUI forum

"depends 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] }

jmistrik

"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.