使用AB工具壓力測試接口

1.測試不須要任何參數的接口地址:GET:http://api-test.com/test.phpphp

  • 測試命令:ab.exe –n 800 –c 200 http://api-test.com/test.php

2.測試須要帶header參數的接口地址:GET:http://api-test/header.phpjson

  • 測試命令:ab.exe -n 800 -c 200 -H "Content-Type:application/json" -H "Authorization:Bearer LTB1fdhfdDFghr5567fghgfh5hfgb9BAaZB" http://api-test/header.php

3.測試post請求的接口地址:POST:http://api-test.com/post.phpapi

  • 測試命令:ab.exe –n 500 –c 100 –p post.txt –T application/json http://api-test.com/post.php
  • 製做請求參數文件:post.txt,請求的數據格式爲json
  • {
    	"grant_type": "password",
    	"client_id": "test",
    	"client_secret": "sdfsdfsdfDFD0573mksdfdDFEFlsdfsdf",
    	"scope": "test",
    	"username": "18814137313",
    	"password": "123456"
    }
相關文章
相關標籤/搜索