Sunday, April 15

RPT : Extracting value based on the occurrence that is passed dynamically

Rational Performance tester does correlation by extracting dynamic values in response by creating a reference. But it lacks ability for an user to specify if the occurrence dynamically that needs to extracted .
For ex: Say in an application, after user logins , he views displayed list of cards. He picks first card which is default and picks any other card alternatively sometimes. You got a task cut out to create a script which picks 60 percent default card and other 40 percent of time any of the alternate cards. You cannot select 'Random Occurrence ' option because it defeats purpose of simulating default card 60 % of time or vice verse.

So to overcome the limitation in RPT, one has to find a way to pass the occurrence you want to pick and pick the card by that occurrence value(not just random occurrence). Here in this blog I would focus on extracting that  value based on dynamic occurrence which is passed to a custom code interface . For this below are steps that need to be done

What does RPT Lacks for a Loadrunner User


    I have been a HP Loadrunner user most of the time for Performance/Load Test.  Off late, I ventured into task  to use IBM Rational Performance tester (RPT). I did had very pleasant surprises from this tool . Below are few of those to mention
  1. Automatic correlation feature got me quite amazed when it worked flawless all the time. RPT Uses Perl type of regular expression patterns to extract data from respone.  I was impressed with perl regular expression back in time when I first used Jmeter and still find they give robust way of defining pattern. RPT does all related to automatic extraction expression pattern, instance number etc. Thus makes life easy when creating a new script.
  2. Not just records thinktime, also records client processing delays . Hence represents right way of simulating secondary requests

  3. But I find that many features ,which are very common to Loadrunner or any scripting tool, are missing here in RPT. RPT does make maintaining scripts bit harder without simple scripting interface . Below are the few of those missing features that made RPT annoying to me at times.

Rational Performance tester(RPT) custom code to log user value fom datapool


Below is the custom code in Rational Performance tester that I managed for logging username value from datapool into test log. In Loadrunner, very often one uses commands like lr_message,lr_log_message to log username that was used by a particular virtual user in particular iteration. This helps performance tester to check whether the data was used was appropriate one, of if error occured, then what was the data used by the users etc. This this can be achieved in RPT by writing custom java code.
Custom  Code class implements interface ICustomCode which has method called exec with method parameters of object type ITestExecutionServices and type String array
The trick is understand the classes/method/interfaces of this Interface ITestExecutionServices. This object has information about a virtual user in interface name IDataArea . Below is the syntax to retrieve this Virtual user dataarea.

---------------------------------------------

Related Posts Plugin for WordPress, Blogger...