How to put parameter into variable using LoadRunner ?
--------THE DEMO BELOW--------
char sysbody[500];
vuser_init()
{
strcpy(sysbody,"Body=Usid=");
strcat(sysbody,lr_eval_string("{username}"));
strcat(sysbody,"&sgType=0&BetTime=2009%2D10%2D1%2010%3A27%3A04%20GMT%2B0700&LineNumber=7&GameType=12&BetMoney=0%2E01");
}
vuser_action()
{
web_custom_request("jungleGameBet.jsp",
"URL=http://www.168.com/something/games/jungleGameBet.jsp",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.168.com/something/games/jungle.swf",
"Snapshot=t40.inf",
"Mode=HTML",
sysbody,
LAST);
}
-----SYNTAX & NOTE-----
1. To define an array with specific length and kind of Char. If need, setting the global variable
char sysuser[50];
2. Using the C language function
Strcpy
Copies one string to another.
char *strcpy (char *dest, const char *source);
dest | The destination string into whichsourceis copied. |
source | The string that is copied. |
strcpycopies one string to another.
--------------------------------------------
Strcat
Concatenates two strings.
char *strcat(char *to, const char *from);
to | The string at the end of which thefromstring is concatenated. |
from | The string concatenated to the end of thetostring. |
strcatconcatenates two strings.
3. Loadrunner system function
web_custom_request
Allows you to create a custom HTTP request with any method supported by HTTP.
intweb_custom_request(const char *RequestName, <List of Attributes>,
[EXTRARES, <List of Resource Attributes>,] LAST );
----EXCERPT----
http://www.cnblogs.com/guanhe/archive/2006/09/04/494223.html