LoadRunner RegExp - Challenge resolved

Great news! The challenge, I posted about using Regular Exprassions in Loadrunner, has been resolved! I wondered - how to use RegExp in LoadRunner.

The winner is Charlie Weiblen. Congratulations, Charlie! Hooray! :)
He proposed the following solution - Regular Expressions in LoadRunner. Yes, it allows to use Regular expressions in LoadRunner and his solution works perfectly.

Also, I recommend to pay attention to his site - Performance engineering & testing. It contains a lot of interesting information on Performance testing and LoadRunner in particular.

As I promised, the reward is $52.25. Since Charlie asked me to donate this money to FSF (Free Software Foundation), I did so.

I captured screen shots to confirm that I donated money as I promised - $52.25. (Please, click on images to enlarge them):
Donation page #1
Donation page #2
Donation page #3
Confirmation email from FSF (Free Software Foundation)

Well, what's next?
  • First of all, I recommend to read solution from Tim Koopmans - Regex Pattern Matching in LoadRunner.
    Tim updated and simplified Charlie's solution. It looks simple and clear.
    Great work, Tim!
  • I developed Charlie's and Tim's solutions to search several matches or nested groups.
    I plan to publish it within the next few days.
Also, I would like to ask your advice.
Dear readers, do you have interesting topics for future community challenges? Please, post your comments and share them...

--
Dmitry Motevich

LoadRunner VIDEO - How to record PDF file saving?

One LoadRunner user asked me - How to record PDF file saving in LoadRunner?

Earlier, I explained that LoadRunner does not record client side activities!
That means, that LoadRunner records PDF file transferring ('cause it is a network activity) and does not record PDF file saving (which does not generate any network traffic).

In some case, we need to save PDF (or other) file on local disk and process it (edit, parse, or compare with 'etalon' file).
The present LoadRunner video tutorial explains how to record PDF file saving in LoadRunner.

How to record PDF file saving in LoadRunner? - LoadRunner video



This is a first LoadRunner script from the above LoadRunner video tutorial.
Note: this script is based on HP's article #11766 - How to verify download of a file in Web scripts (login to HP required to access).
int fp;
long i;

web_url("writings.html",
"URL=http://www.testing.com/writings.html",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);

//Truncate to zero length or create file for writing.
fp = fopen("c:\\temp\\my_file.pdf","wb");

//Set the parameter size large enough to save the data.
web_set_max_html_param_len("200000");

//Use web_reg_save_param with the correct boundary to capture the data returned by the server.
web_reg_save_param("FILED","LB=","RB=","Search=Body",LAST);

web_url("PDF",
"URL=http://www.testing.com/writings/automate.pdf",
"TargetFrame=",
"Resource=0",
"RecContentType=application/pdf",
"Referer=http://www.testing.com/writings.html",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);

//Get the download size.
i = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

//Write the data saved to an output file.
fwrite(lr_eval_string("{FILED}"), i, 1, fp);

//Close the file pointer.
fclose(fp);
As I shown in LoadRunner video, above script works incorrectly.


This is an improved LoadRunner script which captures and saves PDF file correctly:
long fp;
char *data;
unsigned long prmLen;

web_url("writings.html",
"URL=http://www.testing.com/writings.html",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);

//Truncate to zero length or create file for writing.
fp = fopen("c:\\temp\\my_file.pdf","wb");

//Set the parameter size large enough to save the data.
web_set_max_html_param_len("200000");

//Use web_reg_save_param with the correct boundary to capture the data returned by the server.
web_reg_save_param("FILED","LB=","RB=","Search=Body",LAST);

web_url("PDF",
"URL=http://www.testing.com/writings/automate.pdf",
"TargetFrame=",
"Resource=0",
"RecContentType=application/pdf",
"Referer=http://www.testing.com/writings.html",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);

//Get the download size.
lr_eval_string_ext("{FILED}", strlen("{FILED}"), &data, &prmLen, 0, 0, -1);

//Write the data saved to an output file.
fwrite(data, prmLen, 1, fp);

//Close the file pointer.
fclose(fp);


Related articles:


Do you like this LoadRunner visual tutorial? Would you like to receive them in the future?
If yes, please subscribe to this blog RSS feed or by Email. (How to subscribe? VIDEO guide)



--
Dmitry Motevich

How to run QTP test from command line?

Do you run your QTP tests suit manually?
What about running them on the schedule, for example nightly testing?

I will show the way how to do that - i.e. how to run QTP tests from command line.
Using that approach, you can execute your QTP tests on the schedule.

How to run QTP test from command line - QTP video tutorial


This is a script, which runs QTP tests (from the above QTP video tutorial):
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible

qtApp.Open "C:\Temp\simple_test", True ' Open the test in read-only mode

' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Run ' Run the test

WScript.StdOut.Write "Status is:" & qtTest.LastRunResults.Status ' Check the results of the test run
qtTest.Close ' Close the test

Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object

Happy QTP scripting, dear readers! :)



