Sunday, March 8, 2015

Lr_Content Check_v0.1

LoadRunner provides at least 4 ways to ensure to that  response we get meets our expectation. 

Web_reg_find. This function has to be placed before the request which needs to be validated for right response. Web Reg Find has got lot of attributes which can help us to find the right text. It is basically a service function of LR. This functions scans the entire server response to check if the required text is present or not. It can also be inserted while recording the business flow with LoadRunner.
Web Global Verification : This function is similar to web reg find function with only difference that it searches the text in every subsequent response received for each request. If the text is found, then required action is taken. It is global in scope and applies for entire script.
Content Checks : LoadRunner provides the mechanism for validating the response for right content. Content checks can be enabled from the run time setting of the LoadRunner scripts. Once enabled and when script is ran, setting are directly loaded along with script in the LG’s ram. This speeds up the execution time of the script.
Correlation Functions : Web reg save functions can also be used for text checks in certain cases.

 

Load Runner Content Check

If you are using a web-based vuser type, you can configure your LoadRunner script to search through all returned pages for strings that match known error messages. Using web_reg_find functions is fine, but when you get an error LoadRunner reports it as “failed to find text” instead of something more descriptive.

  • Ask your developers for a list of all the error messages that the application can throw. This should be easy for them to provide if the application is well designed and stores all the message in some kind of message repository instead of sprinkling them throughout the source code.
  • Include error message for functional errors that you are likely to encounter. Creating a rule for “incorrect username or password” may save someone 20 minutes of investigation when they first run the script after the database has been refreshed.

If you prefer to have error message you are checking for in the script (where you can add comments to them) instead of the runtime settings, you can use the web_global_verification function instead. The only difference between the two is the error message that LoadRunner will include in its log:
Action. c(737): Error -26368: “Text=A runtime error occurred” found for web_global_verification (“ARuntimeErrorOccurred”) (count=1), Snapshot Info [MSH 0 21]
…compared to:
Action. c(737): Error -26372: ContentCheck Rule “ARuntimeErrorOccurred” in Application “Webshop” triggered. Text “A runtime error occurred” matched (count=1), Snapshot Info [MSH 0 21]
And finally, ContentCheck rules can be easily exported and shared between scripts, which can be a nice time-saver.

References: 1). myloadtest. com  2). easyloadrunner. blogspot. in 3). softwareworker. wordpress. com
 
Note: Some of the articles are grab from various Websites / Blogs.

L.R_Functions_v2



Below is a list of general API functions for ANSI C scripts. It includes all protocols except for Java, VB, and GUI:

Transaction Functions:

1. lr_end_sub_transaction --> Marks the end of a sub-transaction for performance analysis.

2. lr_end_transaction --> Marks the end of a transaction.

3. lr_end_transaction_instance --> Marks the end of a transaction instance for performance analysis.

4. lr_fail_trans_with_error --> Sets the status of open transactions to LR_FAIL and sends an error message.

5. lr_get_trans_instance_duration --> Gets the duration of a transaction instance specified by its handle.

6. lr_get_trans_instance_wasted_time --> Gets the wasted time of a transaction instance by its handle.

7. lr_get_transaction_duration --> Gets the duration of a transaction by its name.

8. lr_get_transaction_think_time --> Gets the think time of a transaction by its name.

9. lr_get_transaction_wasted_time --> Gets the wasted time of a transaction by its name.

10. lr_resume_transaction --> Resumes collecting transaction data for performance analysis.

11. lr_resume_transaction_instance --> Resumes collecting transaction instance data for performance analysis.

12. lr_set_transaction_instance_status --> Sets the status of a transaction instance.

13. lr_set_transaction_status --> Sets the status of open transactions.

14. lr_set_transaction_status_by_name --> Sets the status of a transaction.

15. lr_start_sub_transaction --> Marks the beginning of a subtransaction.

16. lr_start_transaction --> Marks the beginning of a transaction.

17. lr_start_transaction_instance --> Starts a nested transaction specified by its parent’s handle.

