Forum Discussion

Harshz6693's avatar
Harshz6693
New Contributor
8 years ago

How to remove extra slash in Request URL when EndPoint = ${#Project#EndPoint} using groovy ?

Hi, I am not able to set the Endpoint to be ${#Project#Endpoint} in groovy, because if set in this way , SoapUI sets the URL to start with  http:///  which consists of 3 slashes after http. If I se...
  • Harshz6693's avatar
    8 years ago

    Solution:  Set the Endpoint property value seperately.

    Before :  String EndPoint = "\${#Project#Endpoint}"  OR  String EndPoint = "http://\${#Project#Endpoint}" 

     

                   testStep = testCase.addTestStep(type: "httprequest",  name: "abc", endpoint: "EndPoint" + "/xml"  , method:  "POST")

     

    Output:  Request URL:  http:///${#Project#Endpoint}/xml  ==> http contained 3 slashes

     

    After applying solution:

                   String EndPoint = "http://\${#Project#Endpoint}"

     

                    testStep = testCase.addTestStep(type: "httprequest",  name: "abc", endpoint: " "  , method:  "POST")

     

                   testStep.setPropertyValue( "Endpoint",  "EndPoint" + "/xml")

     

    Output Request URL:   http://${#Project#Endpoint}/xml