JMeterLogo

An Introduction to Components in JMeter – Part 2 (Series)

In the last post we saw how some of the components in JMeter like Threads (Users), Config Elements and Timers. In this post we are going to discuss on some more important components of JMeter which comes very useful while working with Test Plan creation.

Samplers (Requests)

Samplers are the most important component in JMeter, since we will use it for either creating a new HTTP request or JDBC Request or LDAP Request and many more. Samplers are especially used to make requests

Here are the list of samplers available in JMeter

Figure 1: Sampler

In our last post on Example 2 we saw one of the sampler called HTTP Request. We also created some request on the sampler and tried to work that in conjunction with the config Elements. Let’s see one more example here with JDBC Request.

Example 1 – JDBC Request

Here I am going to execute a Select query from my local database table, hence I need to do the following.

  • Create connectivity with Database Server
  • Create request to execute the query

Creating connectivity with the server need to be done with JDBC Connection Configuration of Config Elements (We will look more about this configuration in later part while working with Stress test plan creation). Then we need to create the actual request to execute the query, this can be done using JDBC request as shown below

Figure 2: JDBC Request

As you can see above in the Test Plan I have created, I have first created the config element and then JDBC Request. With JDBC request, I am just executing a select query. You can also pass parameters and its type in the query from the options in JDBC request window.

Pre and Post Processors (Extractors)

Pre and Post processors are used in conjunction with Samplers (Requests), since processors values are actually consumed by them (Samplers). They are used like Extractors of information used within a request and pass the values to the subsequent requests.

Here are the types of Processors

Figure 3: Pre and Post Processors

PreProcessors are useful while trying to extract some information from request and feed them to the subsequent requests. For example we can extract authentication tokens via Regular Expression Extractor (Post Processor) and then store the token in JMeter variable (${..}) and then we can use the variable in the subsequent requests.

Assertions (Validation)

Assertions are used to verify request’s response, they come handy while working with HTTP request sampler to verify if the request has expected values as shown below

Figure 4: Response Assertions

As you can see from the above screenshot, we have created a Response Assertion within HTTP Request, to check if we have Execute Automation within Head Tag of the page.

Similarly we can perform different kinds of Assertion as shown in the screenshot below

Figure 5: Assertions in JMeter

Listeners (Reporting)

Listeners are used for reporting purpose. We can use Listeners to get different kinds of reports as shown below

Figure 6: Listeners

We will use Listeners a lot in our upcoming stress testing plan of this series.

I hope these two parts on components of JMeter should have given you a basic understanding of components within JMeter.

Please leave your comments and thanks for reading!!!

Thanks,
Karthik KK

 

2 comments

Leave a Reply

Your email address will not be published. Required fields are marked *