Could someone help me to configure a test plan in JMeter in order to test a JSF application ? Actually, which parameters do I have to put in the request in order to execute a particular method of a JSF bean ? Indeed, it is no sufficient to call the page.jsf. How should I do ?
With JMeter you should not plan to test a single method.
JMeter is supposed to be used for functional testing or Loap&Performance testing. For that you only "simulate a normal user" and then repeat that simulation... The easiest way to do that is to use JMeter's transparent recording proxy (see JMeter doc). It is really easy to use and sets up single entries in the test-plan with all needed parameters.
testing a single method... sounds like unit-testing and therefor something in the JUnit-range. A managed bean that is completely free of container-calls (as it should be...) can be unit-tested as any other java-class. If you use container dependant calls (like access to the request-object or calls to EJB's,...) then the going gets tougher. as I have not yet entered that territory.... let's see if somebody else has some suggestions in that area...
I understand what you are saying, and I don't wanna test only one method.
On the contrary, I'd like to make a load test performance.
So, I have to enter an URL and to set up entries.
But I don't know how to set up entries so that it is the good action that is executed...
Do you understand what I mean ?
Could you give me some more info about the JMeter's transparent recording proxy, or just the tutorial URL ?
What is the goal of this tool ? Can I make a load test performance with it ?
If I make a unit test, I can't see what will happen if 100 users execute this method at a given time.
JMeter's proxy doc...
Let's go to the JMeter website (http://jakarta.apache.org/jmeter) then ... well, how about the user's guide (http://jakarta.apache.org/jmeter/usermanual/index.html) ... hm.... scroll down (or use find?) to find " 16.4 Using the Proxy Server to record test scripts" and follow the link (http://jakarta.apache.org/jmeter/usermanual/best-practices.html#proxy_server) there you find some introduction and a link (http://jakarta.apache.org/jmeter/usermanual/component_reference.html#HTTP_Proxy_Server) to some more doc about it.
When I first used it, the doc was not yet so detailed. IT IS easy, just try...
Good for dealing with JSF is the fact, that it will set up your request with all the POST-parameters.
I manage to test JSF 1.2 using JMeter but there is a trick, even if you are using the HTTP Proxy:
1) The first HTTP request get a page with a form.
2) The second request perform a JSF action on this form.
Make sure that you are sending the value of javax.faces.ViewState found in the from at the second request, otherwise the View restore may fail.
For this, create a XPath extractor. The XPath query is: //input/@value. Choose a reference name, ViewState per example.
In the second http request, send a javax.faces.ViewState parameter with the value ${ViewState}.
I spent a couple of ours finding this. I am not a JSF1.2 seasoned programmer but I hope it will help saving you time.
Hi,
Im also new in JMeter, but as I red the tutorial, there is mentioned, that some extra steps for URL rewrittening with SESSION_ID have to be done... As I remember, the sublink in the jmeter user guide was "Create Advanced web test" or something...
I manage to test JSF 1.2 using JMeter but there is a
trick, even if you are using the HTTP Proxy:
1) The first HTTP request get a page with a form.
2) The second request perform a JSF action on this
form.
Make sure that you are sending the value of javax.faces.ViewState found in the from at the
second request, otherwise the View restore may fail.
For this, create a XPath extractor. The XPath query
is: //input/@value.
Choose a reference name, ViewState per
example.
In the second http request, send a javax.faces.ViewState parameter with the value
${ViewState}.
I spent a couple of ours finding this. I am not a
JSF1.2 seasoned programmer but I hope it will help
saving you time.
Has anyone succesfully implemented this? Where will I put the XPath extractor? As a child of the 1st Http Request? Im not getting any value for ${ViewState}
The solution is explained with MyFaces in the wiki, see http://wiki.apache.org/myfaces/PerformanceTestingWithJMeter
There is a minor change with JSF SUN RI, the hidden field has a different name, use a RegEx extractor (easier than XPath) with <input type="hidden" name="com\.sun\.faces\.VIEW" id="com\.sun\.faces\.VIEW" value="(.+?)" /> for the reference jsfViewState.
Replace the value of the request parameter com.sun.faces.VIEW with ${jsfViewState} in all your requests you have recorded.
You can post figure examples about what you made to make it works.
Because I have problem when I Test a JSF application with jmeter . I look forward to.
Of course it is not for funtional testing, but if you have various jsf blocks at the same time in a page, JMeter only records the activity of the first one. I need to separete the activity of each block, with their own session variables in distinct JMeter http requests.