Modern client-side JavaScript frameworks, such as Angular, Ember, Ext JS, Knockout, React, and Vue all support single-page application (SPAs) foundations and rules. SPAs provide users with a more seamless user experience, like one would get from using a web app, however, SPA load testing can prove troublesome with open-source tools like JMeter. This article sets out to explain how open-source load testing solutions like JMeter handle testing SPAs and how LoadView is different and overcomes the limitations of JMeter.

What is a Single-Page Application?

A single-page application, or SPA, is a single URL web application or website that runs entirely in a web browser. When a user accesses a SPA application or site, all the elements, such as JavaScript, HTML, CSS, etc., are downloaded. Due to this functionality, SPAs do not require the browser to reload or refresh the page each time a user navigates to a new page, as has been traditionally done in multi-page applications (MPAs) today.  If new data is required, the page is updated dynamically with new data from the web server, without the user knowing the difference.

Considerations When Load Testing Single-Page Applications

SPAs are great for creating applications and sites that respond quickly, but when it comes time to carry out performance tests, there are a few things you should consider before choosing the right tool or solution for load testing your SPAs.

One of the first items to consider is that SPA logic relies heavily on JavaScript technology. Every time a user clicks a button or performs any other action on the web page (navigating between tabs, filling web forms, etc.), a browser executes JavaScript and renders the web page.

Additionally, the authentication in an SPA involves HTTP headers carrying access credentials, for example, 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.

What is JMeter?

JMeter is an open-source performance testing tool that was developed by the Apache Software Foundation. The primary objective of JMeter is to carry out performance testing, however, it can also be used for functional testing, such as unit testing. It was first made available in 1998 and comes with enterprise-grade load testing capabilities. JMeter functionalities can be easily extended because of its plugin-based architecture.

It is one of the more popular open-source tools used for analyzing the performance of your website or applications under heavy load. It is actively maintained and updated frequently to support new technologies, however, JMeter has a bit of a complex user interface due to the sheer amount of features it provides. This complexity makes it not as user-friendly as other tools in the market, as it required a bit of a learning curve to become proficient and experienced with the software.

JMeter Limitations

These SPA logic traits put limitations on SPA load testing with applications built using frameworks such as JMeter. JMeter is NOT a browser and works at the protocol level. This makes it difficult when trying to run performance tests from the user’s perspective. For example, JMeter does not support JavaScript, and therefore, cannot support AJAX requests, so in this case, JMeter can only simulate HTTP traffic.

