Example: web_dump_cache and web_load_cache

In this example the Vuser logs on to a system and views her paycheck. The script is run once by the test developer with the web_load_cache call commented out, and the web_dump_cache call and the web_add_cookie calls uncommented. This creates the files to be used in the actual testing.

After the files are created, the web_load_cache call is uncommented, and the web_dump_cache call and the web_add_cookie calls are commented. On subsequent runs, the cache files are loaded before running the business process.

Action()
{
/* Initially used to create the Vuser environment:
    web_add_cookie("SignOnDefault=; domain=pbntas05; path=/");
    web_add_cookie("http%3a%2f%2fpbntas05%3a8250%2fpsp%2fps%2femployee%2fhrms%2frefresh=list:|; domain=pbntas05; path=/");
    web_add_cookie("storedCookieCheck=true; domain=pbntas05; path=/");
End setup functions.
*/
// Get the previously created cache

web_load_cache("ActionLoad",
    "FileName=c:\\temp\\{VuserName}paycheck",
    LAST ); 

/* From here down is the business process for which
    we want to use a persistent cache */

web_browser("signon.html", 
    DESCRIPTION, 
    ACTION, 
    "Navigate=http://myserver:8200/ps/signon.html", 
    LAST );

web_edit_field("userid", 
    "Snapshot=t1.inf", 
    DESCRIPTION, 
    "Type=text", 
    "Name=userid", 
    ACTION, 
    "SetValue={VuserName}", 
    LAST );

web_edit_field("pwd", 
    "Snapshot=t2.inf", 
    DESCRIPTION, 
    "Type=password", 
    "Name=pwd", 
    ACTION, 
    "SetValue=HCRUSA_KU0007", 
    LAST );

lr_start_transaction("login");

web_button("Sign In", 
    "Snapshot=t3.inf", 
    DESCRIPTION, 
    "Type=submit", 
    "Tag=INPUT", 
    "Value=Sign In", 
    LAST );

lr_end_transaction("login", LR_AUTO);

web_image_link("CO_EMPLOYEE_SELF_SERVICE", 
    "Snapshot=t4.inf", 
    DESCRIPTION, 
    "Alt=", 
    "Name=CO_EMPLOYEE_SELF_SERVICE", 
    "Ordinal=1", 
    LAST );

web_text_link("Payroll and Compensation", 
    "Snapshot=t5.inf", 
    DESCRIPTION, 
    "Text=Payroll and Compensation", 
    "Ordinal=1", 
    LAST );

web_text_link("View Paycheck", 
    "Snapshot=t6.inf", 
    DESCRIPTION, 
    "Text=View Paycheck", 
    "Ordinal=1", 
    LAST );

web_text_link("Sign out", 
    "Snapshot=t7.inf", 
    DESCRIPTION, 
    "Text=Sign out", 
    "FrameName=UniversalHeader", 
    LAST );

web_browser("browser", 
    "Snapshot=t8.inf", 
    DESCRIPTION, 
    ACTION, 
    "Sync", 
    LAST );

/* This command was used once to create the cache files, then 
    commented out for the actually load testing */

/*    web_dump_cache("paycheckcache",
        "FileName=c:\\temp\\{VuserName}paycheck", 
        "Replace=yes", LAST );		*/

return 0;
}