JMeter

tags: 壓力測試

安裝

https://jmeter.apache.org/download_jmeter.cgi

  • Windows版安裝 : apache-jmeter-X.X.X.zip
  • Linux版安裝 : apache-jmeter-X.X.X.tgz

以下用Windows版講解:
下載完成後解壓縮,獲得了一包apache-jmeter-X.X.X,cmd 執行該包下的apache-jmeter-X.X.X/bin/jmeter.bat。可以獲得一個Jmeter畫面:

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

建立測試計畫

進入Jmeter GUI後在測試計畫(Test Plan)上點擊右鍵 > Add > Threads(Users) > Thread Group。每一個Threads就是在模擬每一個人的行為。

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

接著對著Thread Group按右鍵 > Add > Sampler > Http Reqester

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

基本功能跟POSTMAN很像就不多提了

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

建立報告

在測試計畫(Test Plan)上點擊右鍵 > Add > Listener > View Results Tree

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

也可以使用View Results in Table

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

執行

進入Jmeter GUI後在簡易工具列點擊綠色箭頭(如圖)即可

Image Not Showing Possible Reasons
  • The image was uploaded to a note which you don't have access to
  • The note which the image was originally uploaded to has been deleted
Learn More →

其他筆記

  • 千萬不要在Body Data裡面用註解,會導致測試錯誤(原因不明)