SOAPUI ability to switch between database connections for test suite

前端 未结 1 414
一个人的身影
一个人的身影 2020-12-21 22:07

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

相关标签:
1条回答
  • 2020-12-21 23:05

    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.

    0 讨论(0)
提交回复
热议问题