A single-page application (SPA) is a single URL web application run entirely in a web browser. Here are a few things you should consider before choosing the right application for SPA load testing.
Secondly, the authentication in an SPA involves HTTP headers carrying access credentials (e.g., JSON web tokens). Access tokens are provided by an SPA server for each session. When a browser executes HTTP calls, it extracts the token from the SPA server response and passes it back with each HTTP request.
These SPA logic traits put limitations on SPA testing with applications such as JMeter. JMeter is NOT a browser and works at the protocol level. JMeter allows emulating SPA web requests to the server without testing application itself. However, creating any requests to operate with user data on the page requires corresponding knowledge in web development. For example, to log into a SPA, you need to authenticate client’s calls per each session. Otherwise, page performance can’t be tested accurately.
The test will be performed in a real browser (Chrome or Internet Explorer options are available) to simulate real user experience and provide realistic test results.
Common Use Cases
In order to show the nature of SPA testing, let’s consider a test scenario that repeats the process of changing user data on the Users page of the Dotcom-Monitor Account Settings menu. The page is a typical example of a SPA.
Since the Users page is authenticated, we need to log into the application before testing the page. Login testing may be tricky without a browser because of the SPA authentication traits described before.
For example, the Edit User dialog handler is already included in the initial server response and no calls are executed additionally. Checking if the pop up dialog is rendered correctly requires a related script execution and can’t be accomplished by HTTP requests.
Find the example of requests that are sent to the server upon editing user data.
In conclusion, if you want to test SPA performance, a real browser-based load testing solution, such as LoadView, can provide you with comprehensive load testing results.