Forum Discussion

PMI_Mortgage_In_1's avatar
PMI_Mortgage_In_1
Occasional Contributor
14 years ago

StringToObjectMap: Update endpoint url

Hi,

I am using SOAPUI API's for running the projects using WsdlProjectRunner. Constructor of this class takes two parameters one is SOAPUI Project and another one is StringToObjectMap. I want to override the end point URL for all requests in the projects. I specified the following parameters for the map and used it. It still not taking the new endpoint url I specified in the MAP. I have the following questions. I don't see any documentation around the values that I can pass in the Map.

1). Can I used the Map to update the endpoint url for all teststeps in the project.

I am using the following code to run it

WsdlProject project = new WsdlProject(PropertyUtil.getProperty("projectFilePath")+testExcelFiles);
StringToObjectMap paramsMap = new StringToObjectMap();
paramsMap.put("e", PropertyUtil.getProperty("regressionEndPointURL"));
WsdlProjectRunner runner = new WsdlProjectRunner(project , paramsMap);
System.out.println("^^^^ New End Point URL is::"+PropertyUtil.getProperty("regressionEndPointURL"));
runner.run();
List<TestSuiteRunner> suiteResults = runner.getResults();
generateReport(suiteResults);


I even tried with the following parameters for the map and still seeing the same result. It's not taking new url. It's still getting executed with the old url.

paramsMap.put("-e", PropertyUtil.getProperty("regressionEndPointURL"));
paramsMap.put("Endpoint", PropertyUtil.getProperty("regressionEndPointURL"));

Regards
Param

6 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    Try using the SoapUITestCaseRunner class instead, which is the same class that is invoked from the command-line;

    SoapUITestCaseRunner runner = new SoapUITestCaseRunner()
    runner.setProjectFile( ... )
    runner.setEndpoint( ... )
    runner.run()

    Does that work better?

    regards,

    /Ole
    eviware.com
  • PMI_Mortgage_In_1's avatar
    PMI_Mortgage_In_1
    Occasional Contributor
    Hi,

    Thanks for the reply. We are able to get it working. I am still seeing some performance issues. We have to allocate lot of memory & we have some constraints on that. When we run the TestCase from UI I see property called Discard Successful Test Step Results to Preserve Memory. Is there way I can pass it using the StringToObjectMap.

    Regards
    Param
  • Hi,

    I'm having a similar problem to above. I need to use the run method on each of the Test Cases as I need more error information on failure than the SoapUIProTestCaseRunner gives - this is what you tell us to do here -> http://www.soapui.org/Test-Automation/integrating-with-junit.html. But I also need to modify the endpoint on each of the Test Cases from http://localhost:8888 to http://server1:8888.

    How do I go about changing the endpoint, but also keeping error information such as which Test Case failed?

    Thanks,

    Chris
    SoapUI Pro User.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Chris,

    I think you would basically need to loop through all the teststeps in each testcase prior to executing it and

    1) check if the teststep is a HttpRequestTestStep
    2) if it is, cast it to such and use the getHttpRequest() method to get the request object on which you can call setEndpoint( .. ) to change the endpoint

    does that help?

    regards,

    /Ole
    eviware.com