LoadRunner common function summary post

Source: Internet
Author: User
Tags list of attributes domain list

1. Common lr_eval_string

The main function of the lr_eval_string () function is to return the current value of a parameter in the script. Return Value Type: Char is generally used to output the parameter value during script debugging. the specific usage is as follows: lr_output_message ("The parameter1's value is % s", lr_eval_string ("{parameter1 }")), the parameter parameter1 has previously defined the parameter lr_log_message (lr_eval_string ("{parameter1}") 1. value assignment and value of the parameter lr_save_string ("Hello World", "Param"); lr_eval_string ("{Param}"); 2. variable to parameter int X; X = 10; lr_save_string (x, "Param"); lr_eval_string ("{Param}"); 3. variable read parameter char X [100]; X = "{Param}"; lr_save_string ("Hello World", "Param"); lr_eval_string (X );

Ii. strstr Function

Usage: strstr (str1, str2) gets the index of str2 in str1, returns an int if it succeeds, and returns NULL if it fails. It is usually used to determine whether str1 contains str2

 

Iii. Use the web_submit_data Function

The web_submit_data function processes 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.

Function Syntax: int web_submit_data (const char * stepname, itemdata, [extrares,] Last );

Return Value: lr_pass (0) indicates success, and lr_fail (1) indicates failure.

Function Parameters
List of attributes: the following attributes are supported:
1. Action: The action attribute in form, specifying the URL used to complete the operation in form.
2. Method: Form submission method: post or get (post by default ).
3. enctype: encoding method.

Note: In a form, enctype = "multipart/form-Data" indicates the mime encoding of the form. By default, the encoding format is application/X-WWW-form-urlencoded and cannot be used for file upload. Only multipart/form-data can be used to completely transmit file data, perform the following operations.
Enctype = "multipart/form-Data" is used to upload binary data. The input values in form are passed in binary format.

4. encodeatsign: whether to use the ASCII value to encode the symbol. Yes or no.
5. targetframe: the frame that contains the current link or resource. For more information, see list of attributes parameters with the same name.
6. Referer and mode: see parameters of the same name in list of attributes.
Itemdata: delimiter used to separate data fields and attributes.
List of data:
The data field List defines the content submitted by the form. Because the request is context-independent, the data domain contains all the hidden domains. Use Form encoding rules to organize data domains.
The data domain list can be in any of the following formats:
"Name = N1", "value = V1", Enditem,
"Name = n2", "encryptedvalue = Qwerty", Enditem,
Extrares: delimiter, marking the next parameter will be a list of resource attributes.
List of resource attributes: See list of resource attributes.
Last: End mark.

Generally, if the web_submit_data function is recorded, vugen records "name" and "value" together in the itemdata section. If you do not want to display "value" in plain text in the script, you can encrypt it. Change "value" to "encryptedvalue", and change the recorded value to the encrypted value. Please refer to related content in web_submit_form

 

 

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.