如何测试 UI 的加载,如果它是用 Typescript 编写的,使用 Jmeter

how to test the loading of UI, in case it is written in Typescript, using Jmeter

我的应用程序使用 Angular 9,其中,打字稿用于 UI,并在 运行 时间转换 你的问题是页面需要时间来加载 因此,为此,我通过优化查询来检查查询,但问题仍然相同 所以需要检查 UI 加载时间,那么我们如何测试呢。

您无法使用 JMeter 本身测试 UI 加载时间,根据 JMeter project main page:

JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).

因此,如果您需要测试页面呈现的性能,最好考虑像 Lighthouse.

这样的专门解决方案

如果您的测试框架是围绕 JMeter 构建的,并且您需要向测试套件添加 client-side 性能测试,您可以考虑使用 WebDriver Sampler which provides JMeter integration with Selenium 浏览器自动化框架。