sachin-chanchal
8 years agoOccasional Contributor
groovy script to add HTTP step in test case
Hi,
I am looking for a groovy script by which i would able to add HTTP type step in my test case. I am able to create/add test case in desire test suite but unable to find a groovy code/script to add HTTP type step in added test cases.
Please help.
Thanks
Sachin chanchal
sachin-chanchal, thank you for the details.
Try:
import static com.eviware.soapui.impl.wsdl.teststeps.registry.HttpRequestStepFactory.HTTPREQUEST_TYPE //Provide the http request endpoint in the below def endpoint = 'http://google.com' //Valid http method GET | PUT | POST | DELETE etc def method = 'GET' def stepName = 'httpRequestStep' //Adds http request step to given test case assumes tc is valid object of TestCase tc.addTestStep(HTTPREQUEST_TYPE , stepName, endpoint, method)
Try:
//Assign the step object of the required test step in the below statement def step = def request = """<Request Object="System" Action="Logon" Username="ABC" Password="DEF"/>""" step.testRequest.setRequestContent( request )