首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Yandex油罐桩数据

Yandex油罐桩数据
EN

Stack Overflow用户
提问于 2014-03-11 12:04:06
回答 2查看 6K关注 0票数 4

我想用yandex坦克测试我的web应用程序,我想测试注册,所以我需要这样发送请求。

  • 标题 POST /registration HTTP/1.1主机:本地主机:8080连接:保持活内容长度: 30缓存-控制:最大年龄=0接受: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 http://localhost:8080用户-代理:http://localhost:8080/5.0 (X11;AppleWebKit/537.36 (x86_64,类似壁虎) Chrome/33.0.1750.146 Safari/537.36内容-类型:application/x form-urlencoded:http://localhost:8080/registration接受-编码: gzip,deflate,sdch接受-语言: en-US,en;q=0.8,ru;q=0.6 Cookie: JSESSIONID=igq9ejgl10jirr4t73mpjblp;
  • 表格数据 login=abracadbra&password=brar

可以用不同的登录字段发送这种请求吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-03-11 17:17:42

是的,有可能,关于POST请求,您应该使用请求样式的弹药文件,请参见http://yandextank.readthedocs.org/en/latest/tutorial.html#request-style

您可以指定弹药文件作为命令行参数,或者将其放在幻影部分的坦克.ini文件中。

请记住,使用幻影作为负载生成器,不可能执行基于场景的测试,因此您应该预先为请求生成所有必要的数据。燕德士油箱只需按照所需的装载方案发送。

我不确定CSRF保护在您的情况下是如何工作的,如果它不允许对多个请求重用会话和csrftoken (注册请求必须使用这个参数),那么您将需要为每个请求获得有效的Cookies来生成弹药。在这种情况下,我建议您切换到一些基于场景的工具,即this。您也可以使用as作为yandex储罐的负载发生器,请参阅http://yandextank.readthedocs.org/en/latest/configuration.html#jmeter

如果您可以在多个注册中重用相同的Cookie,那么弹药文件将是这样的:

代码语言:javascript
复制
649 tag1
POST /registration HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 30
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://localhost:8080/registration
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,ru;q=0.6
Cookie: csrftoken=XJ3oheJb0SndHfNAH2lSV2AtKNxxuXdv; JSESSIONID=igq9ejgl10jirr4t73mpjblp

login=abracadbra&password=brar

646 tag2
POST /registration HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 27
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://localhost:8080/registration
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,ru;q=0.6
Cookie: csrftoken=XJ3oheJb0SndHfNAH2lSV2AtKNxxuXdv; JSESSIONID=igq9ejgl10jirr4t73mpjblp

login=sample2&password=brar

...
票数 6
EN

Stack Overflow用户

发布于 2014-03-12 09:43:16

也有类似于URI+POSTuri式格式,但对于post bodies:

load.ini:

代码语言:javascript
复制
ammo_type=uripost

ammo.uripost:

代码语言:javascript
复制
[Host: example.org]
[Connection: close] 
[User-Agent: Tank]  
5 /route/?rll=50.262025%2C53.276083~50.056015%2C53.495561&origin=1&simplify=1
class
10 /route/?rll=50.262025%2C53.276083~50.056015%2C53.495561&origin=1&simplify=1
hello!clas
7 /route/?rll=37.565147%2C55.695758~37.412796%2C55.691454&origin=1&simplify=1
uripost

以uris开头的行数是邮政机构的大小。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22325215

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档