cancel
Showing results for 
Search instead for 
Did you mean: 

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

Highlighted
Occasional Contributor

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

Hi,

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 = 'http://google.com'
//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:

 

http:///${#Project#target}/restman/1.0/

 

instead of just:

 

${#Project#target}/restman/1.0/

 

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

 

Thanks!

 

Jim

 

New Here?
Join us and watch the welcome video:
Top Kudoed Authors