LoadRunner腳本編寫(7)

發表于:2014-09-15來源:uml.org.cn作者:不詳點擊數: 標簽:loadrunner
重點代碼部分: Action() { double trans_time; //定義變量 web_url(www.baidu.com, URL=http://www.baidu.com/, ..... lr_start_transaction(訪問注冊頁); //定義事務開始 web_link(???, Tex

  重點代碼部分:

Action()
{
double trans_time; //定義變量

web_url("www.baidu.com",
"URL=http://www.baidu.com/",
.....

lr_start_transaction("訪問注冊頁"); //定義事務開始

web_link("???",
"Text=???",
"Ordinal=2",
"Snapshot=t15.inf",
......

trans_time=lr_get_transaction_wasted_time("訪問注冊頁"); //獲得消耗時間

if (trans_time) {
lr_output_message("The duration up to the submit is %f seconds",trans_time); //打印數輸出消耗實時間
}else{
lr_output_message("the duration cannot be determined. ");
}

lr_end_transaction("訪問注冊頁",LR_AUTO); //事務結束

return 0;
}

  運行結果:

....... Action.c(39): The duration up to the submit is 0.029588 seconds Action.c(45): Notify: Transaction "訪問注冊頁" ended with "Pass" status (Duration: 5.0300 Wasted Time: 0.0296). Ending action Action. Ending iteration 1.

  39行:持續時間長達0.029588秒的提交

  45行:通知:交易”訪問注冊頁”結束,“通過”狀態(持續時間:5.0300 浪費時間:0.0296)。

  從上面的結果中發現,我們設置lr_get_transaction_wasted_time函數的時間0.029588 與事務結束浪費的時間 0.0296 非常接近。 這是因為我把 lr_get_transaction_wasted_time函數插入在了事務結果的前面,其實,我們可以將 lr_get_transaction_wasted_time插入在事務執行過程的任意位置來

原文轉自:http://www.uml.org.cn/Test/201303151.asp

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97