重命名測試計劃
通過點擊啟動JMeter的窗口 /home/manisha/apache-jmeter-2.9/bin/jmeter.sh. 點擊測試計劃節點上。重命名此測試計劃節點 WebserviceTest.
添加線程組
添加一個線程組,這是所有其他元素,如取樣器,控制器,監聽的占位符。右鍵單擊我們的測試計劃 WebserviceTest(our Test Plan) > Add > Threads(Users) > Thread Group。線程組將添加根據測試計劃(WebserviceTest)的節點。
接下來,讓我們修改線程組的默認屬性,以滿足我們的測試。改變以下屬性:
Name: webservice user
Number of Threads (Users): 2
Ramp-Up Period: leave the the default value of 0 seconds.
Loop Count:2
添加SAMPLER-SOAP/XML RPC請求
現在,我們已經定義了用戶,它是時間定義,他們將要執行的任務。我們將添加 SOAP/ XML-RPC 請求元素。點擊鼠標右鍵得到添加菜單,然后選擇 Add > Sampler > SOAP/XML-RPC Request,選擇元素樹中的SOAP/ XML-RPC請求,并在下面的圖片編輯下列屬性:
這個元素中輸入下列詳細信息:
Name: SOAP/XML-RPC Request URL: http://localhost:8080/hello/hello?wsdl Soap/XML-RPC Data: Enter the below contents <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://ws.yiibai.com/"> <soapenv:Header/> <soapenv:Body> <web:getHelloWorldMessage> <arg0>Manisha</arg0> </web:getHelloWorldMessage> </soapenv:Body> </soapenv:Envelope> |
添加監聽器
需要添加到測試計劃中的最后一個元素是一個監聽器。此元素是負責所有的 HTTP 請求的結果存儲在一個文件中,并呈現出可視化的數據模型。
選擇 webservice 用戶元素,并添加一個查看結果樹監聽器(Add > Listener > View Results Tree).
運行此測試計劃
現在保存的以上測試計劃 test_webservice.jmx。執行本測試計劃使用 Run > Start 選項。
查看輸出
可以看到在過去的圖像響應消息 "Hello Manisha to JAX WS world".
原文轉自:http://www.uml.org.cn/Test/201404213.asp