HP Service Test – How to Setup ServiceTest to Run Against Multiple Environments.

Automation Guild Online Conference Top ad

When testing web services, I constantly find myself needing to run the same set of service test tests against multiple environments.

In order to do this, without having to have the same scripts copied multiple times for each environment, I dynamically set the WSDL's endpoint.

Changing a Service Test's endpoint

Changing a scripts endpoint in Service Test is actually real easy:

  • Click on the web service operation in the main canvas area and under its property sheet click on ‘General' icon

  • Notice the Endpoint Address and SoapAction properties — you can easily point them to either an Input Property that you've created or to a previous action like a Read from File.

How to Setup an EndPoint Input Property Variable

  • Click on the ‘Start' action

  • Click on the Start's Property Sheet ‘Add Properties' icon and select ‘Add Input Property'

  • In the ‘Add Input Property' create a variable named EndPoint:

  • You should now have an input property:

  • Navigate back to your operation's ‘General' area and for the Endpoint Address click on the ‘Link to data source”
  • In the Select Link Source to ‘Endpoint Address', point to the ‘EndPoint' input property we just created

  • Run the script and in the Run dialog click on the Input Parameters tab to set the EndPoint:

How to read the endpoint from a file

Another approach is the write out the endpoint to a local file and when the script runs read in the value from the file.

  • Add a ‘Read from File' activity into the main canvas area
  • Under the Read from File's property sheet set the ‘File path' to the file that contains the endpoint info:

  • Navigate back to your operation's ‘General' area and for the Endpoint Address click on the ‘Link to data source”
  • In the Select Link Source to ‘Endpoint Address' and point to the read from file's ‘Content' output value

  • Run the script and it should read the endpoint from the file

That's it

Cool! You should now be able to run the same Service Test script against multiple environments.

5 comments
Sachin Walukar - July 19, 2012

Hi,
Actually this solution doesnt work, as here we have to change WSA Addressing(Security settings) as per the endpoint. So if we change endpoint from text file, we can link them to endpont from General tab for Operation but there is no any way to link WSA Addressing.

So kindly provide me the best possible solution.

Thanks !
Sachin Walukar

Reply
ben - December 19, 2012

Joe, I’m curious how we might be able to use custom code to accomplish something similar by reading from a test resource in QC. I have found some limitations with the way QC / ST can accept data when using Business Components and Business Process Tests. For example you can only link to a single data sheet which means that if I want to feed values in from QC via a data sheet I have to have a single data sheet that contains all my test data AND the endpoint, likely meaning the endpoint is repeated on every line of the tests data. How can I setup a test to obtain the endpoint from a single location in QC (test resources ideally) but also accept a data sheet full of input data?

Reply
Rupa Schomaker - May 9, 2013

This is a great idea. Any way to do a similar technique for the endpoint’s security settings? I don’t see any way to set this from the properties….

Reply
bhill - May 27, 2013

The Endpoint Address is not on the Activity General Property Sheet in UFT 11.5. Is there another way to setup UFT to run against multiple environments?

Reply
    Joe Colantonio - May 27, 2013

    bhill » I just dbl checked in UFT 11.5. I drag a web service’s operation to the main canvas area. Click on that operation. Click on it’s Properties>General section. Click on Transport>Choice HTTP and have an endpoint address. Can you dbl check and let me know what you see? Thanks

    Reply
Click here to add a comment

Leave a comment: