SOAPUI在测试套件的数据库连接之间切换的能力 [英] SOAPUI ability to switch between database connections for test suite

查看:248
本文介绍了SOAPUI在测试套件的数据库连接之间切换的能力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些背景:



我有大量的SOAPUI测试用例测试web服务以及数据库事务。这在工作正常,当有一个或两个不同的环境,因为我会克隆原来的测试套件,更新数据库连接,然后更新端点指向新的环境。这里的一些变化意味着我只是重新克隆测试用例更新为其他测试套件。



然而,我现在有6个不同的环境,这些测试要运行和预期,我一直在添加更多的测试用例,以及改变原来的。这会导致运行较旧的测试套件时出现问题,因为它们需要重新克隆。



我想知道是否有更好的方法来组织这个。理想情况下,我想要一个测试套件,并能够在数据库连接和Web服务端点之间切换,但不知道从哪里开始。非常感谢任何帮助或指导。



我只能访问免费版的SOAPUI



是目前的结构:





这里有一个原始的测试套件,包含所有的测试。但它被配置为对服务器运行测试。像您提到的,您克隆了第二个数据库模式的套件,并更改了连接详细信息。现在实现,因为有更多的数据库需要测试。



让你的项目与所需的测试套件。在任何地方,提供数据库服务器详细信息,用属性扩展替换实际值以获取连接详细信息。



在Jdbc步骤中,更改连接字符串:
jdbc:oracle:thin:scott / tiger @ // myhost:1521 / myservicename



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



您可以将以下属性定义到文件中并相应命名。说,以下属性与托管在 host1 上的数据库相关,并具有详细信息,命名为 host1.properties 。当您要对 host1 数据库运行测试时,请在项目级自定义属性中导入此文件。

 DB_PASSWORD = password 
DB_HOST = host1
DB_PORT = 1521
DB_SERVICE =服务名

同样,您可以保留任意数量的属性文件,并在相应的db服务器运行之前导入相应的文件。



您不仅可以将此属性文件用于数据库,还可以用于托管在不同服务器上的不同Web服务,例如统计,qa,生产,而无需更改端点。



$ b

根据评论更新 b

当你想对web服务使用相同的时候,去服务接口 - >服务端点选项卡,然后添加一个新的端点 $ {#Project#END_POINT} / context / path 。现在点击 Assign 按钮。从下拉列表中选择所有请求和测试请求。您还可以删除其他端点



在属性文件 END_POINT 中添加一个新属性,值为 http:// host:port 。如果你想再次运行测试,这也给你带来了优势https https:// host:port



如果您有多个服务/ wsdls在不同的服务器上托管,您可以为每个服务使用唯一的属性名称。



希望这有助于。


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:

解决方案

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.

这篇关于SOAPUI在测试套件的数据库连接之间切换的能力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