18. lr_stop_transaction --> Stops the collection of transaction data.

19. lr_stop_transaction_instance --> Stops collecting data for a transaction specified by its handle.

20. lr_wasted_time --> Removes wasted time from all open transactions.

Command Line Parsing Functions:

1. lr_get_attrib_double --> Retrieves a double type variable used on the script command line.

2. lr_get_attrib_long --> Retrieves a long type variable used on the script command line.

3. lr_get_attrib_string --> Retrieves a string used on the script command line.

Informational Functions:

1. lr_user_data_point --> Records a user-defined data sample.

2. lr_whoami --> Returns information about a Vuser to the Vuser script. Not applicable for Application Management.

3. lr_get_host_name --> Returns the name of the host executing the Vuser script.

4. lr_get_master_host_name --> Returns the name of the machine running the LoadRunner Controller or Tuning Console. Not applicable for Application Management.

String Functions:

1. lr_eval_string --> Replaces a parameter with its current value.

2. lr_save_string --> Saves a null-terminated string to a parameter.

3. lr_save_var --> Saves a variable length string to a parameter.

4. lr_save_datetime --> Saves the current date and time to a parameter.

5. lr _advance_param --> Advances to the next available parameter.

6. lr _decrypt --> Decrypts an encoded string.

7. lr_eval_string_ext --> Retrieves a pointer to a buffer containing parameter data.

8. lr_eval_string_ext_free --> Frees the pointer allocated by lr_eval_string_ext.

9. lr_save_searched_string --> Searches for an occurrence of string in a buffer and saves a portion of the buffer, relative to the string occurrence, to a parameter.

Message Functions:

1. lr_debug_message --> Sends a debug message to the Output window or the Business Process Monitor log files.

2. lr_error_message --> Sends an error message to the Output window or the Business Process Monitor log files.

3. lr_get_debug_message --> Retrieves the current message class.

4. lr_log_message --> Sends a message to a log file.

5. lr_output_message --> Sends a message to the Output window or the Business Process Monitor log files.

6. lr_set_debug_message --> Sets a debug message class.

7. lr_vuser_status_message --> Generates and prints formatted output to the Controller or Console Vuser status area. Not applicable for Application Management.

8. lr_message --> Sends a message to the Vuser log and Output window or the Business Process Monitor log files.

Run-Time Functions

1. lr_load_dll --> Loads an external DLL.

2. lr_peek_events --> Indicates where a Vuser script can be paused.

3. lr_think_time --> Pauses script execution to emulate think time—the time a real user pauses to think between actions.

4. lr_continue_on_error --> Specifies an error handling method.

5. lr_rendezvous --> Sets a rendezvous point in a Vuser script. Not applicable for Application Management.

References: 1). softwaretestingstuff.com 2). myloadtest.com  3). easyloadrunner.blogspot.in

Note: Some of the articles are grab from various Websites / Blogs.

Friday, March 6, 2015

Performance Testing_Q's and Ans_Part-II




What is a function to capture dynamic values in the web Vuser script? Web_reg_save_param function saves dynamic data information to a parameter.
 When do you disable log in Virtual User Generator, When do you choose standard and extended logs?
