How to perform an Load Test/Performance Test with Vaadin 10 with JMeter - 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+.

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:
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.

I postet this question a time ago since some people have intresst in this Question i will post some informations how we dealed with the situation.
our application didnt want to work with J-Meter it should be possible with jmeter but i did not manage to get it to an working state
we used neoLoad(the trail version was sufficient for our use case) and neoload was easy to use for Vaadin 10
but i cant give detailed informations how to use neoLoad with vaadin 10 but maybe someone can use this information to shorten the research time

Related

Can JMeter do automation testing like Selenium can do?

i am still new to JMeter and i was assigned to a work that I will need to use JMeter to perform automation testing. The idea is to write script using JMeter and run the script to fill in the forms in the website. I was curious that can JMeter use different data from the database to fill in the form of the website everytime it execute?(unique data for every user)
I have followed this tutorial (https://www.blazemeter.com/blog/fill-forms-and-submit-with-jmeter-made-easy/ ) and it succeed, however, when i try to change the parameter name (to some other names that do not matches the field name found in the inpect mode), it still works. So i was wondering how JMeter knows where to put in the parameter even i have change to a wrong field name?
As per JMeter Project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
Browsers don't do any magic, they execute HTTP Requests, wait for response and render it. JMeter in its turn can execute the same HTTP requests so traffic would be the same, however it will not render the response, but rather measure the time and collect some more metrics.
If you change the names of the inputs in the form most probably the request will be successful, to wit you will get HTTP Status Code below 400 hence JMeter will mark the result as "green", however if you inspect the response using View Results Tree listener you will see that the form is not filled and/or you still at the same page.
If you want to use JMeter for checking the data returned by the application you're testing consider using JMeter Assertions to test presence of expected values, absence of errors, set response time thresholds, etc.
You can automate the form submission or order placement usin JMeter. You can JMeter for API testing as well by adding assertions. But the main purpose of the JMeter is to test the performance of the application. Its not like selenium which performs actions on the browser whereas JMeter sends the request in various protocols to relevant server and can also simulate many users at the same time.
If you want to do extensive automation testing,JMeter isnt the ideal tool for that.
You can use webdriver sampler to run the selenium with jmeter. It requires to configure sampler and browser config which are plugin and can be downloaded using plugin manager.
For more info:-https://www.blazemeter.com/blog/jmeter-webdriver-sampler/
Now, without the plugin it is working on protocol level and not on the frontend as pointed out in the above comments.
So, yes it can depend on which layer you want to work. It can work on frontend like selenium using the webdriver plugin and can submit the form with different data as a direct request to the server without using the frontend/GUI.
Hope this helps.
It depends on what you are trying to automate. If you plan to automate API invocation where there are some pre-requisites like grabbing tokens, cookies, session IDs from the browser, then JMeter can probably be used where existing JMeter capabilities can be leveraged using BeanShell scripting and other plugins.
But if you plan to have a full blown UI automation framework then JMeter might not be an ideal choice.

How to use jmeter using ant task - load testing on Dot Net application

I have just tried jmeter examples using ant task. I got the HTML output. Now,
I built my application using c#.net,asp.net,javascript,jQuery,Ajax,Json etc.
This is the url http://localhost/test/pagemanager.aspx which shows my
LOGIN Screen. Once after login, the user can access over multiple menus(pages) to access like checking their personal data, overall student details like batch wise, registering a new student etc... My URL http://localhost/test/pagemanager.aspxremains constant at every time.
The site can be accessed by multiple users for multiple times. I needs to find a load testing. Can some one give me a configuration step to find load testng to my application.
Thanks in advance.
First of all I would recommend recording your test scenario steps starting from login via JMeter build-in HTTP(S) Test Script Recorder.
See JMeter Proxy Step by Step guide for detailed instructions.
Once you have recorded test flow you'll need to do some correlation as the nature of ASP.NET applications assumes mandatory dynamic parameters like VIEWSTATE. So you'll need to extract VIEWSTATE and similar from previous server response and add it to next request.
See ASP.NET Login Testing with JMeter for more details.

Testing a Vaadin Website with JMeter

I need to test a Vaadin website with JMeter but I can't get it to work. I have tried recording my actions with a proxy and that went well, but when i try to run the test again it gives me an error: out of sync. I have disabled the xsrf.
Has this something todo with the fact Vaadin can't run in two tabs at the same time? I am using vaadin 6 and i can't easily upgrade.
Thanks in advance Stefan
the error response i get is:
for(;;);[{"changes":[], "meta" : {"appError": {"caption":"Out of sync","message" : "Something has caused us to be out of sync with the server.Take note of any unsaved data, and click here</u> to re-sync.","url" : null}}, "resources": {}, "locales":[]}]
Solution:
- Disable xrsf because when you record and then start a new thread the request is sends the wrong security key. Enable it when going live ofcourse!
- Make sure ever component is unique and consitent. The problem in my application was that the id's of the components were changing every request. So the request when recording is only validate while recording. When i replayed it, it asks for the wrong id. By making it unique and consitent this problem dissapears!
Good luck and have fun ;)
Read this:
https://vaadin.com/wiki/-/wiki/Main/JMeter%20Testing
Issue might be in disabling XSRF.
However, scripting Vaadin application is not easy as there are a lot of technical ids to correlate to create a successful simulation.
Either you do correlation manually which will require some work or you can use this commercial plugin for JMeter.
Note that disabling XSRF is only a part of the problem and will not solve all issues. And disabling it will not make application ISO-PROD.
Disclaimer : We are providers of this solution
in case you cannot disable XSRF protection, automatic correlations feature of SmartMeter (based on JMeter) is the solution. While recording the test, it will automatically parse XSRF tokens from responses and use them in subsequent requests. Here is a detailed guide.

