Thursday, July 09, 2009

How to get page size data in LR scripts part2--extract common code into header file

Step1:
Create your common method in Loadrunner installation folder, which is usually in ..\Program Files\HP\LoadRunner\include

In calpagesize.h file, here is the source code which simply return the “current page size” you want to measure:

int calpagesize(int Pre_size){

int Temptotalsize=0;
int currentResponseSize = 0;

Temptotalsize = web_get_int_property(HTTP_INFO_TOTAL_RESPONSE_STAT);

return currentResponseSize = Temptotalsize - Pre_size;

}

Step2:apply the calpagesize() method:

Adding #include “calpagesize.h” in your globals.h file

Step3: Adding calculate page size code(in red line) into action:

Take Yahoo home page for example:
Action()
{
int Pre_page_size=0;
int cur_page_size=0;


Pre_page_size=web_get_int_property(HTTP_INFO_TOTAL_RESPONSE_STAT); //get accumulate page size data before sending next request

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

if (flag==1){ //flag==1 means trigger the page size func code

cur_page_size = calpagesize(Pre_page_size); //return yahoo home page page size

lr_save_int(atoi(lr_eval_string("{Avg_01_PageSize}"))+cur_page_size, "Avg_01_PageSize"); //save into parameter ” Avg_01_PageSize”

}

}
So normally, we may need to add 4 lines before and after the page you want to calculate the size.

finally, you can calculate the page size in Vuser_end():

lr_message("Avg_01_PageSize = %d", atoi(lr_eval_string("{Avg_01_PageSize}"))/atoi(lr_eval_string("{Iterations}")));

enjoy!
Cheng

Thursday, May 14, 2009

You got GrooveUtil.dll load error on LR9.5?

When I record scripts using LR9.5 on my laptop which install the office2007 there: error happens:


here is my temp solution:

Find GrooveUtil.dll under C:\Program Files\Microsoft Office\Office12, and rename this GrooveUtil.dll into other name :)

click to view big picture


My friend Alfred found out another solution for this issue, just disable the Groove GFS help on IE Add-ons:

Add page size funcion code into your LR scripts

As my ramp up project, I spent some time to complete a sample on how to get page size after applying small piece of code

Choosing Ajax(click and scripts) protocol;
pre-condition: set your log level as "send message only when an error occurs"
Within globe()
set one flag to trigger the page size func code on demand:
int flag=0;

Within vuser_init()Action, you can initial such parameter as:
lr_save_int(0, "accu_google_frontpage_PageSize");

Within Action() i take google landing page as a example:

int ThisTimeHttpResponseSize=0;
char *message;
int i=0;
int loops=2;

lr_save_int(loops,"loops_goo");

while(i小于loops){//if there is some loops here

message=(char *)malloc(140*sizeof(char));

memset(message, 0, sizeof(char));

web_browser("www.google.com",
DESCRIPTION,
ACTION,
"Navigate=http://www.google.com/",
LAST);

i++;

if (flag==1) {//enable pagesize func, if flag==1;

lr_set_debug_message(LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF);

//web_get_int_property Returns the accumulated size, including header and body,

ThisTimeHttpResponseSize = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

strcat(message, "PageSize_of_google_frontpage_");
strcat(message, lr_eval_string("{Iteration}"));
strcat(message, " = %d");
lr_message(message, ThisTimeHttpResponseSize);

lr_set_debug_message(LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_ON);

//multiple iteration accumulated
lr_save_int(atoi(lr_eval_string("{accu_google_frontpage_PageSize}"))+ThisTimeHttpResponseSize, "accu_google_frontpage_PageSize");

}

free(message);

}


within end() action, calculate the average number of each page size:

if (flag==1) {

lr_save_int(atoi(lr_eval_string("{Iteration}")), "Iterations");
lr_set_debug_message(LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF);
lr_message("Iterations=%s",lr_eval_string("{Iterations}"));
lr_message("Avg_google_frontpage_PageSize = %d", atoi(lr_eval_string("{accu_google_frontpage_PageSize}"))/(atoi(lr_eval_string("{loops_goo}"))*atoi(lr_eval_string("{Iterations}"))));
lr_set_debug_message(LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_ON);

}


So you will get each page size freely now!

Thanks my friend Jeff,Alfred and Calvin previous sample code and ideas!

Wednesday, May 13, 2009

Tester,not only for counting bugs

What is one Tester's Mission?

--Counting bugs?
Are the company pay for bugs we have found?
Are the company recongize one's performance by how many bugs you already find?

If yes, two options:
1> you can go to dev, say "hi, dude, please bury some bugs and let me find them". Of course if that person who may not want to continue his career in this company or he really a "brother" to you.
2> or you may find a "right" partner who will often make mistakes, then you will be a million easily.

