Tuesday, April 10, 2012

Important functions to be used with array parameters

You can find certain cases in your testing where you need to correlate parameter values in arrays. i.e. When server returns a list of values or a table
If we want only first value from this parameter array then there is no need to go for array and no need to use "ORD=ALL", we can get the value by providing boundaries and "ORD=1" but if we have certain cases where we not to take value from any specified location within array (i.e. Third value from the array). Also we might have top choose ant random value from the array.

These are some inbuilt function comes with LR which can be used with array variables and can fulfill our need.

int arrSize;

char * FlightVal;

web_reg_save_param("outFlightVal", "LB=outboundFlight value=", "RB=>",  "ORD=ALL",  "SaveLen=18",  LAST ); 


    web_submit_form("reservations.pl",

        "Snapshot=t4.inf",

        ITEMDATA,

        "Name=depart", "Value=London", ENDITEM,

        "Name=departDate", "Value=11/20/2003", ENDITEM,

        "Name=arrive", "Value=New York", ENDITEM,

        "Name=returnDate", "Value=11/21/2003", ENDITEM,

        "Name=numPassengers", "Value=1", ENDITEM,

        "Name=roundtrip", "Value=<OFF>", ENDITEM,

        "Name=seatPref", "Value=None", ENDITEM,

        "Name=seatType", "Value=Coach", ENDITEM,

        "Name=findFlights.x", "Value=83", ENDITEM,

        "Name=findFlights.y", "Value=16", ENDITEM,

        LAST );

// The result of the web_reg_save_param having been called before the web_submit_form is:

Notify: Saving Parameter "outFlightVal_1 = 230;378;11/20/2003"

Notify: Saving Parameter "outFlightVal_2 = 231;337;11/20/2003"

Notify: Saving Parameter "outFlightVal_3 = 232;357;11/20/2003"

Notify: Saving Parameter "outFlightVal_4 = 233;309;11/20/2003"

Notify: Saving Parameter "outFlightVal_count = 4" 
  
arrSize = lr_paramarr_len("outFlightVal");

FlightVal = lr_paramarr_idx("outFlightVal", arrSize); 
FlightVal = lr_paramarr_random("outFlightVal");

lr_paramarr_len is used to get the length of the parameter array.
lr_paramarr_idx is used to get the value from the specified location from array (in FlightVal = lr_paramarr_idx("outFlightVal", arrSize);  We are taking last value from the parameter array and storing it into FlightVal )
lr_ paramarr_random is used to retrieve value from any random index of the array (FlightVal = lr_paramarr_random("outFlightVal");  This will retrieve value from any randon index of the array and will store this value in FlightVal )

JAR, WAR and EAR Files

While working on Flex based application, JAR files plays a key role to the generate the understandable body which doesn't compasses binary values.
We ask from the development team or from the data teams for application specific JAR files, those files can be given to us in any form like JAR, WAR or EAR files.

JAR: These files are with the .jar extension. The .jar files contain the libraries, resources and accessories files like property files.
Files with a .jar extension are intended to hold generic libraries of Java classes, resources, auxiliary files, etc.
JAR files (Java ARchive) allows aggregating many files into one, it is usually used to hold Java classes in a library. i.e. Math.jar

WAR:  These files are with the .war extension. The war file contains the web application that can be deployed on the any servlet/jsp container. The .war file contains jsp, html, javascript and other files for necessary for the development of web applications.
War files (files with a .war extension) are intended to contain complete Web applications. In this context, a Web application is defined as a single group of files,classes, resources, .jar files that can be packaged and accessed as one servlet context.

EAR:   Ear files (files with a .ear extension) are intended to contain complete enterprise applications. In this context, an enterprise application is defined as a collection of .jar files, resources, classes, and multiple Web applications. Each type of file (.jar, .war, .ear) is processed uniquely by application servers, servlet
containers, EJB containers, etc.
EAR files (Enterprise ARchive) combines JAR and WAR files to make a combined archive for Enterprise Applications.

Setting the Run-Time-Settings programmatically

Is it possible to programmatically set the Run-Time Settings through VuGen scripts instead of using the Run-Time Settings dialog box.
We have variety of functions available with LR which can be used to fulfill this purpose.

1. lr_set_debug_message:    Run-Time Settings -> Log

2. lr_think_time:    Run-Time Settings -> Think time
 
3. lr_continue_on_error:    Run-Time Settings -> Miscellaneous -> Error handling -> Continue on error

·     4. When working with RTE Vusers, you can control error handling for specific functions. You insert an lr_continue_on_error(0); statement before the function whose behavior you want to change. The Vuser uses the new setting until the end of the script execution or until another lr_continue_on_error statement is issued. 

      For example, if you enable the Continue on Error feature and the Vuser encounters an error during replay of the following script segment, it continues executing the script.

TE_wait_sync();
TE_type(...);

To instruct the Vuser to continue on error for the entire script, except for the following segment, select the Continue on Error option and enclose the segment with lr_continue_on_error statements, using 0 to turn off Continue on Error and 1 to turn it back on:

lr_continue_on_error(0);
TE_wait_sync();
lr_continue_on_error(1);

5. web_set_sockets_option("PROXY_INITIAL_BASIC_AUTH", "0")
To instruct the Vusers to wait for the proxy response during replay, and not to assume that the proxy supports basic authentication

  
 6. web_set_timeout :   Run-Time Settings -> Preferences -> Option -> Connect/Receive/Step Download timeout

7. web_enable_keep_alive:    Run-Time Settings -> Preferences -> Option -> Keep-Alive HTTP connection
 
8. web_set_max_retries :   Run-Time Settings -> Miscellaneous -> Error handling -> Run-Time Settings -> Preferences -> Option -> Max number of <META refresh> to the same page

9. ctrx_set_waiting_time:    Run-Time Settings -> Timing -> Connect timeout

Some additional Run-Time-Settings

10. lr_abort:    Aborts Vuser script execution.
 
11. lr_disable_ip_spoofing:    Disables IP Spoofing.
 
12. lr_enable_ip_spoofing:    Enables IP Spoofing.

13. lr_exit:    Exits from the script, action, or iteration.

14. lr_rendezvous:    Sets a rendezvous point in a Vuser script.
 
15. lr_rendezvous_ex:    Sets a rendezvous point in a Vuser script.