I am trying to emphasize a fairly simple JSF web application using authentication, jMeter never calls the action method (in a managed bean) associated with the button clicked. Authentication with multiple users (downloaded from a CSV file) works fine (or, as I assume). I have reduced the testing plan to a minimum to try to debug this situation. I have a login and a simple page with commandLink, whose action is a method in ManagedBean (with requestScope).
The value of my extractor is xpath: // input [@ id = 'javax.faces.ViewState'] / @ value
I also tried using the regex extractor using the id = \ "javax.faces.ViewState \" value = \ "(. +?) Expression \ It seems to work fine with any of them (I used to have some problems related with viewState.
In a POST request (which contains javax.faces.ViewState), I have the value $ {jsfViewState} as the value (jsfViewState is a user-defined variable containing viewState saved from the previous GET method).
Link command page (note that I hard-coded this value to make it easier to identify the problem):
<h:body> <ui:composition template="/template/template.xhtml"> <ui:define name="content"> <c:set value="Category" target="#{menu}" property="title"/> <ui:repeat value="#{category.list}" var="cat"> <h:form id="categoryForm"> <h:commandLink id="btnOrd" action="#{product.placeOrder(1)}">COMPRAR</h:commandLink> </h:form> <br/> </ui:repeat> </ui:define> </ui:composition> </h:body>
Managed Interface:
@Named("product") @RequestScoped public class ProductMBean { @Inject private ProductEBean productEBean; @Inject private UserProductEBean userProductEBean; public List<Product> getList(){ return productEBean.findAll(); } private void addMessage(FacesMessage message){ FacesContext.getCurrentInstance().addMessage(null, message); } public String placeOrder(long id){ userProductEBean.createNewOrder(id); Product product = productEBean.findById(id); addMessage(new FacesMessage(FacesMessage.SEVERITY_INFO, "Your order of " + product.getName() + "has been processed. Thank you for using our service.", null)); return "success"; }
A new order is not created (although it works fine if I do it manually). The various commandLink commands (for navigating pages using function parameters, for example) work, and jMeter navigates the pages.
The parameters passed to the POST request other than ViewState are as follows:
**Name** **Value** j_idt${nb.rampup}6:0:categoryForm j_idt${nb.rampup}6:0:categoryForm j_idt${nb.rampup}6:0:categoryForm:btnOrd j_idt${nb.rampup}6:0:categoryForm:btnOrd
And on jMeter:
The request POST http://localhost:8080/easuy-war/easuy/categories/list.xhtml POST data: j_idt26%3A0%3AcategoryForm=j_idt26%3A0%3AcategoryForm&javax.faces.ViewState=&j_idt26%3A0%3AcategoryForm%3AbtnOrd=j_idt26%3A0%3AcategoryForm%3AbtnOrd Cookie Data: $Version=0; JSESSIONID=f24cb939085c6bc761efdc76f67b; $Path=/easuy-war
Relevant browser information:
<form id="j_idt13" name="j_idt13" method="post" action="/easuy-war/easuy/categories/list.xhtml" enctype="application/x-www-form-urlencoded"> <input type="hidden" name="j_idt13" value="j_idt13" /> <input type="hidden" name="javax.faces.ViewState" id="j_id1:javax.faces.ViewState:0" value="-9105321245957774265:-3870715546023364251" autocomplete="off" /> </form>
Thanks in advance.