<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ujwalabothe</title>
    <description>The latest articles on DEV Community by ujwalabothe (@ujwalabothe).</description>
    <link>https://dev.to/ujwalabothe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1132451%2F3994388c-b668-4083-b2e4-5ba58a2a3edb.png</url>
      <title>DEV Community: ujwalabothe</title>
      <link>https://dev.to/ujwalabothe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ujwalabothe"/>
    <language>en</language>
    <item>
      <title>Jmeter and Listener</title>
      <dc:creator>ujwalabothe</dc:creator>
      <pubDate>Mon, 04 Sep 2023 11:00:41 +0000</pubDate>
      <link>https://dev.to/ujwalabothe/jmeter-and-listener-3c4p</link>
      <guid>https://dev.to/ujwalabothe/jmeter-and-listener-3c4p</guid>
      <description>&lt;p&gt;As a &lt;strong&gt;Senior QA Automation professional at Luxoft&lt;/strong&gt;, I have had the opportunity to work extensively on projects using listeners in JMeter. I aim to provide beginners and individuals seeking a deeper understanding with valuable insights into leveraging listeners in JMeter.&lt;/p&gt;

&lt;p&gt;Listener allows us to view and analyze the Sampler request and response in the form of tables, graphs, trees etc. You can also save results in a file and read saved results later. You can access the sampler result in an ongoing load/stress test without waiting till end.&lt;/p&gt;

&lt;p&gt;A listener can be added anywhere in the test plan e.g under thread group or sampler based on test scenarios. It will gather data only from elements defined in its scope and create a report/graph based on that. All listeners use the same data and result for generating the report/graph only difference is the visualization or the way the represent on GUI .&lt;/p&gt;

&lt;p&gt;The list of listeners is as follows:&lt;/p&gt;

&lt;p&gt;Aggregate Graph&lt;br&gt;
Aggregate Report&lt;br&gt;
Assertion Results&lt;br&gt;
Backend Listener&lt;br&gt;
BeanShell Listener&lt;br&gt;
BSF Listener&lt;br&gt;
Comparison Assertion Visualizer&lt;br&gt;
Generate Summary Results&lt;br&gt;
Graph Results&lt;br&gt;
JSR223 Listener&lt;br&gt;
Mailer Visualizer&lt;br&gt;
Monitor Results&lt;br&gt;
Response Time Graph&lt;br&gt;
Saves Responses to a file&lt;br&gt;
Simple Data Writer&lt;br&gt;
Summary Report&lt;br&gt;
View Results in Table&lt;br&gt;
View Results Tree&lt;/p&gt;

&lt;p&gt;Most popular listeners are&lt;/p&gt;

&lt;p&gt;–Graph Results&lt;/p&gt;

&lt;p&gt;–View Result Tree&lt;/p&gt;

&lt;p&gt;Let’s have a look at some common types of Listeners, before that lets setup basic test plan for all listernsers .&lt;/p&gt;

&lt;p&gt;First, we need to create a Test Plan in JMeter. Now add the Thread Group inside the Test Plan.&lt;/p&gt;

&lt;p&gt;After creating Thread now we need to add the sampler, here we added an HTTP request sampler as shown in the following screenshot as follows.&lt;/p&gt;

&lt;p&gt;Provide protocal as “https” .&lt;/p&gt;

&lt;p&gt;Server Name as “reqres.in” — dummy API end point .&lt;/p&gt;

&lt;p&gt;Http request as “GET” .&lt;/p&gt;

&lt;p&gt;Path as “api/users” .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FgCT4fuI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/immu5i6jufztjf5tjh93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FgCT4fuI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/immu5i6jufztjf5tjh93.png" alt="Image description" width="720" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As mentioned previously listener can be placed anywhere or at any level&lt;/p&gt;

&lt;p&gt;Test plan level&lt;br&gt;
Test plan level listener scope is throughout the test plan. this listener will be for all thread groups as well as for all sampler requests.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dPf66GKW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5jlmribqtdj64n9n0sz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dPf66GKW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5jlmribqtdj64n9n0sz.png" alt="Image description" width="720" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Thread group level :&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thread group level listener scope is throughout specific thread group where it is added. This listener will be for a specific thread group as well as for all sampler requests under that thread group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lQPw8NU3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8qcz0hkdthykk8my21n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lQPw8NU3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8qcz0hkdthykk8my21n.png" alt="Image description" width="720" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sampler level&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sampler-level listener scope is throughout specific sampler requests where it is added. This listener will be for a specific sampler request only.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jKiJeObo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9yklbusrne81ngiqkq8o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jKiJeObo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9yklbusrne81ngiqkq8o.png" alt="Image description" width="720" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;View Report Tree:&lt;/strong&gt;&lt;br&gt;
View Results Tree displays a tree consisting of all the Sampler responses along with their requests.&lt;/p&gt;

&lt;p&gt;Please Note that the View Results Tree should not be used during the Load/Stress test as it consumes a lot of resources like memory and CPU. It is recommended to use it for functional testing or debugging purposes.&lt;/p&gt;

&lt;p&gt;Add View Report : Go to test plan &amp;gt; right click &amp;gt; Add &amp;gt; Listener &amp;gt; View Result Tree&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ENtjOTMK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ww0xzlnlpuoqnxw956g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ENtjOTMK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ww0xzlnlpuoqnxw956g.png" alt="Image description" width="720" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the test plan to see View Result report .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FwYQzOuc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwnkjngrz44xdigz8lf2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FwYQzOuc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwnkjngrz44xdigz8lf2.png" alt="Image description" width="720" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine you’re running a race with multiple checkpoints. Each checkpoint represents a different action your computer is simulating, like sending a request to a website. The “View Results in Table” listener is like a scorecard that keeps track of how well each action performs.&lt;/p&gt;

&lt;p&gt;Here’s what you’ll see in this scorecard:&lt;/p&gt;

&lt;p&gt;Sample Number: This is like the order in which the actions were performed, so you know which one happened first, second, and so on.&lt;br&gt;
Thread Name: Think of this as the name of the player (or runner) performing the actions. It helps you know which part of your test is responsible for each action.&lt;br&gt;
Sample Label: Just like giving a name to each checkpoint, this label tells you what kind of action was performed, such as visiting a certain web page.&lt;br&gt;
Sample Time: This is how long it took for that specific action to finish, from start to finish.&lt;br&gt;
Start Time: When the action was started.&lt;br&gt;
Load Time: The time the server took to do its work and send back the response.&lt;br&gt;
Latency: Time between when you start and when you got the first response.&lt;br&gt;
Idle Time: waiting timing for the response once action is finished&lt;br&gt;
Sample Count: count of samples or no of threads&lt;br&gt;
Error Count: The number of times the action ran into a problem.&lt;br&gt;
Summary Report :&lt;br&gt;
The summary report creates a table row for each differently named request in your test.&lt;/p&gt;

&lt;p&gt;run the test plan and get the summary report as below based on sampler name&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eh6LBcsI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f5pdkcvsmb9inru4s67z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eh6LBcsI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f5pdkcvsmb9inru4s67z.png" alt="Image description" width="720" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Label ::Label is created based on sampler name e.g HTTP Request 1 and HTTP Request 2 . If the sampler names are similar then request 1 result will append the request 2 results instead of created two different labels .&lt;/p&gt;

&lt;h1&gt;
  
  
  Samples : No of thread denotes number of sampler for the sampler request .
