Vous êtes sur la page 1sur 4

Loadrunner - Functions Manual Correlation

The algorithm of manual correlation is the following: Find a dynamic value to capture. Find server's response, containing the dynamic value. Capture the dynamic value. Special parameter will be used instead of dynamic value. Replace every occurrence of dynamic value in script with the parameter. Check changes.

Web_reg_save_param Arguments Parameter name Left Boundary Right Boundary Relative Frame Id Hierarchical position of Frames Ordinal Position / Instance of Match Search

Example

<tr bgcolor=#66cccc><th>Flight<th>Departure time<th>Cost <tr bgcolor=#66CCff><td align=center><input type = radio name=outboundFlight value=230;378;11/20/2003 checked >Blue Sky Air 230<td align=center>8am<td align=center>$ 378 <tr bgcolor=#eeeeee><td align=center><input type = radio name=outboundFlight value=231;337;11/20/2003>Blue Sky Air 231<td align=center>1pm<td align=center>$ 337 Example web_reg_save_param("outFlightVal", LAST); "LB=outboundFlight value=", "RB= checked >",

web_submit_form("reservations.pl_2", "Snapshot=t5.inf", ITEMDATA, "Name=outboundFlight", "Value={outFlightVal}", ENDITEM,

"Name=reserveFlights.x", "Value=92", ENDITEM, "Name=reserveFlights.y", "Value=10", ENDITEM, LAST);

CHECKPOINTS
web_reg_find("Text=Welcome", LAST); // Now log in web_submit_form("login.pl", "Snapshot=t2.inf", ITEMDATA, "Name=username", "Value=jojo", ENDITEM, "Name=password", "Value=bean", ENDITEM, "Name=login.x", "Value=35", ENDITEM, "Name=login.y", "Value=14", ENDITEM, LAST); web_reg_find("Text=Welcome", "SaveCount=Welcome_Count", LAST); if (atoi(lr_eval_string("{Welcome_Count}")) > 0){ lr_output_message("Log on successful."); } else{ lr_error_message("Log on failed"); return(0); }

Global Verification
Web_global_verification searches for text string in all subsequent requests Web_global_verification(Text=<text>,Fail=Found/NotFound,ID=referenceID in Log,LAST);

Image Check
The web_image_check function verifies the presence of a specified image inside an HTML page. Either Alt or Src, or both, must be in the argument list. If both are passed, the check passes if both match a single image element. This function is only supported for HTMLbased scripts. web_url("index.html", "URL=http://localhost/ImagesAndMaps.html", "TargetFrame=", LAST); web_image_check("Go2Venus", "Alt=Venus", LAST);

Transactions
Lr_start_transaction & lr_end_transaction lr_start_transaction("deposit"); /* Server API call */ status = bank_deposit(50); /* End transaction with operation result - pass or fail */ if (status == 0) lr_end_transaction("deposit", LR_PASS); else lr_end_transaction("deposit", LR_FAIL); Lr_get_transaction_status() Cannot be invoked after the end transaction Can only indicate the status of open transaction

Lr_stop_transaction ( transaction name)

Lr_resume_transaction( transaction name) lr_log_message lr_log_message ( "We are on iteration #%s", lr_eval_string ( "{iteration}" ) ); Lr_message if (init() < 0) { lr_message ("login failed);} return(0); Lr_vuser_status_message lr_vuser_status_message ( "We are on iteration #%s", lr_eval_string ( "{iteration}" ) );

Parameter Functions
Lr_advance_param advances to the next Value

Controller
Before Scenario Execution: Creates scenaio Sets up run-time configuration

During Scenario Execution: Runs many Vusers simultaneously Controls each Vuser (initialize, run, pause, stop) Displays execution status of each Vuser Displays messages from each Vuser Monitors server resources

After Scenario Execution: Collets and organizes performance data Launches the Analysis Tools

Vous aimerez peut-être aussi