Systems & Software Talk 

LoadRunner (tm) & RTE 4 Func/Regr

04:31, 2009-May-22  ..  Posted in LoadRunner Tips and Tricks  ..  0 comments  ..  Link

The question is seldom asked, "Can LoadRunner's (LR) RTE protocol be used to automate functional/regression testing?"

The less-than-seldom answer = Yes.

 

LR is a tm de HP.



LoadRunner (tm) Random Think time Function

01:23, 2009-Apr-24  ..  Posted in LoadRunner Tips and Tricks  ..  0 comments  ..  Link

LoadRunner is a product of Hewlett-Packard Development Company, L.P.

-- this corrects a bug I allowed into "production" in the previous version --

 

Here is a simple lightweight function and example for those who wish to have more precise control over each instance of think time as opposed to runtime settings gadgetry - or simply get a random number.


/*----------------------------------------------------------------------------------------------*/
/*---- BEGIN Function fRandInteger --------------------------------------------------------*/

/* Send 2 arguments - minimum and maximum.
   Output to caller is a random integer anywhere in the specified range, inclusive.*/
int fRandInteger(minInt, maxInt)
{
 int rndInt, offset;

if (maxInt == 0) 
                        return maxInt; // Caller must handle a 0 in order to prevent error.

 

offset = minInt;
rndInt =   ((minInt) + rand() % (maxInt - offset + 1));

/* Examples:
 1. lr_think_time(fRandInteger(3, 12));
 2. rndVal = fRandInteger(1, 9);
 3. rndVal = fRandInteger(1,
CALLED_UFC_FIGHTER_A_WUSS_IN_PERSON); */
return rndInt;

}

/*---- END Function fRandInteger ------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------*/

vuser_init()

{

… your code

lr_think_time(fRandInteger(3, 12));

… more of your code

 

          return 0;

}

 

 

I have found that it helps to use some pre-processor constants for well-known user types or classes and recommended think times – using this function to generate random think times. This serves the notion of a self-documenting concept. Additionally, some users or classes of users simply require more time to interactively execute a business process. Here are some example pound-defines with example code:

 

/* Constants as seconds */

#define AWAITING_PERSONAL_ECONOMIC_BAILOUT_FROM_US_CONGRESS   

#define AGILE_METHODOLOGY_PROVES_ITS_ORIG_INTENT   (- 10)

#define FAILED_TO_BREAK_UP_ONE_TOO_MANY_MICHAEL_VICK_DOGFIGHTS    340000

#define CALLED_UFC_FIGHTER_BROCK_LESNAR_A_WUSS_IN_PERSON    518400

#define CHOSE_TO_RUN_ON_MS_VISTA_VS_UNIX   (CONSTANT Please_Wait)

#define HEAD_BUTTED_SOME_SOFTBALL_SIZED_HAILSTONES    86400

#define RECEIVED_LITERACY_GENE_FROM_LLOHAN_GENE_POOL    2

#define RETRO_ROCKETS_FIRED_TOO_EARLY_ON_REENTRY   518400

#define TIME_SPENT_PREENING_MULLET    345600

 

Of course, your actual defines-implementation would have a MIN and MAX for each item. I did not do that here in order to save a bit of blog space.

Example using defines:
/*----------------------------------------------------------------------------------------------*/
/*---- BEGIN Function fRandInteger --------------------------------------------------------*/

/* Send 2 arguments - minimum and maximum.
   Output to caller is a random integer anywhere in the specified range, inclusive.*/
int fRandInteger(minInt, maxInt)
{
 int rndInt, offset;

if (maxInt == 0) 
                        return maxInt; // Caller must handle a 0 in order to prevent error.

offset = minInt;
rndInt =   ((minInt) + rand() % (maxInt - offset + 1));

/* Examples:
 1. lr_think_time(fRandInteger(3, 12));
 2. rndVal = fRandInteger(1, 9);
 3. rndVal = fRandInteger(1,
CHOSE_TO_RUN_ON_MS_VISTA_VS_UNIX); */
return rndInt;

}

/*---- END Function fRandInteger ------------------------------------------------------------*/
/*------------------------------------------------------------------------------------------------*/

 

vuser_init()

{

… your code

lr_think_time(fRandInteger(TIME_SPENT_PREENING_MULLET,

AWAITING_PERSONAL_ECONOMIC_BAILOUT_FROM_CONGRESS));

… more of your code

 

          return 0;

}



BodyBinary - LoadRunner (tm) or Other Script

07:27, 2009-Jan-29  ..  Posted in LoadRunner Tips and Tricks  ..  1 comments  ..  Link

Have you ever looked at body binary in a performance test tool script and wished you:

1.       Had a mullet hairdo so you could pull every last hair out, or

2.       Saw someone nearby with a mullet so you could pull that hair out, or

3.       Had a 20 Megawatt megaphone with you at a K-Fed concert for some heckle-fun, or

4.       Had some designer “meds” on hand?

 

You are temporarily mystified, or if you are breathing from an inhaler; you are mistified. Clearly you want to see what is inside that gobbled gook to determine what might be needed for parameterization or correlation. Here is one method for a quick glimpse into body binary. See for yourself and do the following:

1.       Highlight and Copy the below

2.       Paste into Wordpad or Notepad

3.       Find/Replace \x00 with nothing. Do not input anything in the Replace with text box

4.       Observe

 

"BodyBinary=ADCClientVersion:01.06 Content-Type: multipart/mixed; boundary=ge-')”