&lt;/h1&gt;

&lt;h1&gt;
  
  
  samples= No of threads * loop count = 10*10 =100 samples
&lt;/h1&gt;

&lt;p&gt;Average: It gives the time for avg samplers to execute the test plan&lt;/p&gt;

&lt;p&gt;Min: It gives the minimum value a sampler request has taken to complete out during the execution of the sampler based on loop and thread count. ( out of 100 samplers)&lt;/p&gt;

&lt;p&gt;Max: It gives the maximum value a sampler request has taken to complete out during the execution of the sampler based on loop and thread count. ( out of 100 samplers)&lt;/p&gt;

&lt;p&gt;Std Dev : The “Std. Dev.” column provides an indication of how much individual response times deviate from the average&lt;/p&gt;

&lt;p&gt;Error %: This column will give you error percentage&lt;/p&gt;

&lt;p&gt;Throughput : Throughput measures how many actions a system can handle in a given time, indicating its processing capacity in performance testing&lt;/p&gt;

&lt;p&gt;Received KB/sec: This measures the rate at which data (in kilobytes) is received by the system from external sources (like users or servers) per second. It reflects how quickly the system is getting data from outside.&lt;/p&gt;

&lt;p&gt;Sent KB/sec: This measures the rate at which data (in kilobytes) is sent from the system to external destinations (like users or servers) per second. It indicates how fast the system is sending out data.&lt;/p&gt;

&lt;p&gt;Avg Bytes : This stands for “Average Bytes.” It’s the average amount of data (in bytes) transferred in each request or response between the system and external sources. It helps understand the typical data size being exchanged&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Aggregate Report&lt;/strong&gt;&lt;br&gt;
Aggregate report shows a separate table row for each differently named sampler request in the test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NZV0rLpj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1m9wf30pz10hetlr4cmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NZV0rLpj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1m9wf30pz10hetlr4cmw.png" alt="Image description" width="720" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the Test plan&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DKfxLpCV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5oq3hyfw3yx1akh8yezj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DKfxLpCV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5oq3hyfw3yx1akh8yezj.png" alt="Image description" width="720" height="191"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backend Listener&lt;/strong&gt;&lt;br&gt;
The “Backend Listener” in JMeter is like a messenger that sends test performance data to a special place for better understanding, similar to sharing race statistics with a friend who records them.&lt;/p&gt;

&lt;p&gt;So, the “Backend Listener” is like your helper to get the test results to a place where you can easily see how your application is handling things, just like your friend helps you keep track of how fast a car goes during a race.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ASzD-vVD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ucjjh3s4e77axuc4k7ap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ASzD-vVD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ucjjh3s4e77axuc4k7ap.png" alt="Image description" width="720" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Aggregate Graphs:&lt;/strong&gt;&lt;br&gt;
Aggregate graphs allow us to generate bar graphs easily and let us select graph display settings. The generated graph and table data can be saved explicitly in the form of PNG and CSV.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FcmqbErt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vchnncln2v2njsgmurqx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FcmqbErt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vchnncln2v2njsgmurqx.png" alt="Image description" width="720" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Assertion Results:&lt;/strong&gt;&lt;br&gt;
Assertion Results displays the results of assertions applied on the Sampler. You can see in the below figure, if any assertion fails it will look like this.&lt;/p&gt;

&lt;p&gt;Please Note that Assertion Results SHOULD NOT BE USED during Load/Stress test as it consumes a lot of resources like memory and CPU. It is recommended to use it with functional testing or debugging purposes.&lt;/p&gt;

&lt;p&gt;To add the assertion where we are asserting response code =400 if not then sampler should be failed&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qH0jR_6p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wlvi4c4lck9qihwtu75w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qH0jR_6p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wlvi4c4lck9qihwtu75w.png" alt="Image description" width="720" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Response assertion or any assertion can be at any level .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UR8hRDzI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/70kvgw03hn0csd4j8gfd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UR8hRDzI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/70kvgw03hn0csd4j8gfd.png" alt="Image description" width="720" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the sampler is failed then you will sampler name followed by a failure message else sampler name only .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0S7jEnu6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j49gfk64bhs6kf4sq1dj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0S7jEnu6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j49gfk64bhs6kf4sq1dj.png" alt="Image description" width="720" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Comparison Assertion Visualizer&lt;/strong&gt;&lt;br&gt;
The “Comparison Assertion Visualizer” in JMeter allows you to compare the responses of two or more requests during a performance test, helping you identify differences and inconsistencies between them. It’s like having a tool that highlights variations in how different parts of your application respond under load.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JQz0VCME--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/djz13s86lpzfg83s8nw1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JQz0VCME--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/djz13s86lpzfg83s8nw1.png" alt="Image description" width="720" height="311"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Generate Summary Results&lt;/strong&gt;&lt;br&gt;
“Generate Summary Results” in JMeter refers to the process of creating a summarized report that provides key performance metrics from a test run. It’s like creating a condensed overview of how well your application performed under specific conditions, offering insights into response times, throughput, error rates, and other important data points.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N0ymBpOf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hd1qy4wzhfdigpfik9bi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N0ymBpOf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hd1qy4wzhfdigpfik9bi.png" alt="Image description" width="720" height="119"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Rest listener will be covered in next article .&lt;/p&gt;

&lt;p&gt;Happy Reading !!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Mastering JSON Extraction in Apache JMeter for Effective API Testing</title>
      <dc:creator>ujwalabothe</dc:creator>
      <pubDate>Wed, 16 Aug 2023 10:43:11 +0000</pubDate>
      <link>https://dev.to/ujwalabothe/mastering-json-extraction-in-apache-jmeter-for-effective-api-testing-11b1</link>
      <guid>https://dev.to/ujwalabothe/mastering-json-extraction-in-apache-jmeter-for-effective-api-testing-11b1</guid>
      <description>&lt;h1&gt;
  
  
  JsonExtraction # Jmeter # Luxoft # APItesting #PerformanceTesting
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Xpath
&lt;/h1&gt;

&lt;p&gt;Working with Luxoft for over a year, I have gained invaluable experience in my 11+ years of overall professional journey. The culture of knowledge sharing at Luxoft not only fosters continuous learning but also plays a vital role in our collective success.&lt;br&gt;
In today’s fast-paced software development industry, ensuring the optimal performance of your product is paramount. However, as the sole tester on your project or even within the entire company, selecting the right performance testing or API  tool can feel overwhelming. With a vast array of options available, making an informed choice is crucial.  I will provide a step-by-step guide to help you become familiar with JMeter and successfully execute your first performance test /API test . &lt;br&gt;
I have had the opportunity to work extensively on performance projects using Jmeter where I have learned and used various JSON and Xpath exactor in my project .&lt;br&gt;&lt;br&gt;
Now, let’s dive into the process of functional testing REST APIs and uncover the power of Apache JMeter in conjunction with a JSON extractor for parsing responses.&lt;/p&gt;

&lt;p&gt;By the end of this blog post, you will have a good understanding of how to perform functional testing on REST APIs with JSON responses using Apache JMeter and leverage the JSON extractor to retrieve and manipulate data efficiently.&lt;/p&gt;

&lt;p&gt;Configure the JSON Extractor in JMeter to extract data from JSON responses. Define JSON Path expressions to target specific elements within the JSON structure, and store the extracted values in variables for later use.&lt;/p&gt;

