Jmeter Log On in SAP CRM web client Error

359 views Asked by At

I used Jmeter's HTTP(S) Test Script Recorder to record the Log in in SAP CRM Web client. I configured HTTP Cookie Manager using the cookies that I saw in browser developer tools ( MYSAPSSO2, Session ID, Sap-usercontext).

Cookie manager image

In the same recording test I filled some fields in SAP. I stopped the recording test.

I did it multiple times to see what parameters were dynamic and I realized that wfc-secure-id and C5_confighash and c7_confighash were dynamic. So I used regular expression to extract the dynamic values and I applied it in the requests where I filled the fields.

In View Results Tree I can see the HTML response in the Requests' response bodies that the log in was successful and the fields were filled. I also checked the SAP sessions metrics that the users are logging in.

After the successful login I went and did some recordings of a User roaming around inside the web client performing some operations and saving the results. I changed the dynamic values to fit the previously values I obtained in the login process.

The issue lies in the fact than when I went back to JMeter to do a test run, I get a logon error on the response header between the login and the new recordings. The response body of the new recordings also return empty.

I'm thinking that between the recordings, jmeter is losing the user session information

response body image

View results tree image

How can I connect the new records with the log in record?

1

There are 1 answers

0
Dmitri T On BEST ANSWER

You should not be hard-coding cookies in the HTTP Cookie Manager.

JMeter doesn't record cookies

headers.removeHeaderNamed(HTTPConstants.HEADER_COOKIE);// Always remove cookies

hence you should not be manually adding the cookies you see in browser to the HTTP Cookie Manager, adding an empty HTTP Cookie Manager should be enough to let JMeter automatically take care of incoming cookies.

If you don't see the cookies being added to the request(s) it usually means that:

  1. Your HTTP Request sampler is not configured properly, i.e. "Server Name or IP" field is empty
  2. Your server is not configured properly (i.e. it returns cookies which doesn't comply with the standard hence JMeter fails to add them)

The steps you could take are:

  1. Enable debug logging for the HTTP Cookie Manager by adding the next line to log4j2.xml file:

    <Logger name="org.apache.jmeter.protocol.http.control" level="debug" />
    
  2. Use less-restrictive cookie policy, i.e. netscape

    enter image description here

  3. Add the next line to user.properties file:

    CookieManager.check.cookies=false
    

Check out HTTP Cookie Manager Advanced Usage - A Guide for more information on JMeter's HTTP Cookie Manager usage/troubleshooting