简体   繁体   English

在 JMeter 中录制场景后要做什么?

[英]What are the things to do after recording scenarios in JMeter?

I am currently recording some scenarios for load testing an application using JMeter.我目前正在记录一些使用 JMeter 对应用程序进行负载测试的场景。 I see that there are a ton of HTTP requests recorded (all with the hostname of the app under test).我看到记录了大量的 HTTP 请求(都带有被测应用程序的主机名)。 I want to know what are the clean up steps to do after recording these samples?我想知道记录这些样本后要执行哪些清理步骤? Ex: Consider that I am recording "Modifying an entry" scenario.例如:考虑我正在录制“修改条目”场景。 In this case, my recorded samples include all the steps I performed:在这种情况下,我记录的样本包括我执行的所有步骤:

  1. Loading all entries as a list,将所有条目加载为列表,
  2. selecting & loading the required entry on full screen,全屏选择并加载所需的条目,
  3. saving the modified entry to the db and将修改后的条目保存到数据库和
  4. displaying all the entries as list once again.再次将所有条目显示为列表。

My questions:我的问题:

  • Should I keep HTTP requests related to all steps (1-4) or just keep the HTTP requests of step 3 as they are the ones directly related to calling the modify API?我应该保留与所有步骤(1-4)相关的 HTTP 请求还是只保留步骤 3 的 HTTP 请求,因为它们与调用修改 API 直接相关?
  • what are the other cleanup steps I should before starting my load testing?在开始负载测试之前我应该执行哪些其他清理步骤?

Running all these requests for each of the scenarios under test for 2 concurrent users gives me response times as large as 26 seconds per scenario whereas while performing the same steps in the app UI takes much smaller time than that.为 2 个并发用户在测试中的每个场景运行所有这些请求,每个场景的响应时间高达 26 秒,而在应用程序 UI 中执行相同步骤所需的时间要短得多。 So I need some guidance in knowing the best practices to do after recording the samples so that my LT results are accurate.所以我需要一些指导来了解记录样本后的最佳实践,以便我的 LT 结果准确。

There is only one best practice: JMeter test needs to replicate the real user using your application via the real browser with 100% accuracy.只有一个最佳实践:JMeter 测试需要通过真实浏览器以 100% 的准确度复制使用您的应用程序的真实用户。

If you get higher response times with JMeter it may be caused by:如果您使用 JMeter 获得更高的响应时间,可能是由以下原因引起的:

  1. Incorrect recorder configuration when it comes to handling embedded resources (images, scripts, styles, fonts, sounds), you should not be recording these calls but rather configure JMeter to automatically download them using parallel thread pool of 6 users处理嵌入式资源(图像、脚本、styles、fonts、声音)时记录器配置不正确,您不应该记录这些调用,而是使用并行线程配置 Z46B48EDA23B8864083D27FEB488C0 用户自动下载它们

    在此处输入图像描述

    在此处输入图像描述

  2. HTTP Cache Manager is missing HTTP 缓存管理器丢失

  3. AJAX calls which browser executes in parallel are executed sequentially in JMeter浏览器并行执行的AJAX调用在 JMeter 中顺序执行

I cannot suggest on your test design when it comes to business actions implementation as I don't know the expected flows, again you need to inspect what requests are under the hood of real user actions using browser developer tools and configure JMeter to send exactly the same requests implementing this or that action.当涉及到业务操作实施时,我无法建议您的测试设计,因为我不知道预期的流程,您需要再次使用浏览器开发工具检查实际用户操作背后的请求,并配置 JMeter 以准确发送实现这个或那个动作的相同请求。

You can avoid copying and pasting repeating parts of the user action flows by introducing Module Controllers您可以通过引入模块控制器来避免复制和粘贴用户操作流程的重复部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM