简体   繁体   中英

jmeter with post data using ajax or javascript

I have recorded script in jmeter for login into system. However, there is a security question page is displayed once user login with correct credential. When user click on login button, system post the data but on second page when user answer and click on button, system post data using ajax/js script and this is not recorded in jmeter. As per my understanding, js is not supported in jmeter. Now the question is how should I record second page to post security question using ajax/jmeter? Is there any solution for this?

I would appreciate your inputs.

Thanks,

JMeter, when testing web services, basically does not matter whether you are using java, javascript or ajax at client side. JMeter will record HTTP requests including request headers and responses from clients and during testing it will simulate the same requests for the specified number of users(threads). You can easily reproduce the web services if you know all the details of the web-request(host, method(get/post), request parameters, request headers, etc.). If you don't know the details or facing problems then you can use Developer tools>Network (press f12 in Chrome) to get the details of web requests. In your case, you closely observe the web request in ajax call using developer tools and provide the details in JMeter.

If you want to pass login credentials, you can make use of user defined variables in jmeter. You can set values in variables and make use it in requests as ${variable_name}

If you need to do some computations,you can use beanshell components or BSF samplers .

If you want extract value(to a variable) from the response data sent from the server and reuse them, then use regular expression extractor .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM