1
votes

For my JMeter test, I would like to login once and then navigate the reports in my application concurrently with multi-threads. I created two thread groups that run consecutively, the first thread group contains the login HTTP requests that is set to run with one thread. The second thread group contains the HTTP requests for each report in my application, and it is set to run with 50 threads.

The application is deployed on a weblogic server, and the application sessions are stateful.

I want to share the JsessionID generated by the first thread group through weblogic after a successful login, with the second thread group HTTP Requests.

the problem is that the JsessionID for each of the HTTP requests in the second thread group are unique and all different than the JsessionID of the login HTTP requests in the first thread group. As a result, the application is failing to call the authenticate the call.

The JsessionID is embedded in the cookies inside the header. I tried extracting it from the HTTP request in the first thread Group using Regular Expression Extractor(see the attached picture) and define it in HTTP Cookie Manager, but the problem persisted. Regular Expression Extractor config

2
Can't you unite requests in same thread group?user7294900
@user7294900 But then how can I restrict the login to only one thread and the rest to multi-threads.Ali Mahdi

2 Answers

2
votes
  1. There is an easier way to fetch JSESSIONID cookie value using HTTP Cookie Manager

    • add the next line to user.properties file

      CookieManager.save.cookies=true
      
    • restart JMeter to pick the property up
    • once done you will be able to access the cookie value as ${COOKIE_JSESSIONID} where required
  2. In order to make it available in 2nd thread group you need to convert it into a JMeter Property using __setProperty() function like:

    ${__setProperty(JSESSIONID,${COOKIE_JSESSIONID},)}
    

    and once done you will be able to access the value in 2nd thread group using __P() function as ${__P(JSESSIONID,)}

0
votes

For Reference. IT WORKS:

I found a different way to complete my test and successfully suppress the cookies generated in the second thread group by the ones generated in the first thread group in order to bypass login authentication.

I wrote a small bsh in the first thread group that extracts the cookie and store it in different variables. Extract cookies from the first thread group

I then wrote another bsh in the second thread group to suppress the cookies by applying the generated variables

Applying cookies in the second thread group

Now I can log in once and navigate the reports with multi-threads all sharing the same SessionID.