Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform an Load Test/Performance Test with Vaadin 10 with JMeter

I work on a Vaadin 10 project and we want to perform a load test on our website. Before we used Vaadin 10, we could do that with Jmeter but with Vaadin 10 it seems that JMeter doesn't work.

We tried using JMeter 5.1.1 and recorded the test case. The first problem was the CSRF token and the push id. Both could get extracted with a regular expression extractor and we put them in the body data:

{"csrfToken":"${csrf}","rpc":  [{"type":"mSync","node":5,"feature":1,"property":"invalid","value":true}],"  syncId":0,"clientId":0}

As far as I can see, at least that worked, but the only result we get back is a HTML page with "You have to enable javascript in your browser to use this web site."

Does anyone know if there are better ways to perform a load test on a Vaadin 10 application or how to get it working with JMeter?

Most answers I found until now are for Vaadin 8 or 7, but none for Vaadin 10+.

like image 486
DavidB Avatar asked Dec 31 '22 23:12

DavidB


1 Answers

Yes, it is possible to use JMeter for load test Vaadin 10+ applications. You should be able to use following regex for extracting the csrf token:

Vaadin-Security-Key":"(.+?)"

A screenshot of my JMeter when testing against Vaadin 13 Bakery app starter:

enter image description here

In addition to JMeter, Gatling is also a good option when scalability testing Vaadin (any version) applications. There is a quite good example Gatling test script in Bakery App starter for Vaadin 13: https://vaadin.com/start/latest/full-stack-spring See the path: \src\test\scala\BaristaFlow.scala of the project.

Edit:

I uploaded a small but fully functioning JMeter test against V13 application (the same Bakery Flow starter) here: https://gist.github.com/johannest/593309e31e35789f8e5b03bed074f13c

The example script shows the csrf token extract, but also how to extract component ids (such as an id used for the "New" button) and client and sync ids. Extracting these ids and using them as variables in the following requests (instead of using recorded ids) makes your test more stable.

like image 160
Johannes Tuikkala Avatar answered Feb 06 '23 03:02

Johannes Tuikkala