- JMeter Cookbook
- Bayo Erinle
- 369字
- 2021-08-05 17:36:28
Testing AJAX-centric applications
In today's stack of web applications, it is almost unthinkable to build an application without some dynamic content being retrieved from a backend service. Most of the time, these applications tend to lean towards partial page fresh. That is, only the needed sections of a rendered page are refreshed as opposed to the whole page loading its entire content again. This leads to more responsive pages, which improves the overall experience of the user.
How to do it…
In this recipe, we will walk through how you can test such applications using JMeter. 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 https://maps.google.com.
- Perform a couple of searches in the provided search box (for example, pizza, restaurants, hotels, and so on).
- Click on a few of the returned results.
- Repeat steps 6 and 7 two more times.
- 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. Calls that trigger backend server calls are trapped and are available for replay later. 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...
AJAX-centric applications tend to involve a lot of asynchronous server requests made from within the client (frontend). These calls are normally made from embedded script tags within a view technology, for example, HTML, Java Server Pages (JSP), Groovy Server Pages (GSP), or from an included JavaScript file in the page. As such, JMeter records all such server requests and they can be played back at the time of running our test plans. This allows us to simulate the intended load on our servers, as though the application was the one making the AJAX calls.
- 公有云容器化指南:騰訊云TKE實戰與應用
- MySQL高可用解決方案:從主從復制到InnoDB Cluster架構
- 計算機組成原理與接口技術:基于MIPS架構實驗教程(第2版)
- Oracle高性能自動化運維
- INSTANT Cytoscape Complex Network Analysis How-to
- 大數據營銷:如何讓營銷更具吸引力
- Python醫學數據分析入門
- 大數據架構和算法實現之路:電商系統的技術實戰
- 深入淺出 Hyperscan:高性能正則表達式算法原理與設計
- Spark分布式處理實戰
- 數據分析師養成寶典
- 從實踐中學習sqlmap數據庫注入測試
- Oracle 11g+ASP.NET數據庫系統開發案例教程
- 算法設計與分析
- Unity Game Development Blueprints