&lt;p&gt;Understanding JSON and Its Relationship with JMeter:&lt;br&gt;
JSON, short for JavaScript Object Notation, is a widely adopted data format for representing structured information. On the other hand, JMeter is an open-source performance testing tool developed by the Apache Software Foundation, primarily utilized for load testing, stress testing, and performance assessment of web applications. JSON and JMeter are closely intertwined in the context of web services and APIs. Modern web applications often communicate with clients or other services using JSON-formatted data. JMeter comes equipped with built-in support for working with JSON data during performance testing. Let's explore how JSON and JMeter are intertwined:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JSON Extractor:&lt;/strong&gt; JMeter provides a JSON Extractor post-processor element that allows you to extract specific data from JSON responses. With the JSON Extractor, you can define JSON path expressions to extract values from JSON responses and store them in variables for further use in your test scripts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JSON Request:&lt;/strong&gt; JMeter allows you to send HTTP requests with JSON payloads. You can use the HTTP Request sampler to send POST or PUT requests with JSON data as the request body. This is useful for testing APIs that expect JSON data as input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JSON Assertion:&lt;/strong&gt; JMeter provides a JSON Assertion element to validate JSON responses. You can specify JSON path expressions to extract specific values from the response and define assertions based on expected values or patterns. This helps in verifying the correctness of the JSON responses during testing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JSON Pre-Processor:&lt;/strong&gt; JMeter offers a JSON Pre-Processor element that allows you to manipulate JSON data before sending it as part of an HTTP request. This can be useful for dynamically modifying JSON payloads based on test scenarios or test data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exploring JSON Extractor Expressions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extracting a Single Value&lt;/li&gt;
&lt;li&gt;Extracting a Value from a Nested Object&lt;/li&gt;
&lt;li&gt;Extracting Multiple Values&lt;/li&gt;
&lt;li&gt;Extracting Values Using Filters&lt;/li&gt;
&lt;li&gt;Extracting values based on a condition&lt;/li&gt;
&lt;li&gt;Extracting specific array elements&lt;/li&gt;
&lt;li&gt;Extracting values from multiple objects with the same key&lt;/li&gt;
&lt;li&gt;Extracting values using a wildcard&lt;/li&gt;
&lt;li&gt;Extracting values using regular expressions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In JMeter, you can extract JSON values or objects using various methods. Here are some of the ways you can extract JSON data in JMeter:&lt;/p&gt;