Related articles:


Do you like this QTP visual tutorial? Would you like to receive them in the future?
If yes, please subscribe to this blog RSS feed or by Email. (How to subscribe? VIDEO guide)


LoadRunner regular expressions

I have a real challenge for LoadRunner specialists, professionals, and gurus.
I would like to start new public investigation on LoadRunner regexp (regular expressions).
The reward is $52.25.

As you know, LoadRunner supports limited and 'light' regular expressions. These are special text flags of web_reg_save_param function to support 'light' LoadRunner regular expressions:
  • /DIG interprets the pound sign (#) as a wildcard for a single digit.
    For example, "te##xt" matches for "te23xt", and doesn't match for "text" and "te234xt".
  • /ALNUM interprets the caret sign (^) as a wildcard for a single US–ASCII alphanumeric character.
    There are three syntaxes: ALNUMIC to ignore case, ALNUMLC to match only lower case, and ALNUMUC to match only upper case.
    For example, with ALNUMLC flag enabled, "te^^xt" matches for "tenext", and doesn't match for "teNext" and "teneoxt".
The task is simple:
How to use real regular expressions in LoadRunner with C language?

Note: you can use real regexps with VBScript or Java. With standard LoadRunner C language this is not easy task!
I tried to use PCRE, but LoadRunner generated memory exception.

All I want is to process regexp templates, like:
  • (\w+)@(\w+)\.(\w+)
  • test.*
  • ^91[a-z]$
  • Windows(?=95 |98 |NT|XP)
  • and so on
If you be share hot to use regular expressions in LoadRunner, I will pay to you $52.25 (money I earned with this blog during March 2008).
I think, such use of money will be honest. My readers helped me to earn them, and I plan to investigate them to resolve LoadRunner community question.

Well, if you have ideas on LoadRunner regular expressions, please describe them on your site or blog and send me the link.

Let's work together!

Waiting for your solutions & comments.
Thank you, LoadRunner beginners & professionals.

Updated (27/04/08):
LoadRunner RegExp - Challenge resolved

--
Dmitry Motevich

[My money] - March 2008 - $52.25

As you can see, I use AdSense on my blog.
Note: AdSense is an ad serving program run by Google.

My readers help me to earn money (not so much as I would wish :) ).

That's why I think, that I must share the statistics on money I earned on blog.
I plan to share the statistics on monthly basis.

Please, see the statistics on last month - March 2008:
(click to enlarge the image)

As you can see, I earned $52.25 during March 2008.

How to spend them?

I promise to pay this money to person who will be ready to share how to use regular expressions in LoadRunner. So, investigate this question and will earn $52.25!

Updated:
Please read about the result of the current competition - LoadRunner RegExp - Challenge resolved.


Do you have others ideas on how to use future money? I'm interested to hear your opinion.
Please, send them to my email: Dmitry Motevich's email
Thank you in advance


--
Dmitry Motevich

How to subscribe to my blog

Today I plan to show and explain - How you can subscribe to updates from my blog.

Why you should subscribe?
The answer is simple - subscription allows to save the time, when you search for new articles on my blog.

You will receive notifications (by Email or RSS) when new articles will be published on my blog.
And you don't need to visit my blog every day and check - did I post something new or not? :)

Well, there are 2 ways to subscribe:
This video will help you to subscribe.

How to subscribe to blog - video guide



Thank you, my readers.
I hope, Email & RSS subscriptions will save your time and improve your productivity.

--
Dmitry