jmeter regarding performance and load testing

Let me describe the issue which i have been facing.
i want to do performance and load testing on our internal website. which has login and other functionalities.
the issue i am facing that when i hit 12 or any number of request using http sampler then i am getting same response from all the 12 request. But actual scenario is that webpage displays different data for different page.
I checked using firebug and everything is working fine over there using correct response from request but when i use jmeter i am using same response from every request.
Please let me know if anybody had faced same kind of issue of is there anything i am doing wrong in configuring script.
Try to add HTTP Cookie Manager to your test-plan to the root (Test Plan) node or to the Thread Group node.
As per jmeter documentation:
The last element is a HTTP Cookie Manager. A Cookie Manager should be
added to all web tests - otherwise JMeter will ignore cookies. By
adding it at the Thread Group level, we ensure that all HTTP requests
will share the same cookies.
Ensure that parameters values that are dynamic are not hard-coded (after recording jmeter scripts, for example): no hard-coded JSessionID values in your HTTP requests, e.g..
Ensure you don't miss any necessary params in your HTTP requests.
JMeter does not process Javascript or applets embedded in HTML pages.
Your problem may be caused by this feature.
As per jmeter documentation:
JMeter does not process Javascript or applets embedded in HTML pages.
JMeter can download the relevant resources (some embedded resources
are downloaded automatically if the correct options are set), but it
does not process the HTML and execute any Javascript functions.
If the page uses Javascript to build up a URL or submit a form, you
can use the Proxy Recording facility to create the necessary sampler.
If this is not possible, then manual inspection of the code may be
needed to determine what the Javascript is doing.
I would also recommend your to look first into Jmeter reference before further scripting activities - this may prevent from some faults and frustration.
At least these:
Building a Test Plan
Elements of a Test Plan
Building a Web Test Plan
Building an Advanced Web Test Plan
Hope this helps.
I would suggest - Use Jmeter's Regular Expressions. You may be able to resolve this issue with RegEx. Post using regex, use 'View Results Tree' listener to check if you are getting apt response for each of your threads.
You can also analyze your results using Blazemeter's listener that gives you more insights into your test.

