[英]Writing a simple JMeter script
I need to write a script that does the following (doesn't matter to which website, I am only doing this to learn and practice): 我需要编写一个执行以下操作的脚本(与哪个网站无关,我只是这样做才能学习和练习):
After a few hours of reading the documentation and watching some video tutorials, I can manage step 1 easily. 在阅读文档并观看一些视频教程几个小时之后,我可以轻松地管理第1步。 I have a little idea on how to do steps 2 and 4 though there might be a chance that I am not doing them efficiently. 我对如何进行第2步和第4步有一点了解,尽管我可能不会有效地执行它们。 And unfortunately I have no idea how to do step 3. 不幸的是,我不知道如何做第3步。
Can someone help me in doing those steps please or at least give me some good links to tutorials that may help me out (I've found the official manual too confusing)? 有人可以帮我做这些步骤,或者至少给我一些很好的链接,可以帮助我解决教程(我发现官方手册太混乱了)?
Here are some links I used to learn this tool: For step 1 and for step 2 they helped a little but more guidance is welcomed. 以下是我用来学习这个工具的一些链接: 对于步骤1和步骤2,他们帮助了一点,但欢迎更多的指导。
The best sources of Jmeter documentation I know about are in Documentation section at JMeter website: user manual and best practices (for starters), Component Reference and Functions reference (once you are comfortable with basic Jmeter capabilities). 我所知道的Jmeter文档的最佳来源是JMeter网站的文档部分: 用户手册和最佳实践 (适用于初学者), 组件参考和功能参考 (一旦您熟悉基本的Jmeter功能)。
Especially you should read 4th , 5th and 6th sections of User Manual that will give you answers to those and many other questions that you'll have. 特别是你应该阅读用户手册的第 4 , 第5和第6部分,它们将为你提供答案以及你将拥有的许多其他问题。
Nevertheless I should give answers by myself: 不过我应该自己给出答案:
${variable}
in your test 我想最有用的是正则表达式提取器,它将数据提取到变量,然后你可以在测试中将此变量用作${variable}
Once you are comfortable with JMeter capabilities note that some useful functionality is absent in it but exists in JMeter plugins : 一旦您熟悉JMeter功能,请注意其中没有一些有用的功能,但存在于JMeter插件中 :
Use post processors like Regular expression extractors , JSON extractors to extract any values. 使用正则表达式提取器,JSON提取器等后处理器来提取任何值。
Add These post processors as a child of http samplers and name,enter regular expression , template ... 将这些后期处理器添加为http采样器和名称的子项,输入正则表达式,模板...
http://regex101.com/ is the best site to test your regular expressions http://regex101.com/是测试正则表达式的最佳网站
To use the extracted value futher in your script use ${variable_name} 要在脚本中使用提取的值,请使用$ {variable_name}
For more info please read this article 欲了解更多信息,请阅读这篇文章
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.