--Help dev to make less mistakes?
I agree!Even if i can not easily find a bug now, i am glad to see our application so stable and trustable...
I am happy to work with even he may write a bugless code, you can help him continuously improvement, meanwhile you can just dig deeper treasure which may need more effort or deeper understanding on application functionalities and infrastructure. More important, this, of course, makes customer happy(they may hardly find out bugs as well).You make the company win!

Tuesday, May 05, 2009

Not Only Keeping walking, But Keeping Thinking

两张有趣的图片,内容并无新意,关键是省去N多文字:

“过犹不及”:


“只要功夫深,铁杵(不一定)磨成针”:
Not Only Keeping walking, But Keeping Thinking to be an expert(If you really want it)!



Note: pictures from http://headrush.typepad.com

Monday, May 04, 2009

Run, Rockets, Run

Rockets Win the first Game, I made a right Guess :)

Twitter proves!!

Click picture bellowing to look at the details:

Tuesday, April 28, 2009

Main purpose on doing performance tests in my mind

1> Help to find out the (Top) bottlenecks, so that we are able to focus on and make a plan to tune them one by one;
2> Help team/PM to make a decision on release by measuring the trend of performance, guarantee no degradation on each release. (I prefer to taking the throughput trend and overall performance data rather than individually response time as a degradation indicator)
3> Help dev to do the hot spot tuning, we will "agilely" and "aggressively" change our test strategy during tuning phase :)
check out My previous blog on performance test strategies:
http://joychester.blogspot.com/2009/04/performance-test-strategy-in-my-mind.html
4> Validate some "guessing" or "pilot" projects
5> Capacity planning, scalability testing(horizontally and vertically)
6> Bonus! Finding out functional or security bugs in application occasionally
。。。
Feel free to add yours:)

Thursday, April 23, 2009

一双破袜子引发的争论



In Million Dollar baby, I like these lines between Eastwood and Freeman so much! :)

Background: Freeman put his feet on Eastwood's desk, then Eastwood came in...

Eastwood:
Where are your shoes?(你鞋呢?)

Freeman:
I am airing out my feet.(我脚透透气)

Eastwood:
You got big holes in your socks(袜子那么大的洞)

Freeman:
Oh, they're not that big(哦,这还不算大的)

Eastwood:
Didn't I give you money for some new ones?(我之前没给你钱让你买双新的?)

Freeman:
These are my sleeping socks, My feet like a little air at night.(这是我睡觉时的袜子,脚丫喜欢在晚上透透气)--居然喜欢穿袜子睡觉??

Eastwood:
How come you're wearing them in the daytime, then?(那你白天怎么穿晚上的袜子?)

Freeman:
Because my daytime socks got too many holes in them.(噢,白天袜子的洞更大)

Eastwood:
Well, if i give you some more money, you buy some new socks, please??(靠,如果我多给你点钱,你能不能买几双新的,拜托)

Freeman:
Well, i'd be tempted, but i couldn't say for sure. Might find its way to the track.(呦,这倒是个好主意,不过我不能保证,这钱真的会用到袜子上)

Eastwood:
。。。(无语)

“疯子”和“魔方”



《当幸福来敲门》一直有一个问题没有搞懂,为什么影片会有一个“疯子”一直跟Chris“过不去”?是巧合还是别有用心?(Sorry,叫疯子并非歧视,是因为不知道他的称呼。。。)


“疯子”是一个标尺,心理的标尺,标志着Chris崩溃的底线,也许疯子十几年之前的状态正和现在的Chris一样??很显然,结果是“疯子”没有把握住,而Chris 挺住了!其实有时候Chris的境遇并不如“疯子”,但他在挣扎,坚持这自己的希望,在等待幸福来临时的那一刻,很显然,正和海报上的图画一样,他当时所有的一切就是儿子和他赖以生存的“time machine”!

我想,这就是“疯子”在电影里存在的必要吧 :)

小小的“魔方”,威力巨大,它代表着机遇,如果当时在出租车上高级经理人没有玩魔方,或者说Chris自己不会玩,也许经理人不会对这个素不相识的“穷光蛋”有什么好的印象。

正是魔方让他对Chris刮目相看,一切就是那么巧合,这就是对机遇的最佳诠释--在正确的时间,相遇在正确的地点,遇到正确的人,做了正确的事,一切就有了转机!
享受当幸福来临的时刻吧!It really belongs to you!

Thursday, April 16, 2009

今天,你XXX了吗?

突然想到一个句式:
--今天,你云计算了吗?
--今天,你敏捷了吗?
--今天,你Google了吗?
--今天,你百度了吗?
--今天,你twitter了吗?
。。。
--今天,你吃饭了吗?
--今天,你OUT了吗?

结论,看到娃哈哈有个啤酒饮料的广告,发现自己真的OUT了