Gatling and javascript

Hi guys,

as stated at gatling documentation:

Gatling is not a browser: it won’t run Javascript

and it looks like it also a “limitation” of other performance tools too.

In case of an JSF application its a big limitation because although I can make ajax calls, it never hits the server side because in ajax call JSF uses javascript[1] to cummunicate to the server.

There is no possibility to add js execution support? for example jvm comes with nashorn, a js engine, gatling couldn’t use it to evaluate js or its not possible?

In fact with the rise of js frameworks it could be a big advantage for Gatling.

What do you think?

[1]http://java.dzone.com/articles/ajax-jsf-joined

You wouldn’t only need a js engine, but also a DOM that could be updated by the js, plus a CSS engine that would match your css rules against your dynamic DOM so it can find out if it has to download some other resources such as images, fonts… In one word: a browser.

Up until now, every tentative I’m aware of to do load testing with browsers, even headless, were failures: too CPU and memory expensive, even when massively scaling out with a cloud host solution.

Regarding the rise of js frameworks, the trend is to have some js client calling some REST APIs, ie plain easily testable JSON payloads and logicless server APIs. What you want to load test is the server APIs, and Gatling does a good job for this.

Ok, now i’m a bit confused here because I made an ajax call work.

I had a JSF call which woked fine until I make it ajax so I went to gatling docs and read the javascript limitation thing.

The fact is that I had forgot a header on the ajax call:

"X-Requested-With" -> "XMLHttpRequest"

and now it works…so did Gatling execute jsf.js to communicate with the server?

if yes then the docs are misleading

No, there’s no way Gatling would execute js.
The only requests Gatling can infer are GETs for static resources.

I see and now I understand what happened…in fact gatling did not executed jsf.js. Gatling just sent the http request and my application hadled everything.

sorry for my confusion, the way I was thinking we would not be able to use Gatling with any js based framework which is not true hehe

The hard part is that, depending on how it makes sense to test your application, you might have to reimplement your js logic into Gatling.