&lt;p&gt;Sample JSON: &lt;br&gt;
{&lt;br&gt;
  "name": "Ujwala",&lt;br&gt;
  "age": 30,&lt;br&gt;
  "user": {&lt;br&gt;
    "email": "&lt;a href="mailto:ujwala@gmail.com"&gt;ujwala@gmail.com&lt;/a&gt;",&lt;br&gt;
    "name": "Ujwala bothe"&lt;br&gt;
  },&lt;br&gt;
  "names": ["Ujwala", "Neha", "John"],&lt;br&gt;
  "users": [&lt;br&gt;
    {&lt;br&gt;
      "name": "Ujwala",&lt;br&gt;
      "age": 20,&lt;br&gt;
      "domain": "IT",&lt;br&gt;
      "email":"&lt;a href="mailto:ujwala@gmail.com"&gt;ujwala@gmail.com&lt;/a&gt;"&lt;br&gt;
    },&lt;br&gt;
    {&lt;br&gt;
      "name": "Neha",&lt;br&gt;
      "age": 40,&lt;br&gt;
      "domain": "SALES",&lt;br&gt;
      "email":"&lt;a href="mailto:neha@gmail.com"&gt;neha@gmail.com&lt;/a&gt;"&lt;br&gt;
    },&lt;br&gt;
    {&lt;br&gt;
      "name": "Sneha",&lt;br&gt;
      "age": 50,&lt;br&gt;
      "domain": "ADMIN",&lt;br&gt;
      "email":"&lt;a href="mailto:sneha@gmail.com"&gt;sneha@gmail.com&lt;/a&gt;"&lt;br&gt;
    }&lt;br&gt;
  ]&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extracting a Single Value:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JSON Path: $ .name or $.age&lt;/p&gt;

&lt;p&gt;Extracting Value from a Nested Object:&lt;br&gt;
You can specifiy the path to desire value e.g user's email using dot(.) notation to extarct a value from multiple object which in nested object . &lt;br&gt;
For example, if your JSON response contains a nested object structure like this:&lt;/p&gt;

&lt;p&gt;JSON Path: $.users.email or $.users.name&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extracting an Array of Values:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;IF JSON contains n values i.e a array of object then you can you index i.e 1st for 2nd element or 3rd for 4th element  or * to retreieve all the values for the attribute. &lt;br&gt;
 For example, if your JSON response contains an array of names like this:&lt;/p&gt;

&lt;p&gt;Extract the name: $ .names[0]&lt;br&gt;
Extract all names: $ .names[*]&lt;br&gt;
Extracting Multiple Values:&lt;/p&gt;

&lt;p&gt;JSON Path: $.name;$.age&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extracting Values Using Filters:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can use filters to extract specific values based on certain conditions. For example, if your JSON response contains an array of objects where each object has a “domain” field, you can use a filter to extract objects with a specific category. The following JSON Path expression extracts objects with the category “IT”:&lt;/p&gt;

&lt;p&gt;JSON Path: $[?(@.domain=='IT')]&lt;br&gt;
Extracting values based on a condition:&lt;/p&gt;

&lt;p&gt;JSON Path Expression: $[?(@.age&amp;gt;50].name&lt;br&gt;
This expression retrieves the names of all objects in the JSON response where the “age” field is greater than 50.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extracting specific array elements:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JSON Path Expression: $.employees[0].name&lt;br&gt;
This expression retrieves the value of the “name” field from the first object within the “employees” array in the JSON response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extracting values from multiple objects with the same key:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Extracts all values of the “Name” element from the entire JSON structure, regardless of their location.&lt;/p&gt;

&lt;p&gt;JSON Path: $..name&lt;br&gt;
&lt;strong&gt;Extracting values using a wildcard:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This expression extracts the values of the “domain” from all levels of the JSON structure using a wildcard.&lt;/p&gt;

&lt;p&gt;JSON Path: $..[*].domain&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extracting values using regular expressions:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This expression extracts values where the “Name” matches a specific regular expression pattern.&lt;/p&gt;

&lt;p&gt;JSON Path: $..[?.name=~/pattern)]&lt;/p&gt;

&lt;p&gt;JSON Path expressions commenly used in JMeter’s JSON Extractor.&lt;/p&gt;

&lt;p&gt;You can also combine two three expressions and to make final json extratcor path accordingly to the JSON format . It is great to use while extracting , manipulating and validating the data while using for API /Performance testing. &lt;/p&gt;

&lt;p&gt;Stay tuned for the next article on XPath extractor. &lt;/p&gt;

</description>
      <category>jsonextraction</category>
      <category>jmeter</category>
      <category>luxoft</category>
      <category>apitesting</category>
    </item>
    <item>
      <title>Controllers in JMeter!!</title>
      <dc:creator>ujwalabothe</dc:creator>
      <pubDate>Tue, 08 Aug 2023 16:15:36 +0000</pubDate>
      <link>https://dev.to/ujwalabothe/controllers-in-jmeter-5a79</link>
      <guid>https://dev.to/ujwalabothe/controllers-in-jmeter-5a79</guid>
      <description>&lt;p&gt;In JMeter, Logic Controllers are essential elements that enable you to control the flow and execution of samplers within a Thread Group. They play a crucial role in creating dynamic and conditional test scenarios, allowing for more realistic and versatile load-testing simulations. This blog will provide an overview of Logic Controllers, explaining their purpose and discussing why they are necessary for JMeter test plans.&lt;/p&gt;

&lt;p&gt;As a &lt;strong&gt;Senior QA Automation professional at Luxoft&lt;/strong&gt;, I have had the opportunity to work extensively on projects using logic controllers in JMeter. Through this comprehensive guide, I aim to provide beginners and individuals seeking a deeper understanding with valuable insights into leveraging logic controllers in JMeter&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6MYUPHoi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7385gozkptbmnce6jgx8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6MYUPHoi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7385gozkptbmnce6jgx8.png" alt="Image description" width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is a Logic Controller?&lt;/p&gt;

&lt;p&gt;A Logic Controller in JMeter is a configuration element that provides the ability to define the logical flow and conditions for executing samplers. It allows you to control the order, repetition, and selection of samplers, based on specified conditions or logic.&lt;/p&gt;

&lt;p&gt;Why Use Logic Controllers?&lt;/p&gt;

&lt;p&gt;Conditional Execution: Logic Controllers enable the execution of samplers based on specific conditions. For example, the If Controller allows you to execute samplers only if a given condition evaluates to true. This is useful when you want to simulate different scenarios based on dynamic data or specific criteria.&lt;/p&gt;

&lt;p&gt;Looping and Iterations: Logic Controllers such as the Loop Controller or While Controller provide the capability to repeat the execution of samplers. This is valuable when you need to simulate multiple iterations of a particular test scenario or perform actions until a certain condition is met.&lt;/p&gt;

&lt;p&gt;Dynamic Test Scenarios: Logic Controllers allow you to create dynamic test scenarios by selectively executing samplers based on variables or functions. The Switch Controller, for instance, lets you choose different paths based on the value of a variable, facilitating the simulation of varied user behavior or application responses.&lt;/p&gt;

&lt;p&gt;Randomization: Logic Controllers like the Random Controller enable the random selection and execution of samplers. This is useful for simulating user interactions with different functionalities or performing random load distribution across various components.&lt;/p&gt;

&lt;p&gt;Let's see different types of loop controllers in JMeter&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Critical Section Controller&lt;/li&gt;
&lt;li&gt;ForEach Controller&lt;/li&gt;
&lt;li&gt;If Controller&lt;/li&gt;
&lt;li&gt;Include Controller&lt;/li&gt;
&lt;li&gt;Interleave Controller&lt;/li&gt;
&lt;li&gt;Loop Controller&lt;/li&gt;
&lt;li&gt;Module controller&lt;/li&gt;
&lt;li&gt;Once Only Controller&lt;/li&gt;
&lt;li&gt;Random Controller&lt;/li&gt;
&lt;li&gt;Random Order Controller&lt;/li&gt;
&lt;li&gt;Recording Controller&lt;/li&gt;
&lt;li&gt;Runtime Controller&lt;/li&gt;
&lt;li&gt;Simple Controller&lt;/li&gt;
&lt;li&gt;Switch Controller&lt;/li&gt;
&lt;li&gt;Throughput Controller!&lt;/li&gt;
&lt;li&gt;Transaction Controller&lt;/li&gt;
&lt;li&gt;While Controller&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note : In this blog, I will be covering only 8 controllers and the remaining 9 will be covered in the next blog.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;How to add any controller in Jmeter ? *&lt;/em&gt;&lt;br&gt;
Under the test plan, add a Thread Group &amp;gt; Logic controller &amp;gt; Add any desired controller &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aKETr5rG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lkl4cx50obg5ced6zjmu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aKETr5rG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lkl4cx50obg5ced6zjmu.png" alt="Image description" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Critical Section Controller&lt;/strong&gt;&lt;br&gt;
The Critical Section Controller ensures that its children elements (samplers/controllers, etc) will be executed by only one thread as a named lock will be taken before executing children of the controller.&lt;/p&gt;

&lt;p&gt;For example, if one script has 2 Critical Section Controllers with requests DS3-${&lt;strong&gt;threadNum} and DS4-${&lt;/strong&gt;threadNum} respectively. Then it ensures that:&lt;/p&gt;

&lt;p&gt;DS3-${&lt;strong&gt;threadNum} is executed only by one thread at a time&lt;br&gt;
DS4-${&lt;/strong&gt;threadNum} is executed only by one thread at a time&lt;br&gt;
Or you just want to make sure one thread run at a time ,below is an example of a global lock.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pKHOYamY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/98vmvj9xjzlxp3kf2e9l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pKHOYamY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/98vmvj9xjzlxp3kf2e9l.png" alt="Image description" width="800" height="206"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ForEach Controller&lt;/strong&gt;&lt;br&gt;
This controller is one of the many built-in controllers used to design and control the flow of a test script. It allows you to iterate over elements of a variable, such as an array or a list, and execute the samplers or other elements inside the controller for each element in the variable.&lt;/p&gt;

&lt;p&gt;The ForEach Controller is useful when you need to perform an action multiple times, with each iteration using a different value from a set of values. It is commonly used in scenarios where you want to test different data inputs or perform actions on multiple items.&lt;/p&gt;

&lt;p&gt;To use the ForEach Controller:&lt;/p&gt;

&lt;p&gt;Right-click on the Thread Group or any other logical controller in the test plan.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;From the context menu, go to “Add” &amp;gt; “Logic Controller” &amp;gt; “ForEach Controller”.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hV_reTM---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/030bgcn4lxgcr3822vvz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hV_reTM---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/030bgcn4lxgcr3822vvz.png" alt="Image description" width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once added, you need to set up the ForEach Controller using the following properties:&lt;/p&gt;

&lt;p&gt;Input variable prefix: The prefix of the variable name containing the set of values you want to iterate over. For example, if you have a variable named “data” that contains an array of values, you would enter “data” as the input variable prefix.&lt;/p&gt;

&lt;p&gt;Output variable name: The name of the variable that will be used to store each element of the input variable during each iteration. This variable can be referenced in samplers or other elements within the ForEach Controller. For example, you can set it to “currentData” to use “currentData” as the variable that holds each value during iteration.&lt;/p&gt;

&lt;p&gt;Value to iterate: The delimiter-separated list of values you want to iterate over. The ForEach Controller will split this list using the specified delimiter and use each value in the iterations.&lt;/p&gt;

&lt;p&gt;Delimiter: The character used to separate the values in the “Value to iterate” field. By default, it is set to “,” (comma).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eqo-Co2I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxpmcgltprs63t7397rk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eqo-Co2I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gxpmcgltprs63t7397rk.png" alt="Image description" width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If Controller&lt;/strong&gt;&lt;br&gt;
The If Controller is a logic controller in JMeter that allows you to control the execution of elements i.e samplers ,other controllers based on a specified condition. It evaluates an expression and executes the elements inside it only if the expression evaluates to “true.”&lt;/p&gt;

&lt;p&gt;JMeter if controller Usage&lt;/p&gt;

&lt;p&gt;Now let’s see the uses of the if controller as follows.&lt;/p&gt;

&lt;p&gt;If we need to execute elements of the Thread Group based on their state at that time, we can use if controller.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using the if controller, we provide control over the test execution per our requirement.&lt;/li&gt;
&lt;li&gt;Using the if controller, we can check the Interpret condition.&lt;/li&gt;
&lt;li&gt;We can also evaluate the runnable elements from the controller.&lt;/li&gt;
&lt;li&gt;It allows us to implement the Boolean operator per our requirements.
Step 1: Set up the Test Plan Create a new Test Plan and add a Thread Group to it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Step 2: Add User-Defined Variables configuration element under the Thread Group. Here, we’ll define a variable named “company” and set its value to “Luxoft.” This variable will represent the company name for this example.&lt;/p&gt;

&lt;p&gt;Name: Company Value: Luxoft&lt;/p&gt;

&lt;p&gt;Step 3: Add If Controller Now, add an “If Controller” under the Thread Group. We’ll configure the If Controller to check if the company is “Luxoft” or not.&lt;/p&gt;

&lt;p&gt;In the If Controller, set the following properties:&lt;/p&gt;

&lt;p&gt;Condition: ${__groovy(vars.get(“company”) == “Luxoft”)}&lt;/p&gt;

&lt;p&gt;The above condition uses a Groovy script to check if the value of the “company” variable is equal to “Luxoft” If it’s true, the elements inside the If Controller will be executed; otherwise, they will be skipped.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eJFg3uLq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/upppckpk3van5wxhyo85.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eJFg3uLq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/upppckpk3van5wxhyo85.png" alt="Image description" width="800" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Include Controller&lt;/strong&gt;&lt;br&gt;
The “Include Controller” is a special type of logic controller that allows you to include other test fragments or external JMX files within your main test plan. This controller is useful when you want to reuse certain test elements across multiple test plans, making test maintenance and organization more efficient.&lt;/p&gt;

&lt;p&gt;Here’s how you can use the Include Controller with an example:&lt;/p&gt;

&lt;p&gt;Step 1: Create and save the Test Components that we want to reuse in your main test plan i.e PerformanceTesting.jmx&lt;/p&gt;

&lt;p&gt;Step 2: Create the Main Test Plan&lt;/p&gt;

&lt;p&gt;Create a new test plan e.g Employee where you want to include the components. This main test plan will call the components using the Include Controller.&lt;/p&gt;

&lt;p&gt;Step 3: Add Include Controller Under the main test plan, add an “Include Controller” by right-clicking on the test plan &amp;gt; Add &amp;gt; Logic Controller &amp;gt; Include Controller.&lt;/p&gt;

&lt;p&gt;Step 4: Configure the Include Controller In the Include Controller, specify the path to the JMX files of the components you want to include. Provide the relative or absolute path to the JMX files.&lt;/p&gt;

&lt;p&gt;PerformanceTesting .jmx&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dBP2azpk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2ttzlbkyljrwybcka9h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dBP2azpk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b2ttzlbkyljrwybcka9h.png" alt="Image description" width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 5: Run the test plan&lt;/p&gt;

&lt;p&gt;Benefits of using Include Controller:&lt;/p&gt;

&lt;p&gt;Code Reusability: The Include Controller promotes code reusability by allowing you to create modular test components and include them in multiple places, reducing redundancy and maintenance efforts.&lt;br&gt;
Organization: It helps in organizing your test plan by breaking it into smaller components, making it easier to manage and maintain.&lt;br&gt;
Collaboration: Multiple team members can work on separate components concurrently and later integrate them into the main test plan using the Include Controller.&lt;br&gt;
Interleave Controller&lt;/p&gt;

&lt;p&gt;Interleave Controller will select only one samplers/requests stored in it, to run in each loop of the thread. It will execute the samplers sequentially.&lt;/p&gt;

&lt;p&gt;You can give a descriptive name for the controller (optional)&lt;br&gt;
If the checkbox is selected, the interleave controller will consider sub-controllers as single request elements and permit only one request per controller at a time (optional)&lt;br&gt;
Let’s consider an example of Interleave Controller, where Thread Group contains “Number of Threads” to “1”, “Loop Count” to 10, and a total of “4” Samplers (Http requests).&lt;/p&gt;

&lt;p&gt;Total 1 * 10* 4 = 40 requests will be sent to web server under test without using any Logic Controller.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Loop Controller&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Loop Controller in JMeter is a logic controller that allows you to repeat the execution of its child elements (samplers or other controllers) a specified number of times. It’s a built-in feature of JMeter that facilitates creating loops in your test plan, where a specific set of elements is executed repeatedly.&lt;/p&gt;

&lt;p&gt;Let’s go through an example of how to use the Loop Controller in JMeter&lt;/p&gt;

&lt;p&gt;Test Plan&lt;br&gt;
Thread Group&lt;br&gt;
Loop Controller (Loop Count: 100)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kOzKadST--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ndinwgf6ghne2w72paq0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kOzKadST--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ndinwgf6ghne2w72paq0.png" alt="Image description" width="800" height="212"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HTTP Request Sampler (Executed 100times)&lt;br&gt;
The HTTP Request sampler will be executed in a loop for a hundred times, simulating a hundred requests to the specified server.&lt;/p&gt;

&lt;p&gt;The Loop Controller is commonly used to simulate multiple iterations of the same actions, such as:&lt;/p&gt;

&lt;p&gt;Load Testing: Repeating HTTP requests to simulate multiple users accessing a website or API.&lt;br&gt;
Stress Testing: Repeatedly executing test scenarios to assess system performance under high load.&lt;br&gt;
Functional Testing: Running the same test steps multiple times to verify the consistency and reliability of the application.&lt;br&gt;
Key features of the Loop Controller:&lt;/p&gt;

&lt;p&gt;Loop Count: You can specify the number of times you want the child elements to be executed in the loop.&lt;/p&gt;

&lt;p&gt;Independent Iterations: Each iteration of the Loop Controller is independent, meaning the variables and states are reset at the beginning of each iteration. This allows you to perform isolated test scenarios without interference between iterations.&lt;/p&gt;

&lt;p&gt;Dynamic Loop Count: You can use variables or functions in the “Loop Count” field to dynamically control the number of iterations during the test run.&lt;/p&gt;

&lt;p&gt;Nested Loops: You can nest Loop Controllers within each other to create complex looping patterns, simulating more intricate user behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Module controller&lt;/strong&gt;&lt;br&gt;
The Module Controller is a logic controller in JMeter that allows you to include reusable components or modules from other parts of your test plan. It helps in organizing and reusing test elements, making it easier to manage complex test scripts.&lt;/p&gt;

&lt;p&gt;When you use a Module Controller, it acts as a placeholder for another element, like a Sampler or a group of elements. The actual content of the Module Controller comes from an existing Test Fragment, which can be located anywhere in your test plan.&lt;/p&gt;

&lt;p&gt;Here’s how you can use the Module Controller:&lt;/p&gt;

&lt;p&gt;Step 1: Create a Test Plan Create a new Test Plan in JMeter.&lt;/p&gt;

&lt;p&gt;Step 2: Add Elements to Be Reused Create the components that you want to reuse in your test plan as modules. These could be samplers, controllers, or other elements.&lt;/p&gt;

&lt;p&gt;Step 3: Add a Module Controller Right-click on the location where you want to include the module, go to “Add” &amp;gt; “Logic Controller” &amp;gt; “Module Controller.”&lt;/p&gt;

&lt;p&gt;Step 4: Select the Module to Include In the Module Controller, you need to specify the name of the module you want to include. The module name is the same as the name of the element you want to reuse. You can also use the “Browse” button to select the module directly.&lt;/p&gt;

&lt;p&gt;Step 5: Run the Test Run the test, and JMeter will include the specified module at the location of the Module Controller during test execution.&lt;/p&gt;

&lt;p&gt;The Module Controller is useful when you want to reuse specific test elements or group them into logical components without duplicating code. It promotes modularity, making your test plan more organized and easier to manage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Jhi06THd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mbpp1godbuus0fxpqgib.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Jhi06THd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mbpp1godbuus0fxpqgib.png" alt="Image description" width="800" height="276"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Once Only Controller&lt;/strong&gt;&lt;br&gt;
the Once Only Controller is a logic controller that ensures the elements (samplers or other controllers) inside it are executed only once per thread during the test execution. It is particularly useful for setting up configurations or initialization tasks that should be performed just once, regardless of the number of iterations in a Thread Group.&lt;/p&gt;

&lt;p&gt;Here is an example of how to use the Once Only Controller in JMeter:&lt;/p&gt;

&lt;p&gt;Step 1: Create a Test Plan in JMeter.&lt;/p&gt;

&lt;p&gt;Step 2: Add a Thread Group to the Test Plan.&lt;/p&gt;

&lt;p&gt;Step 3: Add a Once Only Controller under the Thread Group.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EsUXBGWQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dl9lbcxk8vzlaw7boyvi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EsUXBGWQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dl9lbcxk8vzlaw7boyvi.png" alt="Image description" width="800" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 4: Add an HTTP Request sampler under the Once Only Controller.&lt;/p&gt;

&lt;p&gt;Step 5: Configure the HTTP Request sampler with the URL of the website you want to test.&lt;/p&gt;

&lt;p&gt;Step 6: Run the Test.&lt;/p&gt;

&lt;p&gt;For example, if you have 10 iterations in your Thread Group and the Once Only Controller contains an HTTP Request sampler, that HTTP request will be executed only once for each thread, and the result of that request will be reused for all iterations.&lt;/p&gt;

</description>
      <category>jmeter</category>
      <category>controller</category>
      <category>luxoft</category>
    </item>
    <item>
      <title>Kick off API Testing</title>
      <dc:creator>ujwalabothe</dc:creator>
      <pubDate>Fri, 04 Aug 2023 11:04:46 +0000</pubDate>
      <link>https://dev.to/ujwalabothe/kick-off-api-testing-12l7</link>
      <guid>https://dev.to/ujwalabothe/kick-off-api-testing-12l7</guid>
      <description>&lt;p&gt;&lt;strong&gt;#Luxoft #LuxoftTraining #API #APITesting #APITutorial&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;About Me :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My name is Ujwala, and I bring over more than 11 years experience as a Senior Automation QA professional. I have had the privilege of working with industry giants such as IBM and Synerzip, and I am currently contributing my expertise at Luxoft. My core proficiencies lie in the domains of Selenium automation, AWS, API testing, JMeter, and Worksoft. I have honed my skills in automating test scenarios using Selenium, ensuring efficient and robust software testing. Additionally, my knowledge extends to AWS, where I have leveraged cloud-based solutions for testing and deployment. I have gained substantial expertise in API testing, validating and optimizing communication between software components. I am proficient in JMeter, employing its capabilities to evaluate performance and scalability. Lastly, my agile methodology experience has facilitated effective collaboration and delivery of projects.&lt;br&gt;
I'm excited to share that I have recently embarked on my journey of writing technical blogs. Through my blog, I aim to offer valuable insights, tutorials, and thought-provoking content on various topics related to automation testing, cloud computing, API testing, JMeter, and more. It's my way of contributing to the tech community and sharing my knowledge and experiences accumulated over my 11+ years as a Senior Automation QA professional. I look forward to engaging with fellow tech enthusiasts, exchanging ideas, and fostering a vibrant learning environment through my blog.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Terminologies&lt;/strong&gt;&lt;br&gt;
The following are the most important terms related to REST APIs&lt;/p&gt;

&lt;p&gt;A resource is an object or representation of something, which has some associated data with it and there can be a set of methods to operate on it. E.g. Animals, schools, and employees are resources, and delete, add, update are the operations to be performed on these resources.&lt;br&gt;
Collections are set of resources, e.g Companies is the collection of Company resource.&lt;br&gt;
URL (Uniform Resource Locator) is a path through which a resource can be located and some actions can be performed on it.&lt;br&gt;
&lt;strong&gt;2) API endpoint&lt;/strong&gt;&lt;br&gt;
Let’s write few APIs for Companies which has some Employees, to understand more.&lt;br&gt;
/getAllEmployees is an API that will respond with the list of employees. Few more APIs around a Company will look like as follows:&lt;/p&gt;

