并发测试

得到接口的curl命令方法:

1,登录状态下在浏览器打开要测试的接口:

http://cq01-testing-fbqa02.cq01.baidu.com:8756/app/balance/openAccount?from=4.0.0&itemId=94200001

 

2,F12进入开发者模式,点击NetWork.

 

并发测试_第1张图片

3,在箭头处点击右键,copy->copy as cURL(cmd)

4,复制的内容即为shell中要curl的内容:

curl "http://cq01-testing-fbqa02.cq01.baidu.com:8756/app/balance/openAccount?from=4.0.0^&itemId=94200001" -H "Accept-Encoding: gzip, deflate" -H "Accept-Language: zh-CN,zh;q=0.8" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Mobile Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Cache-Control: max-age=0" -H "Cookie: BDUSS=p3RGt0cVkxNkFYdFdTcm9HNkY0WlZJSE82ZXlVVTNOcWlCT3E0RFhwVlZ0cWRaQVFBQUFBJCQAAAAAAAAAAAEAAACPjgeVamluZ2Jhb2JhbzA0MDUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFUpgFlVKYBZNX; BAIDUID=8C74B2B9E0DBD996B58EA353F59877EA:FG=1; BIDUPSID=8C74B2B9E0DBD996B58EA353F59877EA; PSTM=1496198106; __cfduid=d5d327aa90d8c4d6ebc327fefcf3d91681497239475; BDUSS=1tcEtZLVpIc2VaZ35uaWNJWGtvUzk1dkEwZkl2a3BlRH51T1lWQnZzUXk5TGhaSVFBQUFBJCQAAAAAAAAAAAEAAAAWnwAIy8S8vsfpvdoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADJnkVkyZ5FZUG; JSESSIONID=DB59E974757EA4152E032FD3404D0A99; superdsid=cd506d19-cae2-44b2-8824-25b0da46b236; BDRCVFR^[PaHiFN6tims^]=mk3SLVN4HKm; PSINO=2; H_PS_PSSID=; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598" -H "Connection: keep-alive" --compressed

 

通过shell脚本方式,在本机执行,网络延迟比较小

注意在后面的& 作用为:让程序并发执行,不用等待返回值。

例如

#!/bin/bash

for ((i=0;i<20;i++))

do

curl -H "Content-type:application/x-www-form-urlencoded" -X POST http://127.0.0.1:8758/fund/async/purchase_success -d "orderId=20170401180058400314693944&status=0&contractNo=20098&cashAmount=100000.0&redeemType=0&goodsAmount=100000.0&transactionTime=20170405090451&extTime=20170406&error=确认成功&cmd=purchase_ret&ret_code=0000" &

done

你可能感兴趣的:(测试)