Once we debug our script and verify that it is functional, we can enable logging for errors only. When we add a script to a scenario, logging is automatically disabled.
Standard Log Option: When you select Standard log, it creates a standard log of functions and messages sent during script execution to use for debugging. Disable this option for large load testing scenarios. When you copy a script to a scenario, logging is automatically disabled
Extended Log Option: Select extended log to create an extended log, including warnings and other messages. Disable this option for large load testing scenarios. When you copy a script to a scenario, logging is automatically disabled. We can specify which additional information should be added to the extended log using the Extended log options.
How do you debug a LoadRunner script?
VuGen contains two options to help debug Vuser scripts-the Run Step by Step command and breakpoints. The Debug settings in the Options dialog box allow us to determine the extent of the trace to be performed during scenario execution. The debug information is written to the Output window. We can manually set the message class within your script using the lr_set_debug_message function. This is useful if we want to receive debug information about a small section of the script only.
How do you write user defined functions in LR? Give me few functions you wrote in your previous project?
Before we create the User Defined functions we need to create the external library (DLL) with the function. We add this library to VuGen bin directory. Once the library is added then we assign user defined function as a parameter. The function should have the following format: __declspec (dllexport) char* <function name>(char*, char*)Examples of user defined functions are as follows:GetVersion, GetCurrentTime, GetPltform are some of the user defined functions used in my earlier project.
What are the changes you can make in run-time settings?
a) Pacing - It has iteration count.
b) Log - Under this we have Disable Logging Standard Log and
c) Extended Think Time - In think time we have two options like Ignore think time and Replay think time.
d) General - Under general tab we can set the vusers as process or as multithreading and whether each step as a transaction.
Where do you set Iteration for Vuser testing? We set Iterations in the Run Time Settings of the VuGen. The navigation for this is Run time settings, Pacing tab, set number of iterations.
How do you perform functional testing under load? Functionality under load can be tested by running several Vusers concurrently. By increasing the amount of Vusers, we can determine how much load the server can sustain.
What is Ramp up? How do you set this? This option is used to gradually increase the amount of Vusers/load on the server. An initial value is set and a value to wait between intervals can be
specified. To set Ramp Up, go to ‘Scenario Scheduling Options’
What is the advantage of running the Vuser as thread? VuGen provides the facility to use multithreading. This enables more Vusers to be run per generator. If the Vuser is run as a process, the same driver program is loaded into memory for each Vuser, thus taking up a large amount of memory. This limits the number of Vusers that can be run on a single generator. If the Vuser is run as a thread, only one instance of the driver program is loaded into memory for the given number of Vusers (say 100). Each thread shares the memory of the parent driver program, thus enabling more Vusers to be run per generator.

If you want to stop the execution of your script on error, how do you do that?
The lr_abort function aborts the execution of a Vuser script. It instructs the Vuser to stop executing the Actions section, execute the vuser_end section and end the execution. This function is useful when you need to manually abort a script execution as a result of a specific error condition. When you end a script using this function, the Vuser is assigned the status "Stopped". For this to take effect, we have to first uncheck the “Continue on error option in Run-Time Settings.  

