Wednesday, 18 July 2018

JMeter Remote/Distributed testing

One instance of the JMeter GUI client can control any number of remote JMeter instances, and collect all the data from them. This offers the following features.

. Saving of test samples to a local machine.
. Management of multiple JMeter Engines from a single machine.

Steps to be followed:

1. Save a copy of JMeter (same version as console) to all the remote generators.
2. Modify the JMeter Properties file: 'jmeter.properties'
   Add the IP Address of load generators as remote hosts.
   Find the property named, "remote_hosts", and addthe value of your running JMeter server's IP address. Multiple such servers can be added, comma-delimited.
   E.g. remote_hosts=192.168.0.10,192.168.0.11,192.168.0.12,192.168.0.13,192.168.0.14
3. Start all the Remote Servers and open server batch file on all the Load Generators, it should opens two DOS windows appearing with 'rmiregistry.exe' and 'cmd.exe'.
4. Record the script to be executed or open the jmx file to be run for remote testing.
5. Change the thread group name to 'ThreadGroup_MachineName' using MachineName function to distinguish the threads of different machines
6. Use the 'Remote start' option to start a particular remote machine or use 'remote start all' option to start all the remote machines added as remote hosts in the properties file.
7. Use "Remote Stop' option to stop a particular remote machine and use 'Remote Stop All' option to stop all the remote machines.
8. Check the Remote server cmd windows for the respective remote data.
9. Before running the test also give a file name at the Aggregate report to save the output data in a file.




Thanks for reading
 J J J

Most frequently used components

Below are the components that are mostly used in the testing projects.

Test Plan
Thread Group
HTTP Proxy Server

Samplers
. HTTP Requests

Logic Controllers
. Simple Controller
. Loop Controllers
. Once Only Controller
. Interleave Controller
. If Controller
. Transaction Controller

Listeners
. Assertion Results
. Aggregate Reports

Configuration Elements
. HTTP Authorization Manager
. HTTP Cookie Manager

Assertion
. Response Assertion

Timers
. Constant Timers

Pre Processors
. User Parameters
. Counter

Post_Processors
. Regular Expression Extractor



Thanks for reading
J J J

Monday, 12 October 2015

Parameterization In Jmeter

Parameterization:
Using Parameterization we can execute one test plan for more than one user at the same time. This is a method of generalizing an action for many users.
For Example- If three different people want to search three different keywords then we need to parameterize. So once Jmeter will execute it will take the  first keyword and search then it will take second keyword and then finally it will take last keyword and perform the operation.
 Please follow the instruction to parameterize the simple search in google for three different keywords (Testing, Jmeter, Selenium)
 We are going to parameterize for the search of three keywords – (Jemter, Test, Selenium) in google.

To Parameterize Jmeter please follow the steps give below-

1) Open notepad and type the words-
2) Save page on desktop as search.csv
3) Follow the process and record the script for google search for a single word in Jmeter. Why I am suggesting single word because later we are going to parameterize other words.
Once the script will be recorded the page will look like-
Once the  script will be recorded the page will look like-

4) Now Click on the thread name search and change “q” parameter as ${A}.  ‘A’ we are going to use as a Variable to store different parameters for the search.
Please refer the screen shot-


After Replacement-



5) Now right click on the thread search and add CSV Data Set Config.
 Right Click on search thread–> Add–> Config Element–> CSV Data Set Config.




Once CSV Data Set Config page is added we need to configure-
 Filename- This is the name of the file where you are going to save the different search words. (Don’t worry I will make you easy to understand in next few steps.)
 Variable Names- This is the name of the variable where we will store the search data during running the script.
 Stop thread on EOF- Once search will be completed the thread will get stopped automatically.
So now I am going to configure these fields-
Filename- search.csv
Variable Names- A
Stop thread on EOF- True



6) Click on Thread Group and change Number of Threads as 3 and Ramp-Up Period as 3. I am suggesting to make it 3 because we are going to search 3 key words. Or you can say we are going to user 3 users to search each keywords.


Here we are done with all the configurations.
You can add some listeners to view the result by right clicking on thread group. I am going to add listener as Summary Report.
Now just press Ctrl+s to save the jmeter script and run the script by pressing Ctrl+r  and see the magic.

J J J

Sunday, 11 October 2015

Regular Expression Extractor

What is correlation and why it is required?

Correlation is the most important aspect of scripting. It generally includes fetching dynamic data from preceding requests/calls and posting it to the subsequent requests.

Let's take an example to find out why exactly we need correlation-
Suppose we have recorded a scenario in which -
>User enters login details and click OK button
>Home page opens and user take further actions

Now, if we just playback this script, the test will fail even for a single user. This is because of the authentication mechanism used. When we login to a website, session variables are dynamically created. These session variables are passed to the subsequent requests and help validation and authentication of the actions performed. So, one cannot just record and playback the requests having these variables. Here, we need to correlate the web requests with the dynamic variables. And for correlation, we need to use the "Regular Expression Extractor" which makes use of regular expressions.

Regular Expression Extractor-

Coming back to JMeter, consider an example where we have two operations-
1. User launch website
2. User fill details and click on OK button
Now, the call user launch website creates a dynamic variable event validation that we can check in Response Data tab of "View Result Tree" listener for the call. The value of this variable is then passed to subsequent call related to "User fill details and click on OK button" as Http post parameter.
Steps for correlating the Event validation values-

1. Run the script containing the both the above stated operations
2. Go to Response tab (Text mode) in "View Result Tree" listener of "User launch website" operation. BTW, we see the second operation "User fill details and click on OK button" in red because it is not yet correlated.



3. Create a Regular expression for extracting the value of Event validation variable's value. As stated above the R.E. for this will be- __EVENTVALIDATION" value="(.+?)" />
4. Go to http request under "User Launch Website" transaction controller-> Add -> Post Processor -> Regular Expression Extractor



5. The reference name inserted is the name of the variable created that will capture the Event validation value generated by the http request under "User launch website" operation.
6. Now pass this variable to the subsequent http request under "User fill details and click on OK button" as post request- overriding the already present hardcoded value of Event Validation variable.




7. Run the Test plan again.



J J J

Friday, 14 February 2014

Jmeter - Elements

Samplers (Requests):
 These are the elements that send requests to the servers. There are samplers for these request types:  HTTP/HTTPS, FTP, SOAP, JDBC, ”Java”.

Listeners (Reports):
They collect the results of your runs. You can select among graphical, tabular, single request views. The results can also be saved in a named file.

Timers (Sleep times):
Used to insert delays between the requests. They are needed to make your test more realistic.

Logic Controllers (Logic implementation):
They are like the if-then-else and loop structures in Java or any other programming language.

Configuration Elements (Configuration settings):
They work with samplers by adding common information about the request.

Assertions (Validations):
Let you check if the responses you get contain the expected data.

Pre Processors:
Pre-processors are used to modify the Samplers in their scope


Post Processors:
Post-Processors are applied after samplers.


Thanks for reading
with regards
 J J J