cancel
Showing results for 
Search instead for 
Did you mean: 

automation question

Super Contributor

automation question

Hello,
I am trying to write a framework so that I can automate the testing of web services. I have been using the groovy script library to accomplish most of my automation. So for instance I have defined my connection string in an external XML file. Within my groovy script I will read this file and do appropriate actions.

I wanted to know if there is any way I can do something similar to dynamically change the endpoints in the request. I have different environments (QA, integration, production) which I would like to point to while running my tests.  for example
in Integration
http://cswebdev.tvguide.com/v2/UserProfileService.asmx
would change to
http://qa-services.tvguide.com/v2/UserP ... rvice.asmx
in QA.

As of now I just open the project file in notepad and do a simple copy/replace and save the file.

Any suggestions, ideas would be appreciated.
5 REPLIES 5
Super Contributor

Re: automation question

Hi!

sure, you could create a groovy-script that loops all requests in your tests and sets the endpoint:

import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep

def testCase = testRunner.testCase
for( c in 0..testCase.testStepCount-1 )
{
  if( testCase.getTestStepAt( c ) instanceof WsdlTestRequestStep )
  {
      testCase.getTestStepAt( c ).testRequest.endpoint = "another endpoint"
  }
}


If you need to do this for all testcases/testsuites, just add outer loops for these.

We will add pre/post processing groovy scripts to testcases / testsuites in soapUI 1.8, which will be a good place to hold this..

regards!

/Ole
eviware.com
Super Contributor

Re: automation question

would it be possible to add a pre processing groovy script to the project. The reason is that in this script, we can configure environments which will apply to the entire project.

Thanks

Ali
Highlighted
Super Contributor

Re: automation question

Hi Ali,

it's not currently possible, but relatively easy to add.. when would this script be triggered? When loading the project? Or from a menu item?

regards!

/Ole
eviware.com
Super Contributor

Re: automation question

I think it would make more sense to trigger this script when loading this project. I typically (based on my project) require 3 things to change

1. The actual WSDL (integration, dev, QA environments)
2. username / password for methods (since our services are secured)
3. any groovy scripts which might access the database (insert, update, etc)

I was able to solve the third problem very gracefully by writing a outside library using groovy repository feature in soapUI 1.7.5.

Basically any solution that would allows switching of WSDLs with relative easy would be very helpful. Currently I just use notepad ++ to copy/replace wsdl. However, my ideal scenario would be run a series of test in multiple environments without any manual intervention.
Super Contributor

Re: automation question

Thanks for your clarification.. We'll ponder on this for the next release and I'll get back to you..

regards!

/Ole
eviware.com
New Here?
Join us and watch the welcome video:
Top Kudoed Authors