jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arihan <arihan.si...@gmail.com>
Subject parameter parsed to SHA1 in BSF processor ( javascript) of jmeter throws error
Date Tue, 08 Oct 2013 17:21:46 GMT
I've a scenario like

     user logs in ( /login)

     navigate to the reservations page to get all the reservation id
(/reservations)

      Through regular expression I retrieve all reservation ids like
reservationids_1=19678406 etc...

      navigate to the first reservation id
(/reservation/${reservationids_1})

In every page it navigates , the HTTP header manager needs the handShakeKey
applicable to that page which is basically combination of url, secretKey,
publicKey. ( secretKey , publicKey are both static but url changes )

For static urls like ( /login, /reservations) I've added a BSF pre-processor
at beginning and declare variables and use those variables in the HTTP
Header Manager as ${handshakeKey_reservations}, ${handshakeKey_login} etc
which  works perfectly fine.

      var urls = ["login", "reservations", "logout", "profile"];

      for (var i = 0; i < urls.length; i++) {

        var handShakeKeyForStaticUrls =
CryptoJS.SHA1("/"+urls[i]+"abcdediiebneC"+"12345678");

          handShakeKeyForStaticUrls =
handShakeKeyForStaticUrls.toString(CryptoJS.enc.Base64);

         vars.put("handshakeKey_"+urls[i], handShakeKeyForStaticUrls);
 
          }

Now the problem is for Dynamic url (/reservation/${reservationid},
/reservation/${reservationid}/summary etc.......)

As a work around I tried to put a BSF post processor before every dynamic
url HTTTP sampler 

    //reservationid = "19678406";

    reservationid = "${reservationids_1}";

    vars.put ("val", reservationid);

    vars.put ("type", typeof(reservationid));

     var handShakeKeyForDynamicUrls = CryptoJS.SHA1( "/reservation/" +
reservationid +"abcdeeee"+"12345678"); 

     handShakeKeyForDynamicUrls =
handShakeKeyForDynamicUrls.toString(CryptoJS.enc.Base64); 

     vars.put("handShakeKeyForDynamicUrls", handShakeKeyForDynamicUrls);

In the HTTP header manager I am using handshakeKey 
${handShakeKeyForDynamicUrls}

When I am using reservationid = "19678406" as hard coded in BSF sampler (
javascript); 
 
its working fine as example

     GET https://<servername>/reservation/19678406
     handshake key :- 21d1ce663d079b5583d76730f6f1477d8f6ae
     Also in the debug sampler type and val coming as string and 19678406
which is OK

However When I am using reservationid = "${reservationids_1}" in BSF sampler
( javascript) ; it fails

      GET https://<servername>/reservation/19678406
      handshake key :- b607876d69f5d59c5258bcd5a2a064bbcf35
     Also in the debug sampler type and val coming as string and 19678406 

So don't understand how both are different. Why its getting failed. Instead
of hard coded value if I pass an parameter ( having string type and value
same in both cases) why its getting failed.

Any thought on this ??

Note:- There is no error in the log viewer.




--
View this message in context: http://jmeter.512774.n5.nabble.com/parameter-parsed-to-SHA1-in-BSF-processor-javascript-of-jmeter-throws-error-tp5718381.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Mime
View raw message