&lt;p&gt;/addNewEmployee&lt;br&gt;
/updateEmployee&lt;br&gt;
/deleteEmployee&lt;br&gt;
/deleteAllEmployees&lt;br&gt;
/promoteEmployee&lt;br&gt;
/promoteAllEmployees&lt;br&gt;
And there will be tons of other API endpoints like these for different operations. All of those will contain many redundant actions. Hence, all these API endpoints would be burdensome to maintain, when API count increases.&lt;/p&gt;

&lt;p&gt;What is wrong?&lt;br&gt;
The URL should only contain resources(nouns) not actions or verbs. The API path/addNewEmployee contains the action addNew along with the resource name Employee.&lt;/p&gt;

&lt;p&gt;Then what is the correct way?&lt;br&gt;
/companies endpoint is a good example, which contains no action. But the question is how do we tell the server about the actions to be performed on companies resource viz. whether to add, delete or update?&lt;/p&gt;

&lt;p&gt;This is where the HTTP methods (GET, POST, DELETE, PUT), also called as verbs, play the role.&lt;/p&gt;

&lt;p&gt;The resource should always be plural in the API endpoint and if we want to access one instance of the resource, we can always pass the id in the URL.&lt;/p&gt;

&lt;p&gt;method GET path /companies should get the list of all companies&lt;br&gt;
method GET path /companies/34 should get the detail of company 34&lt;br&gt;
method DELETE path /companies/34 should delete company 34&lt;br&gt;
In few other use cases, if we have resources under a resource, e.g Employees of a Company, then few of the sample API endpoints would be:&lt;/p&gt;

