Why there is difference in test and data interaction speed when use API vs jmeter recording

时间:2016-08-30 04:47:00

标签: asp.net-web-api jmeter

I have a login function in website. I have tried 2 things to create load testing plan :

  1. Record login scenario using jmeter and complete load test
  2. Use login API, configure in Jmeter and complete load test

I realize that 2nd option from above is faster than 1st when running load test? Can anyone help me to understand why?

1 个答案:

答案 0 :(得分:1)

  1. 表现良好的测试应该尽可能地模拟最终用户行为,所以基本上你至少有2个请求:

    • 打开登录页面
    • 执行登录

    此外,在模仿真实浏览器时,您必须处理更多数据,即完整的HTML响应,JavaScript,CSS,图像等。

  2. 如果是API,您只有一个请求包含用户名和密码,以及一个小响应,指示登录尝试是否成功。

  3. 我认为负载测试应该尽可能接近现实,所以我建议第一个选项。确保将下一个测试元素添加到测试计划中: