Forum Discussion

ohaya's avatar
6 years ago

Adding test case via Groovy - Problem using project vars for endpoint?


I am trying to programmatically add a test case.  The beginning of my code looks like:


Import static com.eviware.soapui.impl.wsdl.teststeps.registry.HttpRequestStepFactory.HTTPREQUEST_TYPE
//Provide the http request endpoint in the below
def endpoint = ''
//Valid http method GET | PUT | POST | DELETE etc
def method = 'POST'
def stepName = 'httpRequestStep4'
def tc=testRunner.testCase
//Adds http request step to given test case assumes tc is valid object of TestCase
tc.addTestStep(HTTPREQUEST_TYPE , stepName, endpoint, method)


However, we have project variables for the endpoint, and would like to use that, so I changed the "def endpoint" to:


def endpoint = '${#Project#target}/restman/1.0'


But then, the endpoint in the new test step ended up being:




instead of just:




How can I set the endpoint to the correct one, the one that does not have the extra "http:///" in front of it?






No RepliesBe the first to reply