LoadRunner Error Handling function

Source: Internet
Author: User


Category: "LoadRunner Virtual User Development Guide" 2009-06-29 14:20 4688 people read reviews (2) Favorites Report LoadRunner script action test excerpt from the LoadRunner Virtual User Development Guide


In the script's run-time settings, you can set how errors are handled during the script's run. Go to run-time settings, switch to the Miscellaneous tab, and you'll see the first setup entry for error handing: Continue on error,1-30. When the Continue On Error option is checked, the script continues to execute if an error occurs during the run.









Obviously, whether or not the continue On Error entry is checked, there may be a problem with some scripts running in the controller: When checked, execution errors are ignored for all functions, even if some key business function execution errors are ignored. In this case, it is obviously meaningless to continue running the scene, and if unchecked, some insignificant function execution will cause the current vuser to stop running, and when more vuser is stopped because of a small error, it will also cause the result of the whole scene to lose its meaning. It is clear that this situation should not happen.



Vugen provides the error handling function Lr_continue_on_error, which is used to modify VUser's error settings in real time in the script. The syntax structure of the LR_CONTINUE_ON_ERROR function is as follows:



void lr_continue_on_error (int value );



value is the value of the script run error setting, and the meaning of the value and corresponding value is shown in table 1-7. When using the parameters in table 1-7, you can either use the constant name as a parameter or use the corresponding constant value directly as the parameter.



Table 1-7


Constant name

Constant value

Meaning

Lr_on_error_no_options

0

Cancel error continue execution settings

Lr_on_error_continue

1

Error continues running script

Lr_on_error_skip_to_next_action

2

An error occurred jumping to the next action run

Lr_on_error_skip_to_next_iteration

3

An error has occurred jumping to the next iteration to run

Lr_on_error_end_vuser

4

An error has occurred ending the current user





The Lr_continue_on_error call will have an effect on all statements that follow it. As a result, Lr_continue_on_error (0) and Lr_continue_on_error (1) are more commonly used in scripts. The two statements appear in pairs, including the key business scripts that need to be set to stop execution of the error, as shown in example 1-71.



As you can see, example 1-71 is more suitable for test scenarios where the pressure is large and runs automatically at night, and such scenarios typically turn on the Continue On Error option in Run-time settings, so you need to pass Lr_continue_on_error (0) Turning off the Continue On Error option causes some critical business errors to stop executing. For some non-critical businesses, you need to turn on the Continue On Error option with Lr_continue_on_error (1), so that the execution of the script will not be affected even if an error is encountered.



Example 1-71



Action ()



{



......



......



Lr_continue_on_error (0); Here are some important transaction codes, so the shutdown error continues to execute the settings



......



......



Lr_continue_on_error (1); The following are some non-critical transaction code, such as downloading some picture files, so turn on error to continue the parameter setting.





......



......



return 0;



}



Conversely, if the continue on Error entry is not checked in the Run-time settings, it should be combined using lr_continue_on_error (1) and Lr_continue_on_error (0) To continue execution after some non-critical business errors occur.






Excerpt from "LoadRunner Virtual User Development Guide"


"LoadRunner Virtual User Development Guide" Sample & Video Tutorial




Taurus Award author Chen Shaoying book "LoadRunner Virtual User Development Guide" sample chapter, share to everyone. (Sorry, the file over 512kb, can not upload directly, please forgive us. )

The book is divided into 7 chapters. The 1th chapter is the basic knowledge, focusing on the Virtual User Development Foundation; The 2nd chapter explains the development method of Web virtual user; The 3rd chapter is a VUser development method based on socket, which can solve many problems that cannot generate VUser script by recording; 4th chapter discusses the knowledge of dynamic link library in detail. The 5th chapter is. NET virtual user knowledge, provides a lot of practical learning programs to improve the reader's development ability; The 6th chapter discusses the knowledge of Java virtual users; The 7th chapter is a case study of the development of a VUser script based on UDP protocol application. This book focuses on the users of LoadRunner to help them improve their virtual user development skills. This book can also be used as a university textbook.

Sample chapter:http://files.cnblogs.com/bvbook/LoadRunner Virtual User Development Guide-sample. pdf


This book also presented Chen Shaoying, Jin Chengji Two teachers jointly developed video course "LoadRunner Performance Test Quick Start", video :http://www.itcast.net/course/detail/507


LoadRunner Error Handling function


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.