&lt;p&gt;GET /companies/3/employees should get the list of all employees from company 3&lt;br&gt;
GET /companies/3/employees/45 should get the details of employee 45, which belongs to company 3&lt;br&gt;
DELETE /companies/3/employees/45 should delete employee 45, which belongs to company 3&lt;br&gt;
POST /companies should create a new company and return the details of the new company created&lt;br&gt;
Aren’t the APIs are now more precise and consistent? 😎&lt;/p&gt;

&lt;p&gt;Conclusion: The paths should contain the plural form of resources and the HTTP method should define the kind of action to be performed on the resource.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) HTTP methods (verbs)&lt;/strong&gt;&lt;br&gt;
HTTP has defined few sets of methods which indicates the type of action to be performed on the resources.&lt;/p&gt;

&lt;p&gt;The URL is a sentence, where resources are nouns and HTTP methods are verbs.&lt;/p&gt;

&lt;p&gt;The important HTTP methods are as follows:&lt;/p&gt;

&lt;p&gt;GET method requests data from the resource and should not produce any side effect.&lt;br&gt;
E.g /companies/3/employees returns list of all employees from company 3.&lt;br&gt;
POST method requests the server to create a resource in the database, mostly when a web form is submitted.&lt;br&gt;
E.g /companies/3/employees creates a new Employee of company 3.&lt;br&gt;
POST is non-idempotent which means multiple requests will have different effects.&lt;br&gt;
PUT method requests the server to update resource or create the resource, if it doesn’t exist.&lt;br&gt;
E.g. /companies/3/employees/john will request the server to update, or create if doesn’t exist, the john resource in employees collection under company 3.&lt;br&gt;
PUT is idempotent which means multiple requests will have the same effects.&lt;br&gt;
DELETE method requests that the resources, or its instance, should be removed from the database.&lt;br&gt;
E.g /companies/3/employees/john/ will request the server to delete john resource from the employees collection under the company 3.&lt;br&gt;
There are few other methods which we will discuss in another post.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) HTTP response status codes&lt;/strong&gt;&lt;br&gt;
When the client raises a request to the server through an API, the client should know the feedback, whether it failed, passed or the request was wrong. HTTP status codes are a bunch of standardized codes which has various explanations in various scenarios. The server should always return the right status code.&lt;br&gt;
The following are the important categorization of HTTP codes:&lt;/p&gt;

