Systems & Software Talk 

Visitors since August 14, 2007: Free  Web Counters
Free Hit Counters

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.

 

 



LoadRunner - Correlated Date Comparison

04:56, 2007-Aug-12  ..  Posted in LoadRunner Tips and Tricks  ..  0 comments  ..  Link

= ** Date Comparison Utility ** =

If you arrived here looking for tips on how to compare (depending upon your orientation) your dates with "Gloria" or "Betsy" or with "Duke" or "Beaufort", you came to the wrong place. While you might be interested in dating parameters, this topic has a different context. We are not dealing with parameters such as "First Date Suck Face Scale" or "Dinner Tight-Wadness" or "Opened Car-door For Me But Slammed It And Crushed My Roses" or "Flirt level With Waiter Or Waitress" or "Alcoholic Beverage Guzzle Rate" or "Frequency Of Change Topic To All About Me". We are dealing in ones and zeros here. Sure your date may have been a zero but really, we are talking two different types of parameters. Still not convinced that this is not about humans and dating? I know you are thinking about the word "LoadRunner". Sure your date turned out to be an extreme emotional Load and during dinner you daydreamt that you were a first class Runner. But honestly, this is about information technology. Anyway...

This is derived from a bucket of code that is also shared at SQAForums: www.sqaforums.com. I wrote a piece and then ptrussell_nc discovered a flaw in the original and fixed it. Too bad it isn't that easy to fix a flaw in a date - heh?

The purpose of this code fragment is as follows:
In general within this example, compare two dates of the format "mm/dd/YYYY" and then output the result in the "if" block. You would adapt this to your specific needs. It is best to keep the local script host system date capture in the Action section in the event you run a test thats spans more than one day.
Capture today's date from the script host system date

  1. Save it into an LR parameter
  2. Capture the desired date for a specific item from the server
  3. Compare the Years to see if they are different. If they are, this determines which date is before which.
  4. Compare the full dates if the Years happen to be the same.

* Results from 4 & 5 above can be: 1) date is before, 2) date is after, or  3) the date is the same.


If you wish to compare dates of different formats, then you would adjust the formatting codes appropriately. The code may also need to be modified.

Note from ptr: In merging this code this rewritten it to be slightly more efficient and compact.
/* Authors:  JakeBrake & ptrussell_nc of SQAForums.com
   Version:  1.1
   Date:  1-Aug-2007 */
{
int rc;
int refrel;
char *today;
char *refDate;

/*  lr_eval_param is going to return a block of memory that
we can use. We don't need to write those results to a temporary buffer. This next line saves today as mm/dd/yyyy in "dateToday" */

    lr_save_datetime("%m/%d/%Y", DATE_NOW, "dateToday");
    /
* Below goes before the LR request that would capture the date */
    web_reg_save_param("CapturedDate", "LB=The left bound", "RB=The right bound", LAST);
    /* Save LR parms in two different "C" strings, then compare the two */
    today = lr_eval_string("{dateToday}");
    refDate = lr_eval_string("{CapturedDate}");
    lr_message("today %s  capturedate %s",  today, refDate);  // for debugging
    refrel = 0;  

    /*  -1 for before today, 1 for after today compare the years first */
    refrel = strcmp(refDate + 6, today + 6);
    /* if the years are the same (refrel = 0)  then compare the full dates */
    if (!refrel)  refrel = strcmp(refDate, today);
    /* Note well the text of the lr_message! */
    if (refrel < 0)  
            lr_message("refDate is before today ");
    else if (refrel > 0)  
            lr_message("refDate is after today ");
    else lr_message("refDate is today ");
    return 0;
}

Do you still think this is about the human dating experience? Are his or her parameters important to you? Do you wish to have a good correlating experience? Please let me refer you to here.

Oh arighty then.. you came here for dating pointers. Here are some! It's all in the fingernails:

  1. If you bust him during a tabletop sleight-of-hand magic trick such that you see him tuck/pull the vanished/reappeared silver dollar to/from under a fingernail; he might not be right for you.
  2. If she is a tabletop fingertip tapper and after a couple rhythmical percussive pieces she leaves a heap of wood chips, you should leave the restaurant alone. Take the wood chips with you for fireplace kindling.

 



LoadRunner: web_reg_save_param(); SaveLen and SaveOffset

