Sunday, March 1, 2015

L.R_File Operations_01



Action()
{
    char *filename = "D:\\sundar\\From_LR\\Cntrl_Otpt_29th.txt";
    long file;
                char *groupname;
                int id,m,n;
    web_save_timestamp_param( "tmstampParam", LAST );
                lr_output_message(lr_eval_string("{tmstampParam}"));
                m=rand()%41+20;
     n=atoi(lr_eval_string("{VID}"));
                lr_output_message("%d",n);
     // Create a new file
                file = fopen(filename, "a+" );
                fprintf(file, "Random number is: %d and                               Vuser Number is:  %d \n",m,n);
  // Write the Vuser ID and group to the log file
     lr_whoami(&id, &groupname, NULL);

    fprintf(file, "log file of virtual user ID: %d                          group: %s\n \n", id, groupname);
    fclose(file);
lr_think_time(10);
return 0;
}

/*  Output – S.S.Reddy   */
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(9): Notify: Saving Parameter "tmstampParam = 1425195876184".
Action.c(9): web_save_timestamp_param("web_save_timestamp_param") was successful       [MsgId: MMSG-26392]
Action.c(10): Notify: Parameter Substitution: parameter "tmstampParam" =  "1425195876184"
Action.c(10): 1425195876184
Action.c(15): Notify: Parameter Substitution: parameter "VID" =  "1"
Action.c(17): 1
Action.c(35): lr_think_time: 13.82 seconds (recorded think time was 10.00 seconds).
Ending action Action.
Ending iteration 1.
Starting iteration 2.
Starting action Action.
Action.c(9): Notify: Saving Parameter "tmstampParam = 1425195890319".
Action.c(9): web_save_timestamp_param("web_save_timestamp_param") was successful       [MsgId: MMSG-26392]
Action.c(10): Notify: Parameter Substitution: parameter "tmstampParam" =  "1425195890319"
Action.c(10): 1425195890319
Action.c(15): Notify: Parameter Substitution: parameter "VID" =  "1"
Action.c(17): 1
Action.c(35): lr_think_time: 13.13 seconds (recorded think time was 10.00 seconds).
Ending action Action.
Ending iteration 2.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.

/*   Below is the Result in Output File—Notepad   */
Random number is: 47 and                          Vuser Number is:  1
log file of virtual user ID:  1                          group: None

Random number is: 21 and                          Vuser Number is:  2
log file of virtual user ID:  2                          group: None


 


Note: Some of the articles are grab from various Websites / Blogs.

No comments:

Post a Comment