JMeter allows emulating SPA web requests to the server without testing the 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 application, you need to authenticate the client’s calls for each session. Otherwise, page performance can’t be tested accurately (for more information on JMeter, check out our Ultimate Guide to JMeter Load Testing.

Why Use Open-source Load Testing Tools? 

When the time comes for SPA load testing, the first question that comes into your mind is what tools to use for load testingThis is one of the most important decisions you will need to make because choosing the right tool is the key to successful load testing and your website or application performance optimization. Every tool, whether the open-source or commercial variety, has its pros and cons, but you should always consider all the factors like accuracy, ease of use, ease of scripting, reliability, scalability, reporting, monitoring, and cost, etc. before choosing one. For example, JMeter does not have any built-in reporting features, so JMeter usermust manually create the report themselves by understanding the outputs of their load tests. 

Open-source load testing tools are often maintained by some of the great developers and are free to use with their source code available for customization as you require. You can use the open-source tool and extend its functionality for internal use. Some of the other popular open-source tools besides JMeter are Gatling, The Grinder, Locust, Tsung, and WebLOAD. The following lists detail some of the advantages and disadvantages of using open-source tools that you should investigate carefully before selecting any tool.

Advantages of using Open-source Load Testing Tools

  • No initial investment is needed as it is free to use.
  • Source code is available for extending the functionality based on internal use cases.
  • Managed by top developers and the open-source communities.

Disadvantages of using Open-source Load Testing Tools

  • You need to invest in hardware to run open-source tools on your servers.
  • Building and maintaining the load testing infrastructure would require extra workforce and IT cost.
  • Virtual users (load) are generated on your internal servers, which leads to non-realistic conditions and misleading results as your end users would be coming from different devices and geo-locations.
  • Many open-source load testing tools support only protocol-based load testing and not browser-based load testing, which is not ideal as modern websites/applications rely heavily on browser-based JavaScript execution.
  • Open-source load testing tools have limited support, which means if you face any challenge in implementation or maintenance, you are pretty much on your own.
  • Security is a significant concern with open-source load testing tools.
  • Getting open-source load testing infrastructure up and running takes time.
  • Open-source load testing tools can affect your project timeline due to challenges and management required.
  • CPU and memory issues may arise when you run large load tests.
  • Scaling is hard as your application and users grow.

LoadView: Best Load Testing Alternative to JMeter and Open-Source Tools

Load testing is a must to perform for analyzing the speed, stability, and scalability of your websites, applications, and APIs. There are both free and commercial load testing tools available in the market that you can choose based on your requirements. While open-source load testing tools require no initial investment, they come at the cost of building and managing your own infrastructure with limited features. Commercial load testing tools like LoadView offer rich functionality and features for accurate results and ease of use.

LoadView is a cloud-based load testing tool that eliminates the limitations of JMeter and other open-source load testing solutions. Let’s see how LoadView does it and what are the other features that make it stand out from other load testing tools.

  • User Interface. LoadView has a simple, intuitive, and utility-based user interface with no learning curve. You can quickly get started within minutes with your load testing.
  • No Programming Required. LoadView comes with a point-and-click feature called EveryStep Web Recorder, which you can use to capture complex user actions such as mouse clicks, keypresses, menu navigation, etc., and generate test scripts.
  • No Upfront Investment. Unlike JMeter and other open-source tools, where you need to set up your own testing infrastructure and maintain it, LoadView is a cloud-based and fully managed load testing tool, and you pay according to your testing requirements.
  • Real Browsers and Devices. LoadView supports 40+ browsers/devices to simulate real-world users for accurate load testing.
  • Geo-locations. With LoadView, you can generate load from over 20 geo-locations for creating the most realistic test scenarios as your users will come from different locations and experience different performance.
  • Reporting. LoadView generates detailed performance testing reports with useful insights so that you can immediately start optimizing your website/application for performance issues.

LoadView is perfect for SPA load testing websites and applications, as well as testing APIs, streaming services, and more. The platform can generate load according to your testing requirements without any limitations or previous programming skill or experience.

Load Testing Single-Page Applications with LoadView

On the other hand, LoadView works like a real browser and supports JavaScript execution and authentication logic at the browser level. All you need to do is to script user actions on the SPA page using the built-in EveryStep Web Recorder scripting tool and set up, configure, and run your load test. For a full run-down of how to set up and configure load tests with LoadView, please visit our Test Basics section for more articles on getting started with LoadView.

The test will be performed in a real browser (Chrome or Edge options are available) to simulate real user actions and behaviors which provide more realistic test results compared with other load testing tools.

For more information on web application and SPA load testing, read the Getting Started with Load Test Setup or Configuring Web Application Task Knowledge Base articles.

Common Use Cases for Single-Page Application Load Testing

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.

Depending on the authentication results, the page content is loaded. In general, all the data, including UI, are processed at the backend and delivered in HTML. Thus, to receive the data, GET requests should be sent to the page URL. However, when it comes to SPAs, there’s no data in the server response except JavaScript scripts. Find the page source on the picture below.

In comparison to the server response, let’s have a look at the page elements rendered by the browser. The browser renders the page content dynamically including the user data, headers, menu panel, and the user list grid. Since the UI elements are not included in the HTML, and only rendered by the browser, they can’t be tested without JavaScript execution.

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.

Conclusion: JMeter Limitations When Load Testing SPAs

In conclusion, if you want to test SPA performance, a real browser-based load testing solution, such as LoadView, can provide you with realistic, comprehensive load testing results. LoadView is a cloud-based load testing tool that gets you started with load testing your website or application quickly. It uses real browsers and devices to generate user load from multiple geo-locations, giving you the most realistic conditions for accuracy of results. Included is the EveryStep Web Recorder that lets you create test scripts with point-and-click features.

Even if you don’t have any programming experience, LoadView is extremely easy to use. LoadView also allows you to adjust your loads in real-time for exploratory testing for capacity planning and scalability identifications. LoadView generates advanced reports that contain deep insights about the performance in a sorted manner so you can easily understand and identify bottlenecks to eliminate them quickly.

On the other hand, JMeter lacks reporting capabilities, which are crucial to identify performance bottlenecks and optimize for them. Without in-built reporting, you would waste lots of time making reports and figuring out problems rather than solving the performance issues. JMeter user interface is also not very good, making it hard to work with.

Already have JMeter tests, but want to integrate them into the LoadView platform? Read how to convert web application tests from JMeter into LoadView in just a few simple steps.

New to LoadView? Try the Free Trial today and receive $20 in load testing credits!