Some Important SoapUI functions in groovy script.

In this post I will show you some important soapui functions which are basically used in soap ui groovy scripts.

1. Following functions are used to read properties in soapui project.
projectPropertyValue = context.expand( '${#Project#Test}')

projectPropertyValue = context.expand( '${#TestCase#Test}')

projectPropertyValue = context.expand( '${#TestSuite#Test}'

I have create three properties with name "Test" at project, testsuite and test case level. Using above code we can read values in groovy scripts and can be use where needed.
2. Setting properties value test case.
def myTestCase = context.testCase

myTestCase.setPropertyValue("Name", “Value”)

3. Reading end url value of any test steps. Replace your test step name with “TestStepName”
EndPointUrl  = context.getProperty("TestStepName","Endpoint")
4. Setting parameter value of test steps. Replace you test step name, parameter name and value with “TestStepName”, “dataSet” and “value”.
def groovyUtils = new

//set data parameter value in TestStep
groovyUtils.setPropertyValue("TestStepName", "dataSet", “value”)
Will continue adding more function

No comments:

Post a Comment

Leave your comments, queries, suggestion I will try to provide solution