What is the relation between Response Time and Throughput?
The Throughput graph shows the amount of data in bytes that the Vusers received from the server in a second. When we compare this with the transaction response time, we will notice that as throughput decreased, the response time also decreased. Similarly, the peak throughput and highest response time would occur approximately at the same time.
Explain the Configuration of your systems?
The configuration of our systems refers to that of the client machines on which we run the Vusers. The configuration of any client machine includes its hardware settings, memory, operating system, software applications, development tools, etc. This system component configuration should match with the overall system configuration that would include the network infrastructure, the web server, the database server, and any other components that go with this larger system so as to achieve the load testing objectives.
How do you identify the performance bottlenecks?
Performance Bottlenecks can be detected by using monitors. These monitors might be application server monitors, web server monitors, database server monitors and network monitors. They help in finding out the troubled area in our scenario which causes increased response time. The measurements made are usually performance response time, throughput, hits/sec, network delay graphs, etc.
If web server, database and Network are all fine where could be the problem?
The problem could be in the system itself or in the application server or in the code written for the application.
How did you find web server related issues?
Using Web resource monitors we can find the performance of web servers. Using these monitors we can analyze throughput on the web server, number of hits per second that
occurred during scenario, the number of http responses per second, the number of downloaded pages per second.
How did you find database related issues?
By running Database monitor and help of Data Resource Graph we can find database related issues. E.g. You can specify the resource you want to measure on before running the controller and then you can see database related issues
What is the difference between Overlay graph and Correlate graph? Overlay Graph:
It overlay the content of two graphs that shares a common x-axis. Left Y-axis on the merged graph show the current graph value & Right Y-axis show the value of Y-axis of the graph that was merged. 
Correlate Graph: Plot the Y-axis of two graphs against each other. The active graph Y-axis becomes X-axis of merged graph. Y-axis of the graph that was merged becomes merged graph Y-axis.
How did you plan the Load? What are the Criteria?
Load test is planned to decide the number of users, what kind of machines we are going to use and from where they are run. It is based on 2 important documents, Task Distribution Diagram and Transaction profile. Task Distribution Diagram gives us the information on number of users for a particular transaction and the time of the load. The peak usage and off-usage are decided from this Diagram. Transaction profile gives us the information about the transactions name and their priority levels with regard to the scenario we are deciding.
What does vuser_init action contain?
Vuser_init action contains procedures to login to a server.
What does vuser_end action contain? Vuser_end section contains log off procedures.  
What is think time? How do you change the threshold?   Think time is the time that a real user waits between actions. Example: When a user receives data from a server, the user may wait several seconds to review the data before responding. This delay is known as the think time. Changing the Threshold: Threshold level is the level below which the recorded think time will be ignored. The default value is five (5) seconds. We can change the think time threshold in the Recording options of the Vugen.
What is the difference between standard log and extended log?
The standard log sends a subset of functions and messages sent during script execution to a log. The subset depends on the Vuser type Extended log sends a detailed script execution messages to the output log. This is mainly used during debugging when we want information about: Parameter substitution. Data returned by the server. Advanced trace.
Explain the following functions: -
lr_debug_message – The lr_debug_message function sends a debug message to the output log when the specified message class is set.
lr_output_message - The lr_output_message function sends notifications to the Controller Output window and the Vuser log file.
lr_error_message - The lr_error_message function sends an error message to the LoadRunner Output window.
lrd_stmt - The lrd_stmt function associates a character string (usually a SQL statement) with a cursor. This function sets a SQL statement to be processed.
lrd_fetch - The lrd_fetch function fetches the next row from the result set.

Throughput -  If the throughput scales upward as time progresses and the number of Vusers increase, this indicates that the bandwidth is sufficient.

If the graph were to remain relatively flat as the number of Vusers increased, it would
be reasonable to conclude that the bandwidth is constraining the volume of
data delivered. 
Types of Goals in Goal-Oriented Scenario -  Load Runner provides you with five different types of goals in a goal oriented scenario:
  • The number of concurrent Vusers
  • The number of hits per second
  • The number of transactions per second
  • The number of pages per minute
  • The transaction response time that you want your scenario
Analysis Scenario (Bottlenecks): In Running Vuser graph correlated with the response time graph you can see that as the number of Vusers increases, the average response time of the check itinerary transaction very gradually increases. In other words, the average response time steadily increases as the load
increases. At 56 Vusers, there is a sudden, sharp increase in the average response
time. We say that the test broke the server. That is the mean time before failure (MTBF). The response time clearly began to degrade when there were more than 56 Vusers running simultaneously.
What is correlation? Explain the difference between automatic correlation and manual correlation?
Correlation is used to obtain data which are unique for each run of the script and which are generated by nested queries. Correlation provides the value to avoid errors arising out of duplicate values and also optimizing the code (to avoid nested queries). Automatic correlation is where we set some rules for correlation. It can be application server specific. Here values are replaced by data which are created by these rules. In manual correlation, the value we want to correlate is scanned and create correlation is used to correlate.
Where do you set automatic correlation options?
Automatic correlation from web point of view, can be set in recording options and correlation tab. Here we can enable correlation for the entire script and choose either issue online messages or offline actions, where we can define rules for that correlation.  Automatic correlation for database, can be done using show output window and scan for correlation and picking the correlate query tab and choose which query value we want to correlate. If we know the specific value to be correlated, we just do create correlation for the value and specify how the value to be created.
What is a function to capture dynamic values in the web vuser script? Web_reg_save_param function saves dynamic data information to a parameter.

References: 1). careerride.com 2) techinterviews.com
Note: Some of the articles are grab from various Websites / Blogs.