09:31, 2007-Aug-11  ..  Posted in LoadRunner Tips and Tricks  ..  0 comments  ..  Link

Parameter parsing: web_reg_save_param() (WRSP) – SaveLen & SaveOffset;

Have you ever used WSRP to capture a value that looks similar to this? "123450_67811_909876543".

You capture it and then you must use it in a subsequent POST or GET. However, it might not be the same string each iteration which is why you correlated it in the first place! On top of that you might need to substitute the "_" underscore characters with one or more characters for the subsequent POST or GET such that it must look like this:

"123450%5F67811%5F909876543", where the instances of the underscores are replaced with "%5F" – for example. Now let us assume that the original numeric portion is 1) fixed length, and 2) the segments within are fixed length. If those criteria are not met, this will not work for you. Otherwise this situation allows us to use WRSP versus writing some custom "C" to manipulate character buffers. Before showing how to solve this situation with WRSP, let us take another look at the value, "123450_67811_909876543". Let us also say that a next script iteration might return this value to the WRSP, "100010_22255_900777040". Remember that you must now replace the two underscores (2 chars) with "%5F" or a total of six chars. Below is a way to accomplish this. As always, you would place the WRSP statements before the GET or POST that causes the value to be returned to your Vuser’s dynamic parameter.

Again, assuming the captured value is constant length and each segment within is fixed length and the value returned for said iteration is "100010_22255_900777040", we would use the below to setup three dynamic parameters from the same string; taking advantage of WRSP arguments "SaveLen" and "SaveOffset". In the below, use the same right and left boundaries for each WRSP (wrsp is used below. You would of course use web_reg_save_param();).

wrsp("Segment1", "LB=Left", "RB=Right", "SaveLen=6", "SaveOffset=0", LAST);

wrsp("Segment2", "LB=Left", "RB=Right", "SaveLen=5", "SaveOffset=7", LAST);

wrsp("Segment3", "LB=Left", "RB=Right", "SaveLen=9", "SaveOffset=13", LAST);

We now have three dynamic parameters as follows:

{Segment1} = "100010",  {Segment2} = "22255",  {Segment3} = "900777040"

Notice that we did not capture the underscore character.

Assuming you must now use the example "%5F" in lieu if the underscore character in a POST or GET, the below is an example of how you would proceed.

/* Then your subsequent GET or POST would look like this: */

web_submit_data (or web_url, etc.) ... ITEMDATA,

"Name=NamedItem", "Value= {Segment1}%5F{Segment1}%5F{Segment1}", ENDITEM,

The actual above value returned to the server in this example would be:

100010%5F22255%5F900777040

Circular heh?



Vugen Output Log Transaction Parser

01:03, 2007-Jun-24  ..  Posted in LoadRunner Tips and Tricks  ..  0 comments  ..  Link

I propose that it is important to provide performance data to your customer as soon as you have it in hand. Please read on.

  • Do you think it useful to provide early transaction measurement reports to your customer?
  • Is your first test weeks away and you have one or more scripts developed?
  • Do you have a practice of test-driving your scripts after all correlation and parameterization is complete?
  • Is it too time-consuming to take individual scripts and drop them into a LoadRunner or PerformanceCenter-based scenario and get early measurement data?
  • Is it valuable to get a single user business-process baseline and easily produce a report without going through LoadRunner or PerformanceCenter?

If you answered "Yes" to all of the above and agree with my opening proposition, then the report-generating Version 1.1 Utility Under Here is right for you. The utility is under the "Attachment" link located in the header of the post. Please read the information and follow the instructions in the post. Look for a Version 2.0 by the end of July 2007. Version 2.0 will properly handle transactions in the vuser_init and vuser_end sections.

If you have no need for this from a LoadRunner perspective, please feel free to use it as reference code for manipulating Excel(tm Microsoft Corp.) spreadsheets.

Please let me know if you use this and find it useful! Please do not report any bugs to me - fix 'em yourself!  (No - just kidding!)  Please do report them to me. Thank you.

If you have a need for examples of manipulating spreadsheets programmatically this code has examples.

 



{ 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

Introducing Testalis
Defect Report - Politically Correct
Performance Testing Vuser Personas – Part I
Happy Holidays 2007
Acceptance Testing (UAT) - Some Answers to Some Questions

Friends

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

Syndication

RSS Site Feed