Today, we are thrilled to announce that we have added a JavaScript and TypeScript SDK for Gatling load tests. The new JavaScript SDK is the first enterprise-grade load-testing tool on the npm registry, doubling the number of developers who can use Gatling in their own programming language.
Join us, and deliver the most performant applications, APIs, and websites to your users!
Since its introduction, Gatling has been a Java Virtual Machine (JVM)- based developer tool focused on load testing. Now, developers can write load tests with the Gatling JavaScript SDK and compile the tests to run on a JVM. This combines the power of a scripting language with necessary performance features like multithreading.
The great thing, is you no longer have to be a Java developer to use Gatling. From setting up your project with an npm install
command to familiar syntax, JavaScript developers will feel at home working with the SDK but know they have the power of the Gatling Engine to run their load tests.
Read on to learn more about how and why we developed a JavaScript SDK, but more importantly, how to try it out.
There is no denying the amazing evolution of the JavaScript ecosystem. In the early days, it was a front-end scripting language. With the addition of NodeJS and TypeScript, it is now a full-stack, type-safe language for developers building modern web applications and APIs. By at least 1 estimate, JavaScript is part of the tech stack for 98% of Fortune 500 companies.
The history of Java and JavaScript is linked from the very beginning. Both languages were developed in Silicon Valley and released in 1995. JavaScript was initially named Mocha, but Netscape renamed it as a marketing initiative to exploit Java’s growing popularity.
Over the years, the two languages have been largely complementary, with Java as a server-side powerhouse and JavaScript powering browser-based websites and applications. From the beginning, developers at Netscape realized the potential of running JavaScript server-side.
In 1997, Netscape began working on Rhino, a JavaScript engine capable of running on a JVM. Rhino had both a compiled and interpreted version but still suffered from performance issues. Oracle later developed Nashorn to replace Rhino. Oracle included Nashorn in Java 8 but deprecated it with Java 11 because the JavaScript ecosystem was evolving too quickly to maintain support for the implementation.
Shortly after deprecating Nashorn, Oracle released the first version of GraalVM. GraalVM is a Java Development Kit (JDK) that is available in both community and enterprise versions. GraalVM is an alternative to the popular OpenJDK and includes the following functionalities:
GraalVM promises true interoperability between JavaScript and Java developers with its runtime for JavaScript and NodeJS. The release of GraalVM also motivated Gatling’s developers to start working on our own JavaScript SDK.
The goal of the SDK is to allow Gatling users to write load-testing simulations entirely in JavaScript or TypeScript. Users can also include their favorite libraries from npm while leveraging Gatling’s robust and well-tested code base.
To achieve this, we run on GraalVM, a polyglot virtual machine (capable of running code written in several different programming languages inside the same environment). The JavaScript support comes from the GraalJS project.
When you script a simulation in JavaScript, all your calls to the SDK get translated into calls to the Gatling Java SDK. The simulation can then run on the same Gatling engine as simulations written in Java, Kotlin, or Scala.
The only prerequisite for using JavaScript or TypeScript is NodeJS (with npm installed). When you run your first load test, the Gatling-js CLI downloads GraalVM and some Java libraries to enable the Gatling engine.
The JavaScript SDK also supports the Gatling Recorder, an application that lets you capture browser-based user actions and convert them into a load-testing script. If you are new to crafting load tests, the Recorder is another great tool for learning scripting for more complex scenarios.
Our first releases of the Gatling JavaScript SDK cover nearly all the HTTP protocol functionality that is available in the Java SDK. It is available to all Gatling users as part of our open-core commitment and Apache 2.0 license.
Additionally, Gatling Enterprise users can now upload JavaScript and TypeScript-based tests to Gatling Enterprise. Gatling Enterprise allows you to orchestrate, scale, and distribute your JS and TS load tests and truly understand your application’s performance.
Enterprise support for TypeScript and JavaScript includes:
The team is actively working to expand JavaScript developers' capabilities, including support for private load generator locations.
The following resources will help you get started with the Gatling JavaScript SDK:
In addition to the preceding resources, JavaScript-specific code examples are provided throughout the Documentation. Alerts have also been added to specific features that are not yet available for JavaScript and TypeScript.
This is an early release, so now is the best time to tell us what works well and what could be improved. Tell us what you think in the Gatling Community, and if you find a bug, open a GitHub Issue. You can view and comment on our public product roadmap if you want to help shape how we expand the Gatling JavaScript SDK.