简体   繁体   English

使用 Jmeter 进行负载测试

[英]Load testing using Jmeter

I have the following scenario:我有以下场景:

  1. Users are authenticated through JWT in a Laravel API.用户通过Laravel API 中的JWT进行身份验证。
  2. On successful login, the users can navigate to a survey form, where they can answer to a set of questions (multi-selects, selects, radio buttons etc).成功登录后,用户可以导航到调查表,在那里他们可以回答一组问题(多选、选择、单选按钮等)。
  3. A logged in admin can view the answers of the user in real-time ( Web-sockets are used here), being plotted in charts.登录的管理员可以实时查看用户的答案(此处使用Web-sockets ),并绘制在图表中。 For example let's say a question is "What's your gender?", a pie chart is shown with 10% male and 90% female.例如,假设一个问题是“你的性别是什么?”,一个饼图显示有 10% 的男性和 90% 的女性。

I'd like to simulate 100 users answering some predefined questions and see the response being plotted in different charts in real-time.我想模拟 100 个用户回答一些预定义的问题,并实时查看在不同图表中绘制的响应。 I thought of using Jmeter for load testing.我想到了使用Jmeter进行负载测试。 But don't know the steps to login those 100 users and simulate answering the questions.但是不知道登录这100个用户并模拟回答问题的步骤。

I want to test the response time and just visually see the answers being plotted in real-time.我想测试响应时间,只是直观地看到实时绘制的答案。

  1. For authenticating via JWT you need to extract the token from the first response using JSON Extractor and make sure the JWT Token value is being added to the following requests via HTTP Header Manager .要通过 JWT 进行身份验证,您需要使用JSON Extractor从第一个响应中提取令牌,并确保通过HTTP Header Manager将 JWT 令牌值添加到以下请求中。 Check out Testing Microservices with JMeter article for more details if needed.如果需要,请查看使用 JMeter 测试微服务文章以获取更多详细信息。
  2. I believe you can record all these survey steps using HTTP(S) Test Script Recorder and build the test flow out of the resulting HTTP Request samplers我相信您可以使用HTTP(S) 测试脚本记录器记录所有这些调查步骤,并从生成的HTTP 请求采样器中构建测试流程
  3. You can use ie JMeter WebSocket Samplers to simulate admin actions.您可以使用 ie JMeter WebSocket Samplers来模拟管理操作。 Most probably you will not see "charts" themselves, however you will be able to observe raw data and use Assertions to check its integrity您很可能不会看到“图表”本身,但是您将能够观察原始数据并使用断言来检查其完整性

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

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