Summary of common LR Functions

Source: Internet
Author: User
Tags ftp connection imap time and date

Transaction functions:

Lr_start_transaction (); // mark the start of the transaction

Lr_start_transaction ();/* indicates the end of the transaction. Generally, the start and end of the transaction are used together */

Lr_get_trans_instance_status (); // obtain the transaction status.

Lr_get_transaction_think_time (); // obtain the specified think time of the transaction. The transaction time = The overall transaction time-the transaction's

Lr_stop_transaction (); // stop the transaction

Log functions:

Lr_debug_message (); // send debugging information to the log file

Lr_error_message (); // send the error message to the LR input window or log file.

Lr_get_debug_message (); // return the current debugging information

Lr_log_message (); // send information to the user log file

Lr_output_message (); // send information to the output window or log file

Lr_vuser_status_message (); // send the virtual user status to the Controller of LR

Runtime functions:

 
Lr_abort (); // script for terminating execution

 
Lr_continue_on_error (); // the event that runs when an error occurs

 
Lr_exit (); // exit from scirpt. ation. Iteration

 
Lr_rendezvous_ex (); // sets the set point

 
Lr_think_time (); // set the thinking time. In performance testing, you can set the thinking time based on the actual production environment to better simulate future operations.

 
Lr_rendezous (); // set point. You can set the virtual user before the same operation. The set point can increase the pressure on the tested application to achieve the purpose of stress testing.

 
Lr_load_dll (); // call the DLL file

Example:

Lr_load_dll ("user32.dll ");

Messageboxa (null, "this is testing
Message "," message_caption ", 0 );

Return 0;

System information functions:

Lr_get_master_host_name (); // return the name of the host running the controller.

Lr_get_user_ip (); // returns the virtual user's IP address.

Lr_user_data_point (); // recording user-defined data samples

Lr_user_data_point (); // record your own data for analysis. Use this function to record the sample name and value each time you want to record a point. The system automatically records the sampling time. After execution, you can use user-defined data and click the graphic analysis result.

 
Lr_get_host_name (); // returns the host name.

Example;

Char * Host;

Host = lr_get_host_name ();

Lr_output_message ("computer name
% S ", host );

Return 0;

Common functions in Web Applications

Web_url (); // load the corresponding URL Based on the URL attribute in the function, without context.

Web_image (); // simulate the mouse clicking action on the specified image. This function must be used in the context of a pre-operation.

TIPS: In toos-recording option, if the recording level is set to hmtl-based, web_image will be recorded.

Web_link (); // simulate the mouse clicking on the Link described by several attribute sets. This function can be executed only in the context of the preaction.

Web_submit_form (); // The function is used to submit a form. This function may have to be executed in the context of the previous operation.

TIPS: WEB virtual users are supported, but WAP virtual users are not supported.

Web_submit_data (); // function to process stateless or contextual form submissions. It is used to generate get or POST requests for forms. These requests are the same as those automatically generated by form. The form context is not required when sending these requests.

Web_find (); // This function is used to search for the specified string on the HTML page. After all the specified HTML requests are completed, the search process starts, Which is slower than web_reg_find.

The web_find function has been replaced by web_reg_find in the C language script. web_reg_find runs fast and can be used in both HTML-based and URL-based recording modes. In C language scripts, web_find is backward compatible. Java and Visual Basic scripts are no longer supported.

Web_image_check (); // check whether the specified image appears on the HTML page. This function only supports HTML-based scripts.

Web_reg_add_cookie (); // It is a registration function. It first registers a request to search for a text string. The check action is performed after the subsequent action function. If the string is found, it is added to the cookie.

Web_reg_find (); // belongs to the registration function. Register a request to search text strings on the web page and execute the search in the following action (such as web_url) function.

Web_concurrent_start (); // The function indicates the start of the concurrent group. All functions in the group are executed concurrently. Concurrent Group end web_concurrent_end
Function.

Web_reg_save_param (); // correlation function. you can maintain a dynamic value through association and search for the data to be associated from the database returned by the server.

Web_add-filter (); // filter function, used to filter the specified URL, analyze the URL load that has an impact on performance. Interface operation download filters of Internet protocol under run-time settings.

Web_custom_request (); // custom request function. You can write a custom request format to test the interface function.

FTP/IMAP:

Ftp_logon_ex (); // log on to the FTP server for a specific session.

Ftp_put_ex (); // set the working directory and upload files on the FTP server.

Ftp_logout_ex (); // cancel the current FTP connection.

Imap_create (); // create a new email.

Imap_check (); // send a Check Point in the email to implement and apply internal housekeeping to the mailbox.

TIPS: For IMAP testing, replace FTP in the function with IMAP.

Other common functions:


Lr_decrypt (): decryption function in lR


Instance code:
Lr_output_message ("decryption function test, decrypted value: % s", lr_decrypt ("4e0942869c958e3e "));


Getenv (): Get the defined environment variable value.


Instance code:


Char * TMP, logfile [256], dlr_seperator;

Logfile;

// Create an environment variable

Putenv ("logfile_name1_lr_xiaolintest.txt ");

//

If (TMP = (char *) getenv ("Temp "))

Lr_output_message ("temp dir =
% S ", TMP );

Else {

Lr_output_message ("TEMP environment
Variable undefined ");


Return-1;

}

Sprintf (logfile, "% s \ % s", TMP, (char *) getenv ("logfile_name "));


System (): Execute the operating system command


Char filename [1024], command [1024];


Char new_dir [] = "C: \ test ";


// Create a directory udder root called test and make it the current dir


If (mkdir (new_dir ))


Lr_output_message ("create directory: % s failed", new_dir );


Else


Lr_output_message ("create new directory % s", new_dir );


Sprintf (filename, "% s \ % s", new_dir, "xialin.txt ");


// Execept a dir/B command and directory it to a new_file


Sprintf (command, "DIR/B C :\\> % S/W", filename );


System (command)

Lr_output_message ("create new file
% S ", filename );


Rand (): obtain the random value of an INTEGER (0 to 32767)


Srand (Time (null ));

// Generate a random number from 0-99

Lr_output_message ("a number between 0
And 99 is: % d \ n ", Rand () % 100 );

Return 0;


Getdrive () and mkdir (): returns the name of the current drive disk.

Int CH, drive, curdrive;

Static char path [1024];

// Save current drive letter so it can be
Restored later

Curdrive = getdrive ();

// If we can switch to the drive, it exists

Lr_output_message ("available drives
Are :");

For (drive = 1; drive <= 26; drive ++)

If (! Chdrive (drive ))

Lr_output_message ("% C:", drive +
'A'-1 );

Chdrive (curdrive); // Restore original drive

Return 0;


Time (): returns the system time.

Typedef long time_t;

Time_t T;

// Get system time and display as number and
String

Lr_message ("time in seconds since
1/1/88: % LD \ n ", time (& T ));

Lr_message ("formatted time and date:
% S ", ctime (& T ));

Return 0;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.