我想用yandex坦克测试我的web应用程序,我想测试注册,所以我需要这样发送请求。
可以用不同的登录字段发送这种请求吗?
发布于 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,那么弹药文件将是这样的:
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
...发布于 2014-03-12 09:43:16
也有类似于URI+POST的uri式格式,但对于post bodies:
load.ini:
ammo_type=uripostammo.uripost:
[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开头的行数是邮政机构的大小。
https://stackoverflow.com/questions/22325215
复制相似问题