In this tutorial, will go through how to use lr_error_message function with examples
When do you use this lr_error_message?
- This function is used when you want to output an error to different log files in Loadrunner
- Use this function only for logging errors for other messaging purposes use lr_output_message or lr_log_message.
- The maximum file size for logging is limited to 5 KB.
- This function will send to output file even though logging is disabled as this is error log.
- Return values – if the function is successful it will return the error string in red color to the output log. If it is failed, it will return -1(negative number).
- When you are using this function and printing the error and also wants to fail the transaction change the settings in run time setting ->Miscellaneous -> Error Handling -> Fail open transactions on lr_error_message.
- You can also get the transaction response time before failing the transaction using lr_get_transaction_duration.
Output file in VuGen
You will see the message in VuGen window in red color as show in the below image.
Controller Status Window
You can see the message in controller status window as shown in the below image.
Controller Output Window
You can also see this message in controller output. Go to View and click on Show Output
Error Log Folder
Navigate to results and results settings, you will see the log file folder where you will see the error logs
Go to C:\Users\VJ\AppData\Local\Temp\res\log and open with notepad or notepad++
Java function is lr.error_message where as C function is lr_error_message.
Example
Action() { char *Str1="Hello World"; lr_error_message( "%s", Str1); return 0; }
see this page for more loadrunner functions.