使用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"
    }
相关文章
相关标签/搜索