如何对 AngularJS Web 应用程序进行性能测试? [英] How to performance test an AngularJS Web Application?

查看:25
本文介绍了如何对 AngularJS Web 应用程序进行性能测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我过去主要使用 JMeter 脚本在网站上进行性能测试.

I used to do performance testing on websites mostly with JMeter scripts.

然而,越来越多的项目使用前端 MVC 构建,例如 AngularJS,并且当前项目正在通过 Angular 视图文件、REST 调用等加载其所有内容.不幸的是,JMeter 不执行任何 javascript,因此我的负载测试仅在(400 毫秒)内返回主页.实际上,在浏览器中加载实际上需要几秒钟.当我检查响应数据时,由于 Angular,它不包含任何数据.

However, more and more projects are build with frontend MVC's, such as AngularJS and a current project is loading all of it's content via angular view files, REST calls etc. Unfortunately, JMeter doesn't execute any javascript thus my load test return me the homepage in just (400ms). In real, it actually takes several seconds to load in a browser. When I check the response data, it does not contain any data yet due to Angular.

而不是调查网络流量并单独加载每个组件(例如 profile.html、notification.html、REST 调用等).是否有市场上的产品或我可以遵循的类似于执行 JMeter 脚本的最佳案例,但考虑到 javascript 执行和由于 javascript 导致的外部资源加载?

Instead of investigating the network traffic and individually loading each component (e.g. profile.html, notification.html, REST calls etc. ). Is there a product on the market or some best case I could follow that is similar to executing JMeter scripts, but considering javascript execution and loading of external resources due to javascript?

(我不打算分析 javascript 执行时间.这仍然是为了测试背后的基础设施是否能够同时为 xyz 用户提供服务)

(I am not planning to profile javascript execution times. This is still to test if the infrastructure behind is capable serving xyz simultaneous users)

推荐答案

虽然 JMeter 不能执行客户端 JavaScript,但它可以通过 HTTP(S) 测试脚本记录器.记录后,您应该能够使用 JMeter 的 Transaction Controller 将所有独立请求合并为一个聚合"

Although JMeter isn't capable of executing client-side JavaScript it can record relevant requests via HTTP(S) Test Script Recorder. Once recorded you should be able to combine all the standalone requests into one "aggregate" using JMeter's Transaction Controller

如果由于某些原因这种简单的方法对您不起作用,请查看 如何使用 JMeter 加载测试启用 AJAX/XHR 的站点 以获取更多选项和线索.

If this easy approach for some reasons doesn't play for you check out How to Load Test AJAX/XHR Enabled Sites With JMeter for more options and clues.

这篇关于如何对 AngularJS Web 应用程序进行性能测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