1

A bit of background:

I have an extensive amount of SOAPUI test cases which test web services as well as database transactions. This worked fine when there were one or two different environments as i would just clone the original test suite, update the database connections and then update the endpoints to point to the new environment. A few changes here and there meant i would just re-clone the test cases which had be updated for other test suites.

However, I now have 6 different environments which require these tests to be run and as anticipated, i have been adding more test cases as well as changing original ones. This causes issues when running older test suites as they need to be re-cloned.

I was wondering whether there was a better way to organise this. Ideally i would want the one test suite and be able to switch between database connections and web service endpoints but have no idea where to start with this. Any help or guidance would be much appreciated.

I only have access to the Free version of SOAPUI

This is what the structure currently looks like:

Structure of test suites

Rao
  • 20,781
  • 11
  • 57
  • 77
user610
  • 353
  • 2
  • 18
  • Are you using same database type or different data bases such oracle, mysql, pgsql,mang0db for each suite? I assume that you are using one database type say oracle and using different servers to test. – Rao Jun 06 '16 at 12:14
  • @Rao that is correct. i am using one database type (oracle) and using different servers to test – user610 Jun 06 '16 at 13:26

1 Answers1

3

Here is how I would go to achieve the same.

There is an original test suite which contains all the tests. But it is configured to run the tests against a server. Like you mentioned, you cloned the suite for second data base schema and changed the connection details. Now it is realized since there are more more data bases need to test.

Have your project with the required test suite. Where ever, the data base server details are provided, replace the actual values with with property expansion for the connection details.

In the Jdbc step, change connection string from: jdbc:oracle:thin:scott/tiger@//myhost:1521/myservicename

to: jdbc:oracle:thin:${#Project#DB_USER}/${#Project#DB_PASSWORD}@//${#Project#DB_HOST}:${#Project#DB_PORT}/${#Project#DB_SERVICE}

You can define the following properties into a file and name it accordingly. Say, the following properties are related to database hosted on host1 and have the details, name it as host1.properties. When you want to run the tests against host1 database, import this file at project level custom properties.

DB_USER=username
DB_PASSWORD=password
DB_HOST=host1
DB_PORT=1521
DB_SERVICE=servicename

Similarly, you can keep as many property files as you want and import the respective file before you run against the respective db server.

You can use this property file for not only for database, but also for different web services hosted on different servers such as statging, qa, production without changing the endpoints. All you need is set the property expansion in the endpoint.

Update based on the comment

When you want to use the same for web services, go to the service interface -> Service Endpoints tab and then, add a new endpoint ${#Project#END_POINT}/context/path. Now click on the Assign button. Select All requests and Test Requests from drop down. And you may also remove other endpoints

Add a new property in your property file END_POINT and value as http://host:port. This also gives you advantage if you want to run the tests agains https say https://host:port.

And if you have multiple services/wsdls which are hosted on different servers, you can use unique property name for each service.

Hope this helps.

Rao
  • 20,781
  • 11
  • 57
  • 77
  • Thank you very much for the response Rao. That idea has worked well. Had to slightly tweak it to match the set up of mine since im using groovy scripts as well as JDBC requests but its brilliant (Y) How would you suggest i go about switching between different endpoints for web services? i.e one request would call www.test1@test.com and i would repeat the same test again for www.test2@test.com.. etc? – user610 Jun 06 '16 at 15:18
  • 1
    Will update the answer. By the way, what you were looking for is answered, like to accept it? – Rao Jun 06 '16 at 15:32
  • quick question. if i have an endpoint which is like this: http://xxxx.xxx.co.uk:80/[path to wsdl] would i give the absolute path or just the host:port? also how do i cater for multiple wsdls with the same host;port but different paths? thanks – user610 Jun 07 '16 at 14:55
  • A project can contain multiple services by using different wsdl. Each service might have different endpoint with different operations. Again, you are the best to say how your application services are deployed in single container or in different containers. If all the services are deployed in single container, then most you will have single `host:port`, otherwise, you may different details. If it is single, then use single project property otherwise define more of them as needed. – Rao Jun 07 '16 at 15:00
  • i got it working! thank you Rao, yes as u said it can handle multiple end points so ive just updated the 15 endpoints i did have to now look at a single host:port but added the absolute path to the '/context/path' inside the service endpoint interface – user610 Jun 07 '16 at 15:10
  • 1
    Glad to know. Like I mentioned in the answer, you can keep a property file with all the required details per environment such dev, qa, staging and so on and import the required property file on demand. – Rao Jun 07 '16 at 15:12