soapui groovy oracle,soapUI中使用Groovy生成和验证数据(最新整理)

《soapUI中使用Groovy生成和验证数据(最新整理)》由会员分享,可在线阅读,更多相关《soapUI中使用Groovy生成和验证数据(最新整理)(3页珍藏版)》请在人人文库网上搜索。

1、在 soapUI 中使用 Groovy 生成和验证数据soapUI 是一款领先的 Web Service 测试工具,它支持脚本,来做一些更灵活的测试工作。比如生成测试数据并在之后做验证。我们假设一个场景,我们接受一个 WebServices,它含有 id 和 name 信息。我们会把这些信息存到数据库的a_table表里。code=sqlCREATE TABLE A_TABLE (ID NUMBER(8, 0) NOT NULL, NAME VARCHAR2(20),CONSTRAINT TABLE1_PK PRIMARY KEY (ID);/code1. 添加如下脚本到 TestCase 的。

2、Setup Script中code=javaimport groovy.sql.Sqldef username = context.expand( $jdbc.username ) def password = context.expand( $jdbc.password ) def url = context.expand( $jdbc.url )def driver = context.expand( $jdbc.driver )def sql = Sql.newInstance(url, username, password, driver) def maxId = sql.firstR。

3、ow(select max(id) value from a_table) if (null = maxId.value) maxId = 0;else maxId = maxId.valuelog.info max manufacturer id is: $maxIddef prop = testRunner.testCase.getTestStepByName( Properties ) prop.setPropertyValue( id, String.valueOf( maxId + 1) ); prop.setPropertyValue( name,TestName + String。

4、.valueOf( maxId + 1) ); /code2. 添加 Properties codeid name /code3. Modify Test Request code=xml$Properties#id$Properties#name/code4. 添加 Script Assertion 用于验证code=javaimport groovy.sql.Sqldef username = context.expand( $jdbc.username ) def password = context.expand( $jdbc.password ) def url = context.。

5、expand( $jdbc.url )def driver = context.expand( $jdbc.driver )def sql = Sql.newInstance(url, username, password, driver)def prop = testRunner.testCase.getTestStepByName( Properties ) def id = prop.getPropertyValue( manID ).toInteger()def name = prop.getPropertyValue( manName ) def row = sql.firstRow。

6、(select id id, name name from a_table where id = $id) assert null != rowassert id = row.idassert name.equals(row.name) /code在 soapUI 中使用动态 Endpoint1. 创建一个 soapui.properties 文件把它放在你的 soapUI 主目录的 bin 目录下soapui.properties 例子:code# endpoint listserviceA.endpoint = http:/localhost:7001/axis/services/serv。

7、iceASOAP serviceB.endpoint = http:/localhost:7001/axis/services/serviceBSOAP /code2. 打开你的 TestCase,设置 endpoint 为你的 endpoint 属性名,例如 $#serviceA.endpoint3. 运行你的 TestCase,你会发现 endpoint 被成功替换了“”“”At the end, Xiao Bian gives you a passage. Minand once said, people who learn to learn are very happy people.。

8、 In every wonderful life, learning is an eternal theme. As a professional clerical and teaching position, I understand the importance of continuous learning, life is diligent, nothing can be gained, only continuous learning can achieve better self. Only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. This document is also edited by my studio professionals, there may be errors in the document, if there are errors, please correct, thank you。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值