&lt;p&gt;2xx (Success category)&lt;br&gt;
These status codes represent that the requested action was received and successfully processed by the server.&lt;/p&gt;

&lt;p&gt;200 Ok The standard HTTP response representing success for GET, PUT or POST.&lt;br&gt;
201 Created This status code should be returned whenever the new instance is created. E.g on creating a new instance, using POST method, should always return 201 status code.&lt;br&gt;
204 No Content represents the request is successfully processed, but has not returned any content.&lt;br&gt;
DELETE can be a good example of this.&lt;br&gt;
The API DELETE /companies/43/employees/2 will delete the employee 2 and in return we do not need any data in the response body of the API, as we explicitly asked the system to delete. If there is any error, like if employee 2 does not exist in the database, then the response code would be not be of 2xx Success Category but around 4xx Client Error category.&lt;br&gt;
3xx (Redirection Category)&lt;br&gt;
304 Not Modified indicates that the client has the response already in its cache. And hence there is no need to transfer the same data again.&lt;br&gt;
4xx (Client Error Category)&lt;br&gt;
These status codes represent that the client has raised a faulty request.&lt;/p&gt;

&lt;p&gt;400 Bad Request indicates that the request by the client was not processed, as the server could not understand what the client is asking for.&lt;br&gt;
401 Unauthorized indicates that the client is not allowed to access resources, and should re-request with the required credentials.&lt;br&gt;
403 Forbidden indicates that the request is valid and the client is authenticated, but the client is not allowed access the page or resource for any reason. E.g sometimes the authorized client is not allowed to access the directory on the server.&lt;br&gt;
404 Not Found indicates that the requested resource is not available now.&lt;br&gt;
410 Gone indicates that the requested resource is no longer available which has been intentionally moved.&lt;br&gt;
5xx (Server Error Category)&lt;br&gt;
500 Internal Server Error indicates that the request is valid, but the server is totally confused and the server is asked to serve some unexpected condition.&lt;br&gt;
503 Service Unavailable indicates that the server is down or unavailable to receive and process the request. Mostly if the server is undergoing maintenance.&lt;br&gt;
&lt;strong&gt;5) Field name casing convention&lt;/strong&gt;&lt;br&gt;
You can follow any casing convention, but make sure it is consistent across the application. If the request body or response type is JSON then please follow camelCase to maintain the consistency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6) Searching, sorting, filtering, and pagination&lt;/strong&gt;&lt;br&gt;
All of these actions are simply the query on one dataset. There will be no new set of APIs to handle these actions. We need to append the query params with the GET method API.&lt;br&gt;
Let’s understand with few examples of how to implement these actions.&lt;/p&gt;

&lt;p&gt;Sorting In case, the client wants to get the sorted list of companies, the GET /companies endpoint should accept multiple sort params in the query.&lt;br&gt;
E.g GET /companies?sort=rank_asc would sort the companies by its rank in ascending order.&lt;br&gt;
Filtering For filtering the dataset, we can pass various options through query params.&lt;br&gt;
E.g GET /companies?category=banking&amp;amp;location=india would filter the companies list data with the company category of Banking and where the location is India.&lt;br&gt;
Searching When searching the company name in companies list the API endpoint should be GET /companies?search=Digital Mckinsey&lt;br&gt;
Pagination When the dataset is too large, we divide the data set into smaller chunks, which helps in improving the performance and is easier to handle the response. Eg. GET /companies?page=23 means get the list of companies on 23rd page.&lt;br&gt;
If adding many query params in GET methods makes the URI too long, the server may respond with 414 URI Too long HTTP status, in those cases params can also be passed in the request body of the POST method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7) Versioning&lt;/strong&gt;&lt;br&gt;
When your APIs are being consumed by the world, upgrading the APIs with some breaking change would also lead to breaking the existing products or services using your APIs.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://api.yourservice.com/v1/companies/34/employees"&gt;http://api.yourservice.com/v1/companies/34/employees&lt;/a&gt; is a good example, which has the version number of the API in the path. If there is any major breaking update, we can name the new set of APIs as v2 or v1.x.x&lt;/p&gt;

&lt;p&gt;I would love to know your views on the pointers mentioned above. Please leave a comment, and let me know!&lt;/p&gt;

&lt;p&gt;Happy Learning!!! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unlocking Cosmos DB Potential: Testing API Performance with JMeter!!</title>
      <dc:creator>ujwalabothe</dc:creator>
      <pubDate>Thu, 03 Aug 2023 16:25:29 +0000</pubDate>
      <link>https://dev.to/ujwalabothe/unlocking-cosmos-db-potential-testing-api-performance-with-jmeter-3goa</link>
      <guid>https://dev.to/ujwalabothe/unlocking-cosmos-db-potential-testing-api-performance-with-jmeter-3goa</guid>
      <description>&lt;h1&gt;
  
  
  Jmeter #CosmosDatabase #PeroformanceTesting #databasetesting #Luxoft #Poland
&lt;/h1&gt;

&lt;p&gt;Working with Luxoft for over a year, I have gained invaluable experience in my 11+ years of overall professional journey. The culture of knowledge sharing at Luxoft not only fosters continuous learning but also plays a vital role in our collective success.&lt;br&gt;
In today’s fast-paced software development industry, ensuring the optimal performance of your product is paramount. However, as the sole tester on your project or even within the entire company, selecting the right performance testing tool can feel overwhelming. With a vast array of options available, making an informed choice is crucial. This article aims to demystify the process by exploring Apache JMeter — an exceptionally powerful and user-friendly tool for performance testing. I will provide a step-by-step guide to help you become familiar with JMeter and successfully execute your first performance test.&lt;br&gt;
I have had the opportunity to work extensively on performance projects using Jmeter. &lt;br&gt;
Though jmeter is very popular among us but still we don't have lot of documentation for cosmos database so here I’m sharing my experience of Jmeter with cosmos which I have recently used in my project .&lt;/p&gt;

