Showing posts with label Vugen. Show all posts
Showing posts with label Vugen. Show all posts

Tuesday, 16 June 2015

How to capture the URL that is formed because of redirection?

Example:
When visiting http://www.mercury.com, user will be redirected to a different location. How to capture the redirected URL.


Solution:
Use web_reg_save_param()

When that the server redirects a HTTP request to another URL, it normally does that by sending a HTTP 302 Moved header. To verify
1. Run the script in extended log with "data retuned by server' turned on
2. Check the execution log for "302 moved'

You can also see that along with this header, the server also sends the following header information:
   "Location: ."

The URL specified in the "Location' header will be the URL that the original HTTP request be redirected to. To capture this URL, you have to capture the string between "Location:" and "\r\n" (end of line).

Example:

    Action()
    {

       //use the correlation statement to capture the redirection
       web_reg_save_param ("Redirection", "LB=Location: ","RB=\r\n" ,LAST );

       //Visit Mercury homepage
       web_url("Mercury","URL=http://www.mercury.com/", LAST);

       //Print the redirected URL
       lr_message("redirected address = %s", lr_eval_string("{Redirection}"));

       return 0;
    }

Friday, 6 February 2015

RTE script functions

Below are some RTE script useful function with explanations:

TE_connect
Connects the terminal emulator to the specified host.
TE_find_text
Searches for text in a designated area of the screen.
TE_get_line_attribute
Returns information about text formatting.
TE_get_text_line
Reads text from a designated line on the screen.
TE_get_cursor_pos
Returns the current location of the cursor.
TE_set_cursor_pos
Sets the position of the cursor on the terminal screen.
TE_getvar
Returns the value of an RTE system variable.
TE_setvar
Sets the value of an RTE system variable.
TE_perror
Prints an error code to the LoadRunner output window or Business Process Monitor agent log.
TE_sperror
Translates an error code into a string.
TE_send_text
Sends a null-terminated string to a VT terminal emulator.
TE_type
Sends a formatted string to the client application.
TE_typing_style
Determines the way text is typed into the terminal emulator.
TE_unlock_keyboard
Unlocks the keyboard of a mainframe terminal
TE_wait_cursor
Waits for the cursor to appear at a specified location in the terminal window.
TE_wait_silent
Waits for the client application to be silent for a specified number of seconds.
TE_wait_sync
Waits for the system to return from X-SYSTEM or Input Inhibited mode.
TE_wait_sync_transaction
Records the time that the system remained in the most recent X SYSTEM mode.
TE_wait_text
Waits for a string to appear in a designated location.

Wednesday, 4 February 2015

Error No match found for the requested parameter 'ParameterName'

When replaying Web script with a correlation statement, the user receives the following error:

"No match found for the requested parameter 'ParameterName'. If the data you want to save exceeds xx bytes, use web_set_max_html_param_len to increase the parameter size."

Even though the user tries to increase the size for web_set_max_html_param_len, it does not help. What will be a good number for this parameter, and what is the maximum value?

Diagnosis:

When replaying a script with a correlated value, the replay engine will return the above error when there is no match found for the predefined boundaries on the correlation statement. The following information from the error message: If the data you want to save exceeds xx bytes, use web_set_max_html_param_len to increase the parameter size

The above is just a suggestion to try, it may not be a solution. This suggestion should be taken, only if the expected data is over xx bytes.


Solution:

Dealing with web_set_max_html_param_len

1. Find out the size of the data you are trying to retrieve. If it is over 256 bytes, increase this value. Correlation will fail if you try to retrieve a string whose length exceeds the maximum length specify by web_set_max_html_param_len.

Note:
The maximum length for web_set_max_html_param_len is maximum value of unsigned int, which is equal to 4294967295 bytes. If the data you want to save exceed this boundary, you will need to create multiple correlation statements for retrieving the entire dataset.However it is not recommended that such a big value be used and that a value closer to the maximum paramter length expected should be used.

2. If the data you want to save do not exceed the bytes specify in the function, you should focus on finding the correct boundaries or placing the correlation function on the correct place.