JMeter在WindowsLinux環境下的安裝使用

來源:互聯網
上載者:User

JMeter在WindowsLinux環境下的安裝使用
一、Windows環境下測試1.下載:

官網地址:http://apache.fayea.com//jmeter/binaries/apache-jmeter-2.12.zip

2.開啟:

進入bin目錄下 運行jmeter.bat

3.使用:

0>.在測試計劃中添加一個線程組

1> 配置線程組,主要是取樣器錯誤後執行動作、線程數、迴圈次數

2> 添加一個測試對象 即取樣器。主要參數:IP,Port,協議,方法,路徑,傳遞的參數。

其中參數部分,可以直接在Parameters框體中填入 參數名+參數值。也可以將參數寫入.CSV檔案,在Parameters框體中填入參數和引用參數變數名。以滿足每次提交改變參數的值得需求。

這次測試中 我將參數寫在 zset.CSV中,見 圖2.1 ,在.CSV檔案中,每行為一個參數組,參數之間用,隔開。

2.1>注意 .CSV檔案格式以及參數變數名。

2.2> 響應斷言,用來驗證是否請求成功,從而才能得出測試結果。根據實際情況選炸ky"http://www.bkjia.com/kf/web/php/" target="_blank" class="keylink">PHP7NOm19a2ztPrsuLK1MSjyr2hozwvcD4KPHA+PGltZyBzcmM9"http://www.2cto.com/uploadfile/Collfiles/20141230/20141230105851252.png" alt="\">

2.3> 斷言結果,即每次請求是否滿足斷言要求。如果出錯這裡會列印出來。

2.4>圖形結果,展示測試結果

2.5>總結報告 展示測試結果

Java(TM) SE Runtime Environment 1.7.0_67-b01, ISO-8859-1, en
[14-12-29 16:12:45.601] {main} Java HotSpot(TM) Server VM 24.65-b04, 32, mixed mode, Oracle Corporation
[14-12-29 16:12:45.601] {main}
[14-12-29 16:12:45.601] {main} user.name = root
[14-12-29 16:12:45.686] {main}
[14-12-29 16:12:45.693] {main} server listening to localhost.localdomain:6800
[14-12-29 16:12:45.698] {main}
[14-12-29 16:12:45.808] {main}
[14-12-29 16:12:45.809] {main} resin.home = /usr/local/resin-4.0.41/
[14-12-29 16:12:45.809] {main} resin.root = /usr/local/resin-4.0.41/
[14-12-29 16:12:45.809] {main} resin.conf = /usr/local/resin-4.0.41/conf/resin.xml
[14-12-29 16:12:45.809] {main}
[14-12-29 16:12:45.809] {main} server = 127.0.0.1:6800 (app:app-0)
[14-12-29 16:12:45.810] {main} stage = production
[14-12-29 16:12:46.234] {resin-32} WebApp[production/webapp/default/resin-admin] active
[14-12-29 16:12:46.262] {resin-33} WebApp[production/webapp/default/ROOT] active
[14-12-29 16:12:46.696] {resin-34} WebApp[production/webapp/default/resin-doc] active
[14-12-29 16:12:46.697] {main} Host[production/host/default] active
[14-12-29 16:12:46.697] {main} ServletService[id=app-0,cluster=app] active
[14-12-29 16:12:46.697] {main}
[14-12-29 16:12:46.698] {main} http listening to *:8080
[14-12-29 16:12:46.698] {main}
[14-12-29 16:12:46.699] {main} Resin[id=app-0] started in 2685ms

然後在自己pc上訪問 server ip:port 看到resin預設歡迎頁面即說明安裝成功。

Resin? Default Home Page


This is the default page for the Resin web server.
Documentation is available at /resin-doc.


Administration is available at /resin-admin.

之後把在Windows下的web項目的war包拷進 ren目錄下的webapps 檔案夾內,即可在外網訪問伺服器上的web項目了。

3> 安裝jmeter

下載:同樣在jemeter官網下載 對應的安裝包

解壓:

執行:./jmeter -n -t ../ssdb_test.jmx -l ../log.jtl

說明:

a.-n 參數說明不用驗證是否安裝了圖形庫

b. .jmx檔案可以在windows環境下的用jmeter圖形化產生,涉及參數以及測試結果的.csv檔案路徑可以直接 用notepad++ vi 等修改.jmx檔案,確保其相對於.jmx檔案路徑正確。

c.log.jtl 儲存測試結果 既然沒裝圖形介面庫,那麼測試結果.jtl檔案就只能在windows下用jmeter來查看了。

[@zjm_44_250 bin]# jmeter
-bash: jmeter: command not found
[@zjm_44_250 bin]# ./jmeter
An error occurred:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
[@zjm_44_250 bin]# ./jmeter.sh
An error occurred:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
[@zjm_44_250 bin]# ./jmeter -n -t ../ssdb_test.jmx -l ../log.jtl
Creating summariser <summary>
Created the tree successfully using ../ssdb_test.jmx
Starting the test @ Mon Dec 29 18:43:20 CST 2014 (1419849800772)
Waiting for possible shutdown message on port 4445
summary = 100 in 0.3s = 289.9/s Avg: 105 Min: 3 Max: 285 Err: 0 (0.00%)
Tidying up ... @ Mon Dec 29 18:43:21 CST 2014 (1419849801734)
... end of run
[@zjm_44_250 bin]#

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.