&lt;p&gt;Azure Cosmos DB is a globally distributed, multi-model database service offered by Microsoft Azure. It is designed to provide high availability, scalability, and low-latency access to data for mission-critical applications.&lt;/p&gt;

&lt;p&gt;Apache JMeter™ can also perform load testing against Azure Cosmos DB (SQL API).&lt;/p&gt;

&lt;p&gt;Azure Cosmos DB (SQL API) is operated by the REST API.&lt;br&gt;
So, it will be tested using the HTTP request sampler in Apache JMeter™.&lt;/p&gt;

&lt;p&gt;For the request to be successful, it must be made with the appropriate method, header, and body.&lt;/p&gt;

&lt;p&gt;Outline of steps&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install jmeter&lt;/li&gt;
&lt;li&gt;Install the plugin for Microsoft Azure.&lt;/li&gt;
&lt;li&gt;Cosmos database set up configuration.&lt;/li&gt;
&lt;li&gt;Add a Thread Group.&lt;/li&gt;
&lt;li&gt;HTTP Header Manager .&lt;/li&gt;
&lt;li&gt;User Parameters.&lt;/li&gt;
&lt;li&gt;JSON Extractor.&lt;/li&gt;
&lt;li&gt;Extract the test data in CSV format.&lt;/li&gt;
&lt;li&gt;Save the Response.&lt;/li&gt;
&lt;li&gt;Run the test plan and check the result&lt;/li&gt;
&lt;li&gt;Detailed steps with real-time examples :&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: Download and Install JMeter
&lt;/h2&gt;

&lt;p&gt;Download the latest stable version of JMeter from (&lt;a href="https://jmeter.apache.org/"&gt;https://jmeter.apache.org/&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 : Install Azure CosmosDB Plugin
&lt;/h2&gt;

&lt;p&gt;To enable the connectivity download “Azure backend listerner” plugin from JMeter Plugins website (&lt;a href="https://jmeter-plugins.org/"&gt;https://jmeter-plugins.org/&lt;/a&gt;) or you can use the JMeter Plugins Manager to install it.&lt;/p&gt;

&lt;p&gt;Place it in lib/ext directory of your JMeter installation. Next restart JMeter to load the plugin.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--245P9nwI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzafumi2oog1hgj673k5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--245P9nwI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzafumi2oog1hgj673k5.png" alt="Image description" width="800" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Cosmos database set up configuration
&lt;/h2&gt;

&lt;p&gt;You can get all the below details from the cosmos database, go to the database and check the cosmos database properties.&lt;/p&gt;

&lt;p&gt;Add &amp;gt; Config Element &amp;gt; User Defined Variables&lt;/p&gt;

&lt;p&gt;cosmosdbHost: Hostname of Cosmos DB (***.documents.azure.com)&lt;br&gt;
cosmosdbKey: Key of Cosmos DB&lt;br&gt;
You can use either the primary or secondary key.&lt;br&gt;
headers.x-ms-version: Version of Cosmos database&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L8z27ARL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4ytmr1shqh428dlonzd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L8z27ARL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4ytmr1shqh428dlonzd.png" alt="Image description" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Add a Thread Group
&lt;/h2&gt;

&lt;p&gt;Add&amp;gt;Threads(Users)&amp;gt; SetUp Thread Group&lt;/p&gt;

&lt;p&gt;This will be set up once and can be used many times throughout the test plan. Eg data extracted/saved from this script can be used in various thread groups.&lt;/p&gt;

&lt;p&gt;Protocol : https/http ,ServerName or IP : you can directly provide here e.g test.com or you can define a variable and use it here e.g ${cosmosdbHost},&lt;/p&gt;

&lt;p&gt;Method : POST ( small correction in SS :( )and Path .&lt;/p&gt;

&lt;p&gt;Note : all these varibles are defined in&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JeN-iUvD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mvid88h6et7pk95wl5hl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JeN-iUvD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mvid88h6et7pk95wl5hl.png" alt="Image description" width="800" height="272"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XpzHXG0q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bjpipopwtt9f319lyjae.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XpzHXG0q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bjpipopwtt9f319lyjae.png" alt="Image description" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: HTTP Header Manager
&lt;/h2&gt;

&lt;p&gt;Configure the parmaters (x-ms-version, authorizaton and other parameters) as per below screenshot .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MGCVG2kw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w23cf9g2xhfem49fd9c1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MGCVG2kw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w23cf9g2xhfem49fd9c1.png" alt="Image description" width="800" height="428"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZX5VHugi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/37li2zh91e0fagvi872q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZX5VHugi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/37li2zh91e0fagvi872q.png" alt="Image description" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: User Parameters
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vH0V0lSk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eegneqs8ihjqifbz5udf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vH0V0lSk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eegneqs8ihjqifbz5udf.png" alt="Image description" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9JwpB86_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lzyp0j7sjcrfovuwjeeu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9JwpB86_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lzyp0j7sjcrfovuwjeeu.png" alt="Image description" width="800" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7 : JSON Extractor
&lt;/h2&gt;

&lt;p&gt;Here I have given two examples but you can extract as many as you want. Also you can change the JSON expression ( may be we can cover JSON expression in next article )&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MflyCdCB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0z439dwkj8axsbulhrx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MflyCdCB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0z439dwkj8axsbulhrx.png" alt="Image description" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DwJyn0SC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgruq755fhxj3e34jco6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DwJyn0SC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgruq755fhxj3e34jco6.png" alt="Image description" width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 8 : Extract the test data in csv format.
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QID0Ktqu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6uf4cc9qq4ybjj21kueb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QID0Ktqu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6uf4cc9qq4ybjj21kueb.png" alt="Image description" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2ERtwBlR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4euwjnefym1mxppfao8e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2ERtwBlR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4euwjnefym1mxppfao8e.png" alt="Image description" width="800" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gWutOvtb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1wdtbbb28l18vqqu9z9n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gWutOvtb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1wdtbbb28l18vqqu9z9n.png" alt="Image description" width="800" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 9: Save the Response:
&lt;/h2&gt;

&lt;p&gt;Save the response in txt or json format . You can also define a reference varible for response file name in the variable section and use a variable here eg ${responseFilePath}&lt;/p&gt;

&lt;p&gt;Go to Http request &amp;gt;&amp;gt; Add&amp;gt;Listener&amp;gt; Save Response to a file and provide a file name and location else it will be saved in Jmeter bin folder ( default location )&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4ePi4fFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hql0w9qmgwiaplsgwdil.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4ePi4fFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hql0w9qmgwiaplsgwdil.png" alt="Image description" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j7Dq5Tv6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v4m3ec0psrg20d3034le.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j7Dq5Tv6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v4m3ec0psrg20d3034le.png" alt="Image description" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 10 : Run the test plan and check the result
&lt;/h2&gt;

&lt;p&gt;Testing Azure Cosmos DB with Apache JMeter provides valuable insights into the performance and reliability of your database deployments. By following the basic steps outlined in this article, you can establish a strong foundation for testing and ensuring optimal performance of your Cosmos DB applications. Harness the power of JMeter to validate the behavior of your Cosmos DB and deliver robust and scalable solutions.&lt;/p&gt;

&lt;p&gt;Stay tuned for the next article where I will cover JSON extractor in detail :)&lt;/p&gt;

</description>
      <category>jmeter</category>
      <category>cosmosdb</category>
      <category>performance</category>
      <category>luxoft</category>
    </item>
  </channel>
</rss>
