使用Jmeter测试webservice简单示例

 

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:参数名(多个参数使用逗号分开,)

参数化设置图

数据文件

 

posted @ 2015-08-21 17:15  researchyang  阅读(8364)  评论(0编辑  收藏  举报