mvnarendra
7 years agoOccasional Contributor
Is it possible to use if else conditions in dynamic property expansion
Hi,
I am trying to send a dynamic mock response using dynamic property expansion. I am able to use a ternary operator to set dynamic value. But I want to see if else conditions can be used or not? Below is my sample code which I am trying.
Code working with the ternary operator
${=(result.equals("success")?"success":"error")}
Code not working with an if-else condition:
${=if(result.equals("success")){"success"}else{"error"}}
The problem is that you can't use braces when writing inline scripts. It's a limitation of SoapUI - a significant one since Groovy uses braces often.
But this should work...
${= if(result.equals("success")) "success" else "error" }