How to debug RESTful services? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm looking for an easy way to debug RESTful services. For example, most webapps can be debugged using your average web browser. Unfortunately that same browser won't allow me to test HTTP PUT, DELETE, and to a certain degree even HTTP POST.
I am not looking to automate tests. I'd like to run new services through a quick sanity check, ideally without having to writing my own client.
Use an existing 'REST client' tool that makes it easy to inspect the requests and responses, like RESTClient.
At my firm we use a variety of different tools and approaches to testing RESTful services:
We write cURL scripts - essentially a single command saved in a file. One file per resource per method. For PUT and POST, we'll usually have files containing the representations to send alongside the cURL script. For example, for a mailbox resource, we might have a file named mailbox_post.cmd, which might contain the line curl -v -X POST -u username -H 'Content-Type:application/xml' -d #mailbox_post.xml http://service/mailbox. We like this approach because we end up building a collection of tests which can be run in a batch, or at least passed around between testers, and used for regression testing.
We use cURL and RESTClient for ad-hoc tests
We have the service serve XHTML by default, so it's browsable, and add forms resources, so the service is actually partially or fully testable using a browser. This was partly inspired by some parts of RESTful Web Services, wherein the authors show that the line between web services and web applications may not need to be as solid and strict as is usually assumed.
We write functional tests as Groovy closures, using the Restlet framework, and run the tests with a test runner Groovy script. This is useful because the tests can be stateful, build on each other, and share variables, when appropriate. We find Restlet's API to be simple and intuitive, and so easy to write quick HTTP requests and test the responses, and it's even easier when used in Groovy. (I hope to share this technique, including the test runner script, on our blog soon.)
Postman, a Google Chrome extension, may be helpful.
Edit years later: Also the website of the url in case Chrome extension link gets changed: www.postman.com
I've found RequestBin useful for debugging REST requests. Post to a unique URL and request data are updated/displayed. Can help in a pinch when other tools are not available.
https://requestbin.com/
A tool I've found useful if you're running OS X Leopard:
HTTP Client
It's a very simple GUI program that allows you to craft http requests to a resource and view the response.
cURL works just fine.
You can use fiddler's Composer to debug restful services..
Updated JD 12 sep 2013: Rest Builder is now called Composer.
I ended up settling on POSTMAN
It supports all REST features I could think of, and the UI is absolutely excellent. The only downside is that it requires Chrome.
RESTTest for Firefox (an add-on). Fiddler for IE.
I'm using Soap UI to test my REST API.
It is more complete than any other tools:
fine debug requests and responses
automated testing
all GUI based
properties and properties transfer to parameterize your tests
conditional testing
performance testing
I'm not working for SmartBear.
I was already a big fan of SoapUI while using it for SOAP WebServices.
Aside from using one of the tools in Peter Hilton's response, I would have to say that scripting the tests with LWP or some similar tool may be your only option. You could bypass the use of LWP by just opening a socket, sending a raw HTTP request in and examining what you get in return. But as far as I know, there are a dearth of testing tools for this sort of domain-- most look at this problem-space primarily from the lens of a web-site developer, and for them the browser is enough of a testing platform.
I use restclient, available from Google Code. It's a simple Java Swing application which supports all HTTP methods, and allows you full control over the HTTP headers, conneg, etc.
If you want free tool for the same purpose with additional feature of multipart form data submission it is here http://code.google.com/a/eclipselabs.org/p/restclient-tool/
Firefox's has RESTClient plug-in to send different request with methods, parameters, headers etc.
You guys should check poster extension for firefox, it's simple and useful enough to use :)
I tend to write unit tests for RESTful resources using Jersey which comes with a nice REST client. The nice thing is if you implement your RESTful resources using JAX-RS then the Jersey client can reuse the entity providers such as for JAXB/XML/JSON/Atom and so forth - so you can reuse the same objects on the server side as you use on the client side unit test.
For example here is a unit test case from the Apache Camel project which looks up XML payloads from a RESTful resource (using the JAXB object Endpoints). The resource(uri) method is defined in this base class which just uses the Jersey client API.
e.g.
clientConfig = new DefaultClientConfig();
client = Client.create(clientConfig);
resource = client.resource("http://localhost:8080");
// lets get the XML as a String
String text = resource("foo").accept("application/xml").get(String.class);
because its totally missing here:
https://luckymarmot.com/paw
Is worth ever penny...

Resources