Showing posts with label performance testing online. Show all posts
Showing posts with label performance testing online. Show all posts

Wednesday, June 25, 2014

Being / Becoming a Performance Tester


If you wanted to become a performance tester or make your career in performance testing, below are the important characteristics that you need to have:

Common Sense and observation
There are several jobs which do not require applying common sense or minute observation skills. But Performance testing is not definitely one of those. You should have lot of observation as well as common sense.

Jump into the shoes of others:
The performance testing job expects you think from the various perspectives like from the customer / end user point of view, from the business point of view / from the application / technology point of view etc.  While automating the use cases you should think from the end user perspective. When providing a performance test report, you should ensure that the report can be understood for the business analysts as well as the one who owns the entire business. While analyzing the root causes for the performance issues, you should imagine yourself as a technologist.

Willingness to Learn:
Learning performance testing is not one time activity, though the basics remain the same. With the new technologies emerging pretty quickly, as a performance tester you should upgrade yourself to the new technologies and understand the core of them. Continuous learning is the one vital factor that makes a performance tester career prolonged.

The above said are the basic things needed. However, to start your career as a performance tester below is the technical stuff that you should have at least basic understanding about
Operating systems: How operating systems work, the CPU scheduling, memory management, disk management etc
Databases: The tables, queries, joins and indexes and how a query is executed
Computer networks: How the communication between the client and server happens, the TCP, UDP communications, HTTP
Web Application architecture and browser properties: Web, App and DB Servers, the way they work, some important features of web applications like session ID, cookies, request methods and response
Any programming language – You should be good in writing the basic programs with any one programming language

So, if you are considering a career in performance testing, ensure you have all the above said requirements met.

Monday, June 9, 2014

Understanding Randomization in LoadRunner

Randomization is a common practice with majority of the performance test scripts, where dropdown / Radio buttons / Links has to be chosen by the user randomly.

For example the application requires choosing a value from the drop down randomly, then the important thing is to know how many values are there in the drop down and what their values.

We all know the web_reg_save_param() or web_reg_save_param_ex() function has to be used to capture the values. Now, because we need all the values we'll specify the attribute "ORD=ALL" / "Ordinal=all". Assume that the function is written as below:

web_reg_save_param("DropdownValues", "Lb=<option>","rb=</option>", "Ord=all", LAST);

When the above function is executed, LoadRunner creates N+1 LR variables if there are N values in the drop down.

The first drop down value will be saved to an LR variable named "DropdownValues_1" and the second value from the drop down will be save to an LR variable named "DropdownValues_2" and so on. The total number of matches / count would be saved to another parameter called "DropdownValues_count".

The function used to choose a random value is lr_paramarr_random(). This function returns an address location of the random parameter.

In our example the function should be used as:

char * randVal;


randVal = lr_paramarr_random("DropdownValues");

As the variable randVal is C string variable, cannot be used in protocol functions,  this has to be converted to an LR parameter using below statement (for details on why, please refer to variable conversion in LoadRunner).
lr_save_string(randVal, "RandDropdownVal");

When lr_paramarr_random("DropdownValues") is seen the script, the script immediately checks if there is a parameter named "DropdownValues_count" and tries to retrieve its value. If this parameter is not available, an error would be thrown.

Assuming that the count is 10, now it generates a random value between 1 -  10 and refers to the corresponding address location. i.e. if the random number is 6, it searches if there is an LR parameter called "DropdownValues_6", if yes,  its address location is returned to the string variable.

If there is no such parameter, it would throw a warning saying that "The string with parameter delimiters is not a parameter"

Hence it is very important to capture all the values using the web_reg_save_param() function with the ORD attribute set to ALL if at all the parameter has to be used for randomization.

In the next article, we will see how we can utilize this behavior in building a custom C function that works similar to web_reg_save_param() with ORD being set to ALL.


Monday, May 19, 2014

in LoadRunner Did you Know?

  • Save the current times tamp in Milli seconds to an LR parameter can be achieved with the function web_save_timestamp_param()
  • web_url() and web_submit_data() are capable of the encoding the form data automatically. But web_custom_request() cannot encode the form data automatically. The encoding can be done by the function web_convert_param()
  • Automation of the windows based web applications (that uses NTLM authentication) uses the web_set_user() function for sending the username and passwords. While replaying the script, it is recommended to use the run time setting Preferences --> Advanced -->WinInet Replay instead of Sockets
  • Reading and writing from the same file can be achieved by Virtual Table Server
  • The function lr_paramarr_random("x") first validates if there is an LR parameter called x_count, if there is no such parameter, it returns an error
  •  The function web_global_verification() works same as the run time setting Content check, except that the global verification can be paused and resumed with the functions web_global_verification_pause() and web_global_verification_resume()

Thursday, May 8, 2014

Variable conversion in LoadRunner

In the last post, I have given an overview on what types of variables are seen in an LR Script and where they should be used.

This article covers on conversion of LR Variables to C Variables and viceversa.  There are three important LR functions used for the conversion. 
We'll  see one at a time.

lr_eval_string()
This function evaluates a load runner variable and returns its value if placed in flower braces. Let us try to understand how it really works.

lr_eval_string("test") returns a string called "test"
lr_eval_string("{test}") - Now this function checks if there is LoadRunner variable called test or not. 
If there is a LoadRunner variable named test and its value is "Welcome". Now the function lr_eval_string("{test}") returns a string "Welcome"

If no LoadRunner variable exists with the name test, then the function lr_eval_string("{test}") returns a string "{test}"

Now let us see two more last example of lr_eval_string() function:

Assumption: There is an LR variable called test whose value is "{Welcome}". There is another LR variable called Welcome whose value is "Performance Testing Online".

lr_eval_string("{test}") - This returns a string "{Welcome}"
lr_eval_string() function does not do nested evaluation

lr_eval_string(lr_eval_string("{test}"))
 = lr_eval_string("{Welcome}");
 = "Performance Testing Online"

LR to C String
Now that you understand the usage of lr_eval_string() function let us see how we can convert an LR Variable to C string variable.

char CStr[100];

to save "Performance Testing Online" into the string variable CStr, the syntax is:

strcpy(CStr, lr_eval_string(lr_eval_string("{test}")));

Please note that an equal symbol (=) cannot be used to assign a value to a string variable. We will have a separate article on why.

So, the conclusion is, to save an LR value to a C string variable, the lr_eval_string() function is used.

Now let us see, how we can convert an LR Parameter to C integer variable
 
let us assume that the LR variable test stores a value of "10".

LR to C Integers
This value should be converted to a string format first using lr_eval_string() function. This function returns a string value. To convert a string value into an integer, we have C function called atoi() read it as A to I (meaning alphabets to Integers)

int Count;

Count = atoi(lr_eval_string("{test}"));

This is how a value in LR variable is saved to a C variable. Though the heading says converting an LR variable to C variable, in fact we are storing the value of an LR variable into a C variable.

Now let us see the otherway i.e. converting a C integer / String to an LR parameter.

we have two functions named lr_save_string() and lr_save_int() to save a string and integer values to an LR parameter respectivily.

C to LR
int i = 256;

lr_save_int(i, "Total"); 

Now Total is an LR variable which stored a value of 256 in it. Inside the web_url() or web_submit_data or web_custom_request it can be used as {Total}

char Text[100] = "Welcome to Performance Testing Online";

lr_save_string(text, "Status");
Now Status is an LR variable which stored the entire string in it. In a web request it should be used as {Status}


I hope this article is informative and helpful.  If you have any questions, please feel free to comment.


Thanks,
Ram N