- JMeter Cookbook
- Bayo Erinle
- 380字
- 2021-08-05 17:36:28
Testing Single Page Applications (SPAs)
Single-page applications are the new wave of web applications being developed in today's technological industry. The benefits of developing such applications can't be overstated. They relieve the servers of enormous load and bring faster responsiveness to the end user. They are architected differently from traditional web applications, which make them slightly different to develop test scripts for.
How to do it…
In this recipe, we will work through creating a script for an SPA. Perform the following steps:
- Launch JMeter.
- Add HTTP(S) Test Script Recorder and set it up for recording (see the Recording a script via JMeter HTTP proxy recipe).
- Click the Add suggested Excludes button.
- Start the HTTP(S) Test Script Recorder.
- Point your browser to http://angular.github.io/peepcode-tunes/public/.
- Add the two available albums (on the right) to your playlist (on the left).
- Randomly select a song to listen to.
- Use the buttons on the player to jump to the next or previous song or pause them.
- Stop the HTTP(S) Test Script Recorder.
- Add a listener to your test plan.
- Save and run the test plan.
How it works…
The actions of the user are tracked and recorded via the script recorder we set up in step 2. Like traditional web applications, we record all actions and exclude irrelevant static resources, such as images, JavaScript, and style sheets. Every call that makes a server call to backend services is also recorded as part of the test plan and is available for replay during test execution. At the end, we have a script that is almost identical to what we would get when recording a traditional web application.
There's more…
Most SPAs tend to be JavaScript-intensive. As JMeter isn't a web browser, JavaScripts embedded within a page or included from a separate file altogether won't be executed. With this in mind, it means JMeter can't be accurately used to measure page load times or browser DOM rendering. What it can do, however, is record any calls made to the server from your JavaScript files and play those back when the test is re-executed.
Such calls have an impact on the servers and are critical to measure to know how slow or fast a user's experience will be when the application is under considerable load.
- 大數據技術基礎
- SQL Server 2016 數據庫教程(第4版)
- 云計算環(huán)境下的信息資源集成與服務
- Test-Driven Development with Mockito
- Libgdx Cross/platform Game Development Cookbook
- 數據要素五論:信息、權屬、價值、安全、交易
- Neural Network Programming with TensorFlow
- 中國數字流域
- 數據挖掘原理與SPSS Clementine應用寶典
- SQL優(yōu)化最佳實踐:構建高效率Oracle數據庫的方法與技巧
- 大數據技術入門
- 圖數據實戰(zhàn):用圖思維和圖技術解決復雜問題
- SQL應用及誤區(qū)分析
- 重復數據刪除技術:面向大數據管理的縮減技術
- SQL Server深入詳解