soapUI使用教程----B站 特斯汀学院

本文是一篇关于如何使用soapUI工具进行SOAP和REST接口测试的教程,包括手机号码服务、英文翻译和IP地址搜索等示例,详细介绍了各个接口的输入参数、输出结果以及如何添加断言进行功能验证。同时,还涵盖了性能测试和REST接口的测试过程。

学习地址

视频学习地址
https://www.bilibili.com/video/BV1V4411v7RR?p=4
博客学习地址
https://www.cnblogs.com/fu512/p/8664576.html

简介

SoapUI是一个开源测试工具,通过soap/http来检查、调用、实现Web Service的功能/负载/符合性测试。

SoapUI下载地址:https://www.soapui.org/,下载开源版SoapUI
在这里插入图片描述

SOAP示例1 上海思集 手机号码服务

http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx ----访问网页用此路径
http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?Wsdl ----访问soapUI用此路径
页面访问效果如下:看到两个方法名,说明此地址下有两个方法,
在这里插入图片描述

获得国内手机号码归属地数据库信息

输入参数:无;返回数据:一维字符串数组(省份 城市 记录数量)。
在这里插入图片描述左侧是网页 右侧是soapUI 界面,如图所示,没有参数,直接点击页面的“调用”或者 soapUI中的绿色三角执行按钮
可以看到效果。

输入参数

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://WebXml.com.cn/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:getDatabaseInfo/>
   </soapenv:Body>
</soapenv:Envelope>


输出结果

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <getDatabaseInfoResponse xmlns="http://WebXml.com.cn/">
         <getDatabaseInfoResult>
            <string>全部 数据 265903</string>
            <string>安徽 安庆 658</string>
            ... ...
            <string>重庆 重庆 4098</string>
         </getDatabaseInfoResult>
      </getDatabaseInfoResponse>
   </soap:Body>
</soap:Envelope>


获得国内手机号码归属地省份、地区和手机卡类型信息

输入参数:
mobileCode = 字符串(手机号码,最少前7位数字),
userID = 字符串(商业用户ID) 免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)。

在这里插入图片描述如图所示: 在soapUI中,mobileCode UerID 默认都是? ,在执行调用的时候,需要将?改为自己需要的输入参数,
如下图所示: mobileCode 为自己的手机号码,由于是测试用户按照说明文档介绍 userID 置空就可以了
在这里插入图片描述

输入参数

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://WebXml.com.cn/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:getMobileCodeInfo>
         <!--Optional:-->
         <web:mobileCode>18052289849</web:mobileCode>
         <!--Optional:-->
         <web:userID></web:userID>
      </web:getMobileCodeInfo>
   </soapenv:Body>
</soapenv:Envelope>

输出结果

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <getMobileCodeInfoResponse xmlns="http://WebXml.com.cn/">
         <getMobileCodeInfoResult>18052289849:江苏 徐州 江苏电信CDMA</getMobileCodeInfoResult>
      </getMobileCodeInfoResponse>
   </soap:Body>
</soap:Envelope>

SOAP 示例2 上海思集英文翻译

http://fy.webxml.com.cn/webservices/EnglishChinese.asmx ------ web 页面访问的接口地址
http://fy.webxml.com.cn/webservices/EnglishChinese.asmx?wsdl ------ soapUI 中的接口地址

EnglishChineseSoap共有6个接口 我们学习最后两个
GetMp3
SuggestWord
Translator
TranslatorReferString
TranslatorSentenceString ---- 根据中文、英文 词语 ,返回含有关键字的语句
TranslatorString ----- 翻译

中英文双向翻译(例句)String()

TranslatorSentenceString
输入参数:wordKey = 单词; 返回数据:一维字符串数组 String[]。
在这里插入图片描述

中英文双向翻译(基本)String()

TranslatorString
输入参数:wordKey = 单词; 返回数据:一维字符串数组 String[]。
在这里插入图片描述

SOAP 示例3 上海思集–IP地址搜索服务

http://ws.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx ------ web 页面访问的接口地址
http://ws.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl ------ soapUI 中的接口地址

getCountryCityByIp
getGeoIPContext ------- 失效
getVersionTime ------- 失效

Ip地址返回国家地区

getCountryCityByIp
通过输入IP地址查询国家、城市、所有者等信息。没有注明国家的为中国
输入参数:IP地址(自动替换 " 。" 为 “.”),返回数据: 一个一维字符串数组String(1),String(0) = IP地址;String(1) = 查询结果或提示信息
在这里插入图片描述

断言示例

同样借用示例3,ip返回国家 地区示例

根据request生成测试用例

在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述

给测试用例添加断言一

在这里插入图片描述在这里插入图片描述在这里插入图片描述

给测试用例添加断言二 正则表达式

步骤同上

(?s).徐州市.+?<. 正则表达式内容
在这里插入图片描述

性能测试

如图所示 testSuit 中的 Load Test 中的

在这里插入图片描述

上海思集—测试次数限制

在这里插入图片描述

REST 接口测试

RESTful 风格地址示例


1.csdn 地址
https://blog.csdn.net/a909301740
https://blog.csdn.net/a909301740/article/details/80587581

https://blog.csdn.net/wei198621
https://blog.csdn.net/wei198621/article/details/107725548
https://blog.csdn.net/wei198621/article/details/107006112

2.豆瓣地址 
https://api.douban.com/v2/book/2129650
3.简书地址
https://www.jianshu.com/p/e3b4fefe839f

REST风格测试过程

新增rest风格的接口

在这里插入图片描述

添加完成后效果

https://blog.csdn.net --------------------- 地址
/wei198621/article/details/107006112 --------------------- resource

在这里插入图片描述

添加同样地址不同资源

/wei198621/article/details/107006112
在这里插入图片描述在这里插入图片描述
在这里插入图片描述

再次展示效果

在这里插入图片描述

示例8中兴原始执行下发接口

http://58.218.116.297:18087/ReceiveOriginalWebService?WSDL —中兴科技原始执行下发接口

在这里插入图片描述

注意上下图的接口要调用第二个 sendOriginalXZZXCmd_, 不要调用第一个
在这里插入图片描述

// An highlighted block
var foo = 'bar';
// An highlighted block
var foo = 'bar';
// An highlighted block
var foo = 'bar';
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值