“pk(al8_,?800-555-1212/,; num-args=4 --ge-')pk(al8_,?1212/, Content-Type:”

“application/x-varg Content-Length: NNN \x08\xMySRV \x08\x02T\x08\xFC\x02”

“\x00S\x00e\x00l\x00e\x00c\x00t\x00 \x00A\x00. \x00B\x00E\x00E\x00R\x00, \x00 \x00A\x00. \x00B\x00R\x00E\x00W\x00E\x00R\x00, \x00 "

"\x00A\x00. \x00B\x00E\x00E\x00R\x00_\x00V\x00E\x00N\x00D\x00O\x00R\x00, \x00 \x00A\x00. \x00P\x00C\x00T\x00G\x00_\x00A\x00L\x00C\x00O\x00H\x00O\x00L\x00 \x00”

“\x00f\x00r\x00o\x00m\x00 \x00F\x00A\x00V\x00O\x00R\x00I\x00T\x00E\x00_\x00B\x00E\x00E\x00R\x00S\x00, \x00 "

"\x00w\x00h\x00e\x00r\x00e\x00 \x00 (\x00A\x00. \x00P\x00C\x00T\x00G\x00_\x00A\x00L\x00C\x00O\x00H\x00O\x00L\x00 \x00>\x00 \x007\x006\x00. \x000\x00 \x00 “

“\x00O\x00R\x00D\x00E\x00R\x00 \x00B\x00Y\x00 \x00P\x00C\x00T\x00G\x00_\x00A\x00L\x00C\x00O\x00H\x00O\x00L\x00 ",

LAST);



Client-side Popup Window Handler

11:06, 2007-Sep-8  ..  Posted in LoadRunner Tips and Tricks  ..  0 comments  ..  Link

It is quite sad when something like this utility is needed. What were they thinking or smoking?? Nonetheless, I backed into a need for this. As the title suggests, this is a method for handling popup windows generated by the app-under-test; where the popup is client-side only and is not directly involved in a communication exchange with the server, nor is its output used in a GET or POST. So if you need something to send keystrokes to a client-side popup where the LR script is incapable of handling it, this is a method for sending keystrokes and clearing the window so the Vuser may proceed. The need for this is very rare. You may obtain the demo/package here at SQAForums.

NOTE! This is not needed for ordinary download/open/save file-type operations.



Forcing Files to Travel With LR Scripts

08:04, 2007-Sep-8  ..  Posted in LoadRunner Tips and Tricks  ..  0 comments  ..  Link

Everyone has baggage. I have baggage. Just ask my wife and be prepared to listen for a couple of hours. LoadRunner scripts and scripts of equivalent tools are no different. This is a tip that demonstrates how to spread the wealth of baggage to LoadRunner scripts.

Why do I need to do this you might ask. Here are some reasons. You may:

  1. Have scripts that upload files, and/or
  2. Have supplemental special-purpose code when the script alone will not cut it, and/or
  3. Wish to have a readme or other knowledge-preservation file travel with the script, and/or
  4. Wish to have Mom's apple pie recipe travel with the script, and/or
  5. Wish to have a list of late-night operating pizza parlors for when you test late.

How would you then do this? Two methods follow:

First:

  1. In Vugen, select Menu -> Files -> Add Files to script
  2. Follow the prompting

Second:

Each LoadRunner script, within the script folder has a "Dot Usr" file or .usr file. Of course if you double-click the file icon, VuGen will launch - assuming VuGen is installed properly. However, if you right-mouse on it, you will see that you can "Open With...". This is key to adding baggage per the above list.

  1. Put the desired baggage file in the script folder
  2. Right-mouse/Open the target .usr file for editing (Wordpad, etc.)
  3. Locate the section named [ExtraFiles]
  4. If the section does not exist - create it. It must look like just above
  5. Open a new line under this section
  6. Add your file name (example: MyBaggage.doc) to this section as depicted below, then save and close.
  7. .\MyBaggage.doc=

Note the period or dot and the backslash, AND the equals sign (=). The "." and = sign must be present. Congratulations! You have now created more baggage. Inform your wife or significant other that you now have more baggage.

In many applications that you script for, you may encounter the need to upload a file to the system/application-under-test. The method described above removes the need to manually copy this file to every load generator.

Ok, well what if the file name needs to be different for every submit? I will expose a couple methods for doing this in a separate blog entry. Please feel free to share how you handle situations like this - either by linking to it or by commenting on this entry.

I use this quite often in conjunction with the utility under this link. I keep the baseline measurement file with the script for future reference. I also use it to ensure proper baggage handling of external custom code that is necessary for the correct operation of the script - code such as VBScript-based for specifc jobs callable via "system();" within the LR script.

 

 



{ Last Page }   { Page 1 of 2 }   { Next Page }

About Me

Home
My Profile
Archives
Friends
My Photo Album

Links

Corey Goldberg
Effective Testing?
Bj Rollison I.M. Testy Blog
Alan Page: Software Testing & Rants
Dmitry's LoadRunner and QTP Blog
Veterans History Project
Air Traffic Control Watch
Music Making Fun
My home 1972-1975

Categories

Functional Testing
Performance Horror
Development
Performance Testing
General
Tools Tips
Warped Humor
LoadRunner Tips and Tricks

Recent Entries

They Need To Test More...
Software Disorder
LoadRunner (tm) & RTE 4 Func/Regr
LoadRunner (tm) Random Think time Function
Are Rock, Paper, Scissors-based Decisions Obsolete?

Friends

LauraScharp
philk10
richardw100
aalhait
jimhazen
strazzerj
Lynnem
bru
EklecticTester
jgottlieb
leakybrain
michaeljf
prainbow
rajeshmathur
rstens
Yury
zeeslo
whollymindless

Syndication

RSS Site Feed