加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

使用Jmeter测试Webservice简单示例

发布时间:2020-12-16 22:38:44 所属栏目:安全 来源:网络整理
导读:1、webservice 先简单开发webservice,参考文档 http://www.cnblogs.com/xwdreamer/archive/2011/12/07/2296914.html webservice没有打成war包,是在eclipse运行测试(这块有时间补充) 2、Jmeter 2.1 创建线程组(setUp Thread Group) 2.2 在线程组下创建


  1、webservice

  先简单开发webservice,参考文档

  http://www.cnblogs.com/xwdreamer/archive/2011/12/07/2296914.html

  webservice没有打成war包,是在eclipse运行测试(这块有时间补充)

  2、Jmeter

  2.1 创建线程组(setUp Thread Group)

  2.2 在线程组下创建取样器(SOAP/XML-RPC Request)

  1)设置URL(wsdl路径):http://localhost:8080/WebServiceProject/services/CalculateService?wsdl

  2)SOAP/XML-RPC Data(这块可以在ie运行wsdl中取),下图


  点击Type为SOAP的Name,如: CalculateServiceSoap11Binding ,点击plus(加法),出现下图

  输入x,y值,点击go

  在右下框的status看到结果,点击source,取SOAP Request Envelope(为这个,绕了半天)

  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://wstest.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <soapenv:Body>

  <q0:plus>

  <q0:x>${a1}</q0:x>

  <q0:y>${a2}</q0:y>

  </q0:plus>

  </soapenv:Body>

  </soapenv:Envelope>

  2.3 添加监听器:察看结果树

  运行该脚本,一个简单的webservice如何在Jmeter中运行完成

  脚本增强,参数化

  添加元件:CSV Data Set Config

  filename:数据文件路径

  variable Name:参数名(多个参数使用逗号分开,)

  参数化设置图


  数据文件


投稿请联系:editor@51testing.com


更多精彩内容,请点击左下角“阅读原文”吧!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读