LoadRunner Test WebService Protocol Summary

Source: Internet
Author: User

LoadRunner Test WebService Protocol Summary

I. Choice of agreement

1. Open Virtual user generator, create a new script, select the WebService protocol

2, when the choice of the protocol is unclear or the system protocol is not clear, the use of LOADRUNNER11 with the Protocol analysis software, file--analysis software--analysis application, select the application type and path determination, wait for the analysis results.

3. After the protocol is selected, enter the script creation interface

Ii. Script creation 1, import service

Management Services, import, enter the path of the service being tested, determine

2. Add the Calling program

1, add service call, select Operation method Name, fill in input parameters and output parameters, determine, will automatically generate test script

Request: Requests the parameters, enter the corresponding required fields

Indentify: Login information, ID and password to apply user name and password

Response: Returns the parameter, saving the required parameters in the parameter for subsequent function calls

2. Generate Script Interface

3, need to reset the parameters, select the "tree" type display mode, you can re-edit the script

4, parameterization of the corresponding parameters, can be edited with Notepad

5, run-time settings, shortcut key F4

Run logic: Sets the number of script iterations, that is, the number of script loops

Think time: You can set whether or not to think about wait time during the script run

Other: error handling, general choice to continue when error occurs

3. Return the result to judge

1. Single return result judgment

For example, when we call the WebService interface to enter the following parameters "<mobileno>13312345678</mobileno> <smscontent> fetion </smscontent > ", the interface correctly returns results including" Fetion is China Mobile business ". Here we need to judge the return result. The sample code is as follows:

lr_eval_string function Description

None of the C variables can be called directly by the LR function. So: the LR function calls the C variable, which has to be parsed by lr_eval_string, which is equivalent to the function of the bridge.

Strstr function Description

The function format is strstr (STR1,STR2), where str1: is searched for the target string expression to Search,str2: object to find the string expression to Find. The function returns the position of STR2 for the first time in str1, and returns null if it is not found.

Lr_error_message and Lr_output_message function descriptions

The Lr_error_message function sends error messages to the Output window and to the VUser log file.

Lr_error_message Displays the red font in the playback log and displays the line number of the statement, and if the script runs in Controllor, an error message is generated.

The Lr_output_message function sends a message with the line number of the script part to the Output window and to the log file.

2, multiple return results judged

Similar to a single result, in fact, is nested IF statements, here do not repeat, the sample code is as follows:

Third, target-oriented scene setting

1, open the controller, select the test script to run, if the test target is determined, select target-oriented scenario, otherwise select the manual scene

2. Edit the scene target, select the target type according to the requirement target, set the target parameter, run time

3, add the load generator, click on the generator, add, enter a name, temporary directory, OK, select the added information click Connect, status display ready, indicating the connection is successful

4. Result directory settings

Result settings, enter the result name and the saved directory location

5. Monitoring parameter setting

Go to the Run interface, select the View Right button to open the new diagram, select the information to monitor

6. Add Windows Resource View

Right-click Windows resources, add measures, add a name, enter the IP address of the monitoring destination, and determine

7. Run-Time settings

Design interface, runtime settings, other, tick "continue when error occurs"

8. Start the scene and observe the situation during the operation

Iv. Analysis of results

1. Open LoadRunner Analysis, open the controller result set path under the file

View the results, the number of transactions per second, whether the response time meets the requirements, and see if Windows resources are using normal

Five, frequently asked questions

1, LoadRunner monitoring Windows resources can not connect problems

⑴ ensure that the monitored Windows system turns on two services: Remote procedure call (RPC) and Remote registry server

⑵cmd Command input: NET use \\192.168.1.XXX (Monitoring service address)

⑶ Enter your user name and password

VI. matters of caution

1, the script runs, there is no exception, but the background log will prompt errors, pay attention to the background error message content, to troubleshoot the problem of the script.

Seven, practical practice

1 , requirements Description:

In real-world projects, you need to test whether a component can hold up to 20,000 sessions, and after you save 20,000 sessions, the user can send an upstream text message to end the 20000 session normally. In the stress test, we have added 50 virtual users, then a virtual user only needs to start saving 20000/50=400 sessions, then end these sessions.

2 , Scripting

3 , Lr_whoami function Description

void Lr_whoami (int *vuser_id, char **sgroup, int *scid);

Return value: Returns the currently running VUser ID, the name of the group running the script, and the scene ID

Parameter description:

int *vuser_id need to register, save the ID of the running VUser, play back in virtual User generator-1

Char **sgroup need to register, save the running VUser Group name (script name), playback in virtual User generator return None

int *scid is required to register, save the ID of the running scenario and return 0 in virtual User generator

4 , Lr_save_int function Description

The Lr_save_int function means to save an integer as a parameter

ABS (ID) means to take the absolute value of the ID (because in Virtual User generator, the ID is returned as-1)

LoadRunner Test WebService Protocol Summary

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.