我是JMeter的新手,希望深入了解如何在JMeter中复制浏览器和用户行为 . 使用JMeter测试Web应用程序时的最佳实践是什么(主要用于httpd,php,angular等)
从一些阅读文档中我应该使用计时器来延迟每个采样器以获得更真实的用例
在阅读JMeter文档后,我仍然有一些困惑:
HTTP Request configuration:
- 我们应该使用Java而不是HTTPClient4吗?
- 我们应该从HTML文件启用嵌入式资源吗?
Cookie Manager:
- 我们应该在每次迭代时保留或清除cookie
Cache Manager:
- 我们应该清除每次迭代的缓存还是保留它? - 我们应该使用缓存控制头吗? - 缓存中max number元素的最佳值是多少?
Where i should put cache manager, cookies manager?
如果我有超过1个线程组,在测试计划下或在线程组下?
How to configure keepalive in JMeter sampler or header manager?
我的用例是复制访问Web应用程序的10个并发唯一用户
1 回答
HTTP Request configuration :
我们应该使用Java而不是HTTPClient4吗? - The recommended implementation is HTTPClient4, this way you will be able to use DNS Cache Manager, HTTP Authorization Manager with Kerberos, etc.
should we enable embedded resources from HTML files? - Of course, but make sure to exclude "external" ones which are not related to your application, i.e. fonts or scripts which reside in other domain. See Web Testing with JMeter: How To Properly Handle Embedded Resources in HTML Responses for more information.
Cookie Manager:
Cache Manager:
我们应该在每次迭代时清除缓存还是保留它? Depending on your scenario, like Cookie Manager
我们应该使用缓存控制头吗? Depending on how caching is implemented in your application under test
缓存中max number元素的最佳值是多少? It needs to be sufficient to keep all cacheable content in your application. You can clear i.e. Chrome browser cache, execute your test scenario manually, open chrome://net-internals/#httpCache URL and see how many Entries do you have. Amend this setting to be equal or a little bit more
Where i should put cache manager, cookies manager? 如果我有超过1个线程组,则在测试计划下或在线程组下? These "managers" obey JMeter Scoping Rules, if you put them under Test Plan - they will be applied to all Thread Groups, if you put them under Thread Groups - they will be applied to current Thread Group only
How to configure keepalive in JMeter sampler or header manager? - If you tick Use KeepAlive under HTTP Request sampler - it will AUTOMATICALLY add Connection: keep-alive header. If you untick it - JMeter will send Connection: close header. Don't use HTTP Header Manager for amending Connection header value