Saturday, November 30, 2013

Javascript processing in Performance testing

Thanks to a tweet from Stuart, a guru on performance testing, I checked out the blog by HP loadrunner that shows how to do authentication with client side javascript evalution. One key point in the blog is an interesting Loadrunner function called "web_js_run". This function can be used to evaluate a javascript code snippet. In this blog, we are going to show that our NetGend platform also supports javascript evaluation, only easier.

To paraphrase the test scenario (with a slight change) , a client needs to do the following 3 steps

sends a request to an authentication server to get the challenge string, the server response is in the format of JSON

Extracts the last element (the real challenge string) from the JSON string and concatenates it with a local passcode and do the encryption.

sends the encrypted string to the server to get a token (assume authentication is successful).

Part of input are two javascript files, crypto.js and calcPassword.js that are used by a browser to do the job.

/////file crypto.js
function encrypt(data) {
return data.toString().split("").reverse().join("");
}
//simplified encryption to illustrate the point of evaluating javascript on client side