<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JMeter Archives - Blog IT</title>
	<atom:link href="https://blogit.create.pt/tag/jmeter/feed/" rel="self" type="application/rss+xml" />
	<link>https://blogit.create.pt/tag/jmeter/</link>
	<description>Create IT blogger community</description>
	<lastBuildDate>Fri, 23 Apr 2021 16:17:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>Performance Testing An API, How To Start Doing It With JMeter?</title>
		<link>https://blogit.create.pt/diogocoelho/2021/04/23/performance-testing-an-api-how-to-start-doing-it-with-jmeter/</link>
					<comments>https://blogit.create.pt/diogocoelho/2021/04/23/performance-testing-an-api-how-to-start-doing-it-with-jmeter/#respond</comments>
		
		<dc:creator><![CDATA[Diogo Coelho]]></dc:creator>
		<pubDate>Fri, 23 Apr 2021 16:15:09 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Automatic Testing]]></category>
		<category><![CDATA[JMeter]]></category>
		<category><![CDATA[Performance Test]]></category>
		<category><![CDATA[Testing]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=12241</guid>

					<description><![CDATA[<p>This article will talk about how to start using JMeter for Testing an API. How to install JMeter, what are the components of it and how to use it. It will, also, show a short introduction of what is performance testing. First&#160;of&#160;all,&#160;let&#8217;s&#160;talk&#160;about&#160;Performance&#160;Testing.&#160;What&#160;is&#160;Performance&#160;Testing? Performance&#160;Testing&#160;is&#160;a&#160;software&#160;testing&#160;process&#160;used&#160;for&#160;testing&#160;the&#160;speed,&#160;response&#160;time,&#160;stability,&#160;reliability,&#160;scalability&#160;and&#160;resource&#160;usage&#160;of&#160;a&#160;software&#160;application&#160;under&#160;a particular&#160;workload.&#160;&#160;The&#160;focus&#160;of&#160;Performance&#160;Testing&#160;is&#160;checking&#160;a&#160;software&#160;program&#8217;s Speed&#160;&#8211;&#160;Determines&#160;whether&#160;the&#160;application&#160;responds&#160;quickly Scalability&#160;&#8211;&#160;Determines&#160;the maximum user load&#160;the&#160;software&#160;application&#160;can&#160;handle. Stability&#160;&#8211;&#160;Determines&#160;if&#160;the&#160;application&#160;is&#160;stable&#160;under&#160;varying&#160;loads What&#160;is&#160;the&#160;Purpose&#160;of&#160;doing&#160;it? The&#160;main&#160;purpose&#160;of&#160;performance&#160;testing&#160;is&#160;to&#160;identify&#160;and&#160;eliminate&#160;the&#160;performance&#160;bottlenecks&#160;in&#160;the&#160;software&#160;application. Now let&#8217;s introduce [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/diogocoelho/2021/04/23/performance-testing-an-api-how-to-start-doing-it-with-jmeter/">Performance Testing An API, How To Start Doing It With JMeter?</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>This article will talk about how to start using JMeter for Testing an API. </p>



<p>How to install JMeter, what are the components of it and how to use it. It will, also, show a short introduction of what is performance testing. </p>



<h2 class="wp-block-heading"><strong>First&nbsp;of&nbsp;all,&nbsp;let&#8217;s&nbsp;talk&nbsp;about&nbsp;Performance&nbsp;Testing.&nbsp;What&nbsp;is&nbsp;Performance&nbsp;Testing?</strong></h2>



<p>Performance&nbsp;Testing&nbsp;is&nbsp;a&nbsp;software&nbsp;testing&nbsp;process&nbsp;used&nbsp;for&nbsp;testing&nbsp;the&nbsp;speed,&nbsp;response&nbsp;time,&nbsp;stability,&nbsp;reliability,&nbsp;scalability&nbsp;and&nbsp;resource&nbsp;usage&nbsp;of&nbsp;a&nbsp;software&nbsp;application&nbsp;under&nbsp;a particular&nbsp;workload.&nbsp;&nbsp;<br>The&nbsp;focus&nbsp;of&nbsp;Performance&nbsp;Testing&nbsp;is&nbsp;checking&nbsp;a&nbsp;software&nbsp;program&#8217;s</p>



<ul class="wp-block-list"><li>Speed&nbsp;&#8211;&nbsp;Determines&nbsp;whether&nbsp;the&nbsp;application&nbsp;responds&nbsp;quickly</li><li>Scalability&nbsp;&#8211;&nbsp;Determines&nbsp;the maximum user load&nbsp;the&nbsp;software&nbsp;application&nbsp;can&nbsp;handle.</li><li>Stability&nbsp;&#8211;&nbsp;Determines&nbsp;if&nbsp;the&nbsp;application&nbsp;is&nbsp;stable&nbsp;under&nbsp;varying&nbsp;loads</li></ul>



<h3 class="wp-block-heading"><strong>What&nbsp;is&nbsp;the&nbsp;Purpose&nbsp;of&nbsp;doing&nbsp;it?</strong></h3>



<p>The&nbsp;main&nbsp;purpose&nbsp;of&nbsp;performance&nbsp;testing&nbsp;is&nbsp;to&nbsp;identify&nbsp;and&nbsp;eliminate&nbsp;the&nbsp;performance&nbsp;bottlenecks&nbsp;in&nbsp;the&nbsp;software&nbsp;application.</p>



<h2 class="wp-block-heading">Now let&#8217;s introduce JMeter</h2>



<h3 class="wp-block-heading">How to install it?</h3>



<p>JMeter&nbsp;is&nbsp;an&nbsp;application&nbsp;base&nbsp;in&nbsp;java.&nbsp;This&nbsp;means,&nbsp;that&nbsp;every&nbsp;computer&nbsp;with&nbsp;java&nbsp;installed&nbsp;can&nbsp;run&nbsp;this&nbsp;application.&nbsp;So&nbsp;let&#8217;s&nbsp;see&nbsp;how&nbsp;to&nbsp;install&nbsp;it.</p>



<h3 class="wp-block-heading">1- Download Java.</h3>



<p>&nbsp;First&nbsp;of&nbsp;all,&nbsp;you&nbsp;will&nbsp;need&nbsp;to&nbsp;install&nbsp;Java&nbsp;on&nbsp;your&nbsp;computer.&nbsp;Here&nbsp;you&nbsp;can&nbsp;download&nbsp;and&nbsp;Install&nbsp;the&nbsp;latest&nbsp;version&nbsp;of&nbsp;Java&nbsp;SE&nbsp;Development&nbsp;Kit <a href="https://www.oracle.com/java/technologies/javase-downloads.html">https://www.oracle.com/java/technologies/javase-downloads.html</a>.</p>



<h3 class="wp-block-heading">2- Download JMeter. </h3>



<p>At&nbsp;the&nbsp;point&nbsp;of&nbsp;writing,&nbsp;the&nbsp;latest&nbsp;version&nbsp;is&nbsp;Apache&nbsp;JMeter&nbsp;5.4.1&nbsp;(Requires&nbsp;Java&nbsp;8+)&nbsp;and&nbsp;you&nbsp;can&nbsp;download&nbsp;it here <a href="http://jmeter.apache.org/download_jmeter.cgi">http://jmeter.apache.org/download_jmeter.cgi</a>. Choose&nbsp;the&nbsp;Binaries&nbsp;file&nbsp;(either&nbsp;apache-jmeter-5.4.1.zip&nbsp;or&nbsp;apache-jmeter-5.4.1.tgz).</p>



<h3 class="wp-block-heading">3- Installation.</h3>



<p>Installing&nbsp;Jmeter&nbsp;is&nbsp;easy!&nbsp;You&nbsp;only&nbsp;need&nbsp;to&nbsp;unzip&nbsp;the&nbsp;file&nbsp;to&nbsp;a&nbsp;directory&nbsp;of&nbsp;your&nbsp;choice&nbsp;and&nbsp;that&#8217;s&nbsp;it!</p>



<h3 class="wp-block-heading">4- Start JMeter </h3>



<p>JMeter can be used in 3 modes. These 3 modes are: </p>



<ol class="wp-block-list"><li>GUI Mode</li><li>Server Mode</li><li>Command Line Mode</li></ol>



<p>In&nbsp;this&nbsp;article,&nbsp;we&nbsp;will&nbsp;focus&nbsp;on&nbsp;<strong>GUI&nbsp;Mode</strong>.&nbsp;So,&nbsp;to&nbsp;start&nbsp;the&nbsp;GUI&nbsp;Mode,&nbsp;you&nbsp;will&nbsp;need&nbsp;to&nbsp;execute&nbsp;the&nbsp;following&nbsp;file&nbsp;<strong>/bin/ApacheJMeter.jar</strong>.&nbsp;This&nbsp;will&nbsp;open&nbsp;the&nbsp;application&nbsp;as&nbsp;the&nbsp;following&nbsp;example.</p>



<figure class="wp-block-image size-large is-resized"><img fetchpriority="high" decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/AppOpen-1024x560.png" alt="" class="wp-image-12245" width="1070" height="586" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/AppOpen-1024x560.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/AppOpen-300x164.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/AppOpen-768x420.png 768w, https://blogit.create.pt/wp-content/uploads/2021/04/AppOpen-1536x840.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/AppOpen-696x381.png 696w, https://blogit.create.pt/wp-content/uploads/2021/04/AppOpen-1068x584.png 1068w, https://blogit.create.pt/wp-content/uploads/2021/04/AppOpen.png 1920w" sizes="(max-width: 1070px) 100vw, 1070px" /></figure>



<h2 class="wp-block-heading">How to use JMeter?</h2>



<p>Now&nbsp;that&nbsp;we&nbsp;have&nbsp;JMeter&nbsp;installed&nbsp;and&nbsp;running,&nbsp;we&nbsp;need&nbsp;to&nbsp;understand&nbsp;the&nbsp;components&nbsp;that&nbsp;are&nbsp;used&nbsp;to&nbsp;create&nbsp;a&nbsp;Test&nbsp;Plan.</p>



<p>When&nbsp;we&nbsp;open&nbsp;JMeter,&nbsp;we&nbsp;can&nbsp;see&nbsp;that&nbsp;there&nbsp;is&nbsp;already&nbsp;a&nbsp;&#8220;Test&nbsp;Plan&#8221;&nbsp;component.&nbsp;This&nbsp;component&nbsp;is&nbsp;where&nbsp;we&nbsp;add&nbsp;components&nbsp;for&nbsp;our&nbsp;JMeter&nbsp;Test.&nbsp;Here&nbsp;is&nbsp;an&nbsp;image&nbsp;of&nbsp;how&nbsp;these&nbsp;components&nbsp;are&nbsp;organized.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="742" height="290" src="https://blogit.create.pt/wp-content/uploads/2021/04/Jmeter.png" alt="" class="wp-image-12246" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/Jmeter.png 742w, https://blogit.create.pt/wp-content/uploads/2021/04/Jmeter-300x117.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/Jmeter-696x272.png 696w" sizes="(max-width: 742px) 100vw, 742px" /></figure>



<p>The&nbsp;components&nbsp;that&nbsp;we&nbsp;are&nbsp;gonna&nbsp;talk&nbsp;here&nbsp;will&nbsp;be:</p>



<ul class="wp-block-list"><li>Thread Group</li><li>Samplers </li><li>Listeners </li><li>Config Elements</li></ul>



<h4 class="wp-block-heading">Thread Group</h4>



<p>Thread&nbsp;group&nbsp;is&nbsp;a&nbsp;collection&nbsp;of&nbsp;threads.&nbsp;This&nbsp;is&nbsp;the&nbsp;component&nbsp;where&nbsp;you&nbsp;define&nbsp;how&nbsp;many&nbsp;threads&nbsp;will&nbsp;run.&nbsp;Essentially,&nbsp;each&nbsp;thread represents&nbsp;a&nbsp;user&nbsp;using&nbsp;the&nbsp;application&nbsp;under&nbsp;test.</p>



<p>The&nbsp;thread&nbsp;group&nbsp;let&#8217;s&nbsp;you&nbsp;set&nbsp;the&nbsp;value&nbsp;of&nbsp;threads&nbsp;that&nbsp;you&nbsp;want&nbsp;to&nbsp;run(simulating&nbsp;the&nbsp;number&nbsp;of&nbsp;users, that&nbsp;you&nbsp;to&nbsp;test,&nbsp;using&nbsp;your&nbsp;app).For&nbsp;example,&nbsp;if&nbsp;you&nbsp;set&nbsp;threads&nbsp;number&nbsp;to&nbsp;100.&nbsp;JMeter&nbsp;will&nbsp;create&nbsp;and&nbsp;make&nbsp;100&nbsp;request&nbsp;to&nbsp;the&nbsp;application&nbsp;under&nbsp;test.</p>



<h4 class="wp-block-heading">Samplers</h4>



<p>JMeter&nbsp;supports&nbsp;testing&nbsp;HTTP,&nbsp;FTP,&nbsp;JDBC&nbsp;and&nbsp;many&nbsp;other&nbsp;protocols.</p>



<p>We&nbsp;already&nbsp;know&nbsp;that&nbsp;Thread&nbsp;Groups&nbsp;simulate&nbsp;user&nbsp;request&nbsp;to&nbsp;the&nbsp;server, but&nbsp;how&nbsp;does&nbsp;a&nbsp;Thread&nbsp;Group&nbsp;know&nbsp;which&nbsp;type&nbsp;of&nbsp;requests&nbsp;(HTTP,&nbsp;FTP&nbsp;etc.)&nbsp;it&nbsp;needs&nbsp;to&nbsp;make?&nbsp;The&nbsp;answer&nbsp;is&nbsp;Samplers.</p>



<p>The&nbsp;user&nbsp;request&nbsp;could&nbsp;be&nbsp;FTP&nbsp;Request,&nbsp;HTTP&nbsp;Request,&nbsp;JDBC&nbsp;Request, etc. In&nbsp;this&nbsp;example, we&nbsp;will&nbsp;concentrate&nbsp;in<strong> HTTP&nbsp;Request</strong>.</p>



<h4 class="wp-block-heading">Listeners</h4>



<p>Listeners&nbsp;shows&nbsp;the&nbsp;results&nbsp;of&nbsp;the&nbsp;test&nbsp;execution.&nbsp;They&nbsp;can&nbsp;show&nbsp;results&nbsp;in&nbsp;a&nbsp;different&nbsp;format&nbsp;such&nbsp;as&nbsp;a&nbsp;tree,&nbsp;table,&nbsp;graph&nbsp;or&nbsp;log&nbsp;file.</p>



<p>Graph&nbsp;result&nbsp;listeners&nbsp;display&nbsp;the&nbsp;server&nbsp;response&nbsp;times&nbsp;on&nbsp;a&nbsp;Graph.</p>



<p>View&nbsp;Result&nbsp;Tree&nbsp;show&nbsp;results&nbsp;of&nbsp;the&nbsp;user&nbsp;request&nbsp;in&nbsp;basic&nbsp;HTML&nbsp;format.</p>



<p>Table&nbsp;Result&nbsp;show&nbsp;summary&nbsp;of&nbsp;a&nbsp;test&nbsp;result&nbsp;in&nbsp;table&nbsp;format.</p>



<p>Log&nbsp;show&nbsp;summary&nbsp;of&nbsp;a&nbsp;test&nbsp;result&nbsp;in&nbsp;the&nbsp;text&nbsp;file.</p>



<h4 class="wp-block-heading">Config Elements</h4>



<p>Set&nbsp;up&nbsp;defaults&nbsp;and&nbsp;variables&nbsp;for&nbsp;later&nbsp;use&nbsp;by&nbsp;samplers.</p>



<p>The&nbsp;figure&nbsp;below&nbsp;shows&nbsp;some&nbsp;commonly&nbsp;used&nbsp;configuration&nbsp;elements&nbsp;in&nbsp;JMeter.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/ConfigurationElements.png" alt="" class="wp-image-12248" width="1058" height="277" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/ConfigurationElements.png 632w, https://blogit.create.pt/wp-content/uploads/2021/04/ConfigurationElements-300x78.png 300w" sizes="(max-width: 1058px) 100vw, 1058px" /></figure>



<h3 class="wp-block-heading">Let&#8217;s create a test</h3>



<p>As&nbsp;was&nbsp;shown&nbsp;before,&nbsp;JMeter&nbsp;starts&nbsp;with&nbsp;a&nbsp;Test&nbsp;Plan&nbsp;Component&nbsp;already&nbsp;created&nbsp;(you&nbsp;can&nbsp;change&nbsp;the&nbsp;name&nbsp;to&nbsp;anything&nbsp;more&nbsp;suitable&nbsp;to&nbsp;your&nbsp;case).&nbsp;</p>



<p>Now&nbsp;let&#8217;s&nbsp;start&nbsp;creating&nbsp;our&nbsp;test.&nbsp;In&nbsp;this&nbsp;case&nbsp;we&nbsp;will&nbsp;use&nbsp;<a href="https://my-json-server.typicode.com/">https://my-json-server.typicode.com/</a>&nbsp;to&nbsp;simulate&nbsp;an&nbsp;API. </p>



<p>Initially,&nbsp;let&#8217;s&nbsp;add&nbsp;a&nbsp;Thread&nbsp;Group.&nbsp;Right&nbsp;click&nbsp;on&nbsp;the&nbsp;test&nbsp;plan,&nbsp;then&nbsp;<strong>Add&nbsp;-&gt;&nbsp;Threads(Users)&nbsp;-&gt;&nbsp;Thread&nbsp;Group</strong>.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/ThreadGroup-1024x576.png" alt="" class="wp-image-12250" width="1069" height="602" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/ThreadGroup-1024x576.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/ThreadGroup-300x169.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/ThreadGroup-768x432.png 768w, https://blogit.create.pt/wp-content/uploads/2021/04/ThreadGroup-1536x864.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/ThreadGroup-696x392.png 696w, https://blogit.create.pt/wp-content/uploads/2021/04/ThreadGroup-1068x601.png 1068w, https://blogit.create.pt/wp-content/uploads/2021/04/ThreadGroup-747x420.png 747w, https://blogit.create.pt/wp-content/uploads/2021/04/ThreadGroup.png 1920w" sizes="(max-width: 1069px) 100vw, 1069px" /></figure>



<p>You&nbsp;can&nbsp;see&nbsp;that&nbsp;there&nbsp;is&nbsp;some&nbsp;settings&nbsp;that&nbsp;we&nbsp;need&nbsp;to&nbsp;adjust.&nbsp;At&nbsp;the&nbsp;top,&nbsp;there&nbsp;is&nbsp;a&nbsp;setting&nbsp;that&nbsp;says&nbsp;Action&nbsp;to&nbsp;be&nbsp;taken&nbsp;after&nbsp;a&nbsp;Sampler&nbsp;Error.&nbsp;Normally,&nbsp;I&nbsp;always&nbsp;use&nbsp;this&nbsp;in&nbsp;<strong>Continue</strong>&nbsp;but&nbsp;you&nbsp;can&nbsp;use&nbsp;the&nbsp;one&nbsp;that&nbsp;suits&nbsp;your&nbsp;case.</p>



<p>The&nbsp;next&nbsp;3&nbsp;settings&nbsp;will&nbsp;be&nbsp;the&nbsp;ones&nbsp;that&nbsp;we&nbsp;gonna&nbsp;focus&nbsp;for&nbsp;now.</p>



<ul class="wp-block-list"><li>Number&nbsp;of&nbsp;Threads&nbsp;(users)&nbsp;&#8211;&nbsp;is&nbsp;the&nbsp;number&nbsp;of&nbsp;threads(users)&nbsp;that&nbsp;will&nbsp;be&nbsp;running&nbsp;your&nbsp;test&nbsp;plan.</li><li>Ramp-up&nbsp;period&nbsp;(seconds)&nbsp;&#8211;&nbsp;is&nbsp;the&nbsp;value&nbsp;in&nbsp;seconds&nbsp;that&nbsp;defines&nbsp;how&nbsp;much&nbsp;time&nbsp;until&nbsp;all&nbsp;threads&nbsp;are&nbsp;working.&nbsp;Example:&nbsp;100&nbsp;Threads&nbsp;and&nbsp;10&nbsp;seconds&nbsp;of&nbsp;ramp-up&nbsp;period,&nbsp;this&nbsp;means&nbsp;that&nbsp;the&nbsp;threads&nbsp;will&nbsp;start,&nbsp;gradually,&nbsp;until&nbsp;at&nbsp;the&nbsp;point&nbsp;of&nbsp;10&nbsp;seconds&nbsp;all&nbsp;100&nbsp;threads&nbsp;will&nbsp;be&nbsp;working.</li><li>Loop&nbsp;Count&nbsp;&#8211;&nbsp;You&nbsp;can&nbsp;set&nbsp;this&nbsp;to&nbsp;the <strong>Infinite</strong>&nbsp;and&nbsp;will&nbsp;only&nbsp;stop&nbsp;threads&nbsp;when&nbsp;you&nbsp;press&nbsp;the&nbsp;button&nbsp;to&nbsp;stop.&nbsp;Also,&nbsp;you&nbsp;can&nbsp;set&nbsp;a&nbsp;loop&nbsp;count,&nbsp;that&nbsp;is&nbsp;the&nbsp;times&nbsp;that&nbsp;each&nbsp;thread&nbsp;will&nbsp;execute&nbsp;the&nbsp;test&nbsp;plan.&nbsp;Example,&nbsp;if&nbsp;you&nbsp;put&nbsp;the&nbsp;value&nbsp;3,&nbsp;the&nbsp;threads&nbsp;will&nbsp;execute&nbsp;the&nbsp;plan&nbsp;3&nbsp;times&nbsp;and&nbsp;then&nbsp;will&nbsp;stop.</li></ul>



<p>So,&nbsp;in&nbsp;our&nbsp;example&nbsp;lets&nbsp;try&nbsp;10&nbsp;threads,&nbsp;with&nbsp;5&nbsp;seconds&nbsp;of&nbsp;Ramp-up&nbsp;Time&nbsp;and&nbsp;the&nbsp;value&nbsp;3&nbsp;in&nbsp;the&nbsp;loop&nbsp;count.&nbsp;I&nbsp;will&nbsp;also&nbsp;change&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;thread&nbsp;group&nbsp;to&nbsp;know&nbsp;how&nbsp;many&nbsp;threads&nbsp;I&nbsp;am&nbsp;using.&nbsp;It&nbsp;Should&nbsp;look&nbsp;like&nbsp;this.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/10Threads-1024x576.png" alt="" class="wp-image-12251" width="1068" height="602" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/10Threads-1024x576.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/10Threads-300x169.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/10Threads-768x432.png 768w, https://blogit.create.pt/wp-content/uploads/2021/04/10Threads-1536x864.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/10Threads-696x392.png 696w, https://blogit.create.pt/wp-content/uploads/2021/04/10Threads-1068x601.png 1068w, https://blogit.create.pt/wp-content/uploads/2021/04/10Threads-747x420.png 747w, https://blogit.create.pt/wp-content/uploads/2021/04/10Threads.png 1920w" sizes="(max-width: 1068px) 100vw, 1068px" /></figure>



<p>Let&#8217;s&nbsp;continue&nbsp;adding&nbsp;more&nbsp;components.&nbsp;This&nbsp;time, let&#8217;s&nbsp;add&nbsp;a&nbsp;way&nbsp;to&nbsp;define&nbsp;variables.&nbsp;Right-click&nbsp;on&nbsp;the&nbsp;Thread&nbsp;Group,&nbsp;then&nbsp;<strong>Add&nbsp;-&gt;&nbsp;Config-Element&nbsp;-&gt;&nbsp;User&nbsp;Defined&nbsp;Variables</strong>.&nbsp;</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/Variables-1024x251.png" alt="" class="wp-image-12252" width="1067" height="262" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/Variables-1024x251.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/Variables-300x73.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/Variables-768x188.png 768w, https://blogit.create.pt/wp-content/uploads/2021/04/Variables-1536x376.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/Variables-696x170.png 696w, https://blogit.create.pt/wp-content/uploads/2021/04/Variables-1068x261.png 1068w, https://blogit.create.pt/wp-content/uploads/2021/04/Variables-1716x420.png 1716w, https://blogit.create.pt/wp-content/uploads/2021/04/Variables.png 1920w" sizes="(max-width: 1067px) 100vw, 1067px" /></figure>



<p>This&nbsp;component&nbsp;will&nbsp;let&nbsp;you&nbsp;define&nbsp;some&nbsp;variable&nbsp;to&nbsp;use&nbsp;afterwards.&nbsp;Let&#8217;s&nbsp;define&nbsp;some.</p>



<ul class="wp-block-list"><li>url:&nbsp;my-json-server.typicode.com</li><li>postId:&nbsp;1</li></ul>



<p>&nbsp;Now,&nbsp;to&nbsp;use&nbsp;these&nbsp;variables&nbsp;in&nbsp;other&nbsp;components&nbsp;you&nbsp;will&nbsp;need&nbsp;to&nbsp;do&nbsp;it&nbsp;in&nbsp;the&nbsp;following&nbsp;way.</p>



<ul class="wp-block-list"><li>${url}&nbsp;for&nbsp;the&nbsp;<strong>url</strong>&nbsp;Value&nbsp;</li><li>${postId}&nbsp;for&nbsp;the&nbsp;<strong>postId</strong>&nbsp;Value</li></ul>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/userVariable-1024x203.png" alt="" class="wp-image-12253" width="1069" height="213" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/userVariable-1024x203.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/userVariable-300x59.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/userVariable-768x152.png 768w, https://blogit.create.pt/wp-content/uploads/2021/04/userVariable-1536x304.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/userVariable-696x138.png 696w, https://blogit.create.pt/wp-content/uploads/2021/04/userVariable-1068x212.png 1068w, https://blogit.create.pt/wp-content/uploads/2021/04/userVariable.png 1923w" sizes="(max-width: 1069px) 100vw, 1069px" /></figure>



<p>Finally,&nbsp;let&#8217;s&nbsp;add&nbsp;some&nbsp;real&nbsp;requests.&nbsp;Here&nbsp;as&nbsp;example&nbsp;we&nbsp;will&nbsp;make&nbsp;3&nbsp;different&nbsp;requests.&nbsp;Http&nbsp;Request&nbsp;to&nbsp;get&nbsp;all&nbsp;posts,&nbsp;Http&nbsp;Request&nbsp;to&nbsp;get&nbsp;one&nbsp;Post,&nbsp;and&nbsp;Http&nbsp;Request&nbsp;to&nbsp;Post&nbsp;a&nbsp;new&nbsp;Post.&nbsp;Remember&nbsp;that&nbsp;the&nbsp;site&nbsp;used&nbsp;in&nbsp;this&nbsp;example&nbsp;has&nbsp;paths&nbsp;to&nbsp;request&nbsp;posts&nbsp;and&nbsp;to&nbsp;add&nbsp;posts.</p>



<p>How&nbsp;to&nbsp;add&nbsp;an&nbsp;HTTP&nbsp;Request&nbsp;?&nbsp;Right-click&nbsp;on&nbsp;the&nbsp;Thread&nbsp;Group,&nbsp;then&nbsp;<strong>Add&nbsp;-&gt;&nbsp;Smapler&nbsp;-&gt;&nbsp;Http&nbsp;Request</strong>.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/HttpRequest-1024x277.png" alt="" class="wp-image-12255" width="1069" height="290" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/HttpRequest-1024x277.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/HttpRequest-300x81.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/HttpRequest-768x208.png 768w, https://blogit.create.pt/wp-content/uploads/2021/04/HttpRequest-1536x416.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/HttpRequest-696x188.png 696w, https://blogit.create.pt/wp-content/uploads/2021/04/HttpRequest-1068x289.png 1068w, https://blogit.create.pt/wp-content/uploads/2021/04/HttpRequest-1551x420.png 1551w, https://blogit.create.pt/wp-content/uploads/2021/04/HttpRequest.png 1935w" sizes="(max-width: 1069px) 100vw, 1069px" /></figure>



<p>Now&nbsp;that&nbsp;we&nbsp;have&nbsp;an&nbsp;Http&nbsp;Request&nbsp;component,&nbsp;let&#8217;s&nbsp;configure&nbsp;to&nbsp;make&nbsp;a&nbsp;Http&nbsp;Request&nbsp;to&nbsp;get&nbsp;all&nbsp;posts.&nbsp;The&nbsp;path&nbsp;to&nbsp;this&nbsp;request&nbsp;is&nbsp;<span style="text-decoration: underline">https://jsonplaceholder.typicode.com/posts</span>. The&nbsp;configurations&nbsp;of&nbsp;this&nbsp;component&nbsp;are:</p>



<ul class="wp-block-list"><li><strong>Protocol</strong>&nbsp;-&gt;&nbsp;&#8220;https&#8221;</li><li><strong>Server&nbsp;Name&nbsp;or&nbsp;IP</strong>&nbsp;-&gt;&nbsp;${url}&nbsp;(because&nbsp;we&nbsp;have&nbsp;this&nbsp;value&nbsp;defined&nbsp;in&nbsp;a&nbsp;variable)</li><li><strong>Port&nbsp;Number</strong> -&gt;&nbsp;in&nbsp;this&nbsp;case, nothing but&nbsp;if&nbsp;you&nbsp;need&nbsp;to&nbsp;your&nbsp;specific&nbsp;case,&nbsp;here&nbsp;is&nbsp;where&nbsp;you&nbsp;put&nbsp;the&nbsp;port&nbsp;number.&nbsp;Example:&nbsp;to&nbsp;make&nbsp;a&nbsp;request&nbsp;to&nbsp;https://localhost:80,&nbsp;you&nbsp;would&nbsp;need&nbsp;to&nbsp;put&nbsp;the&nbsp;value&nbsp;80&nbsp;in&nbsp;here.</li><li><strong>HTTP&nbsp;Request</strong>&nbsp;-&gt;&nbsp;GET</li><li><strong>Path</strong>&nbsp;-&gt;&nbsp;&#8220;/typicode/demo/posts&#8221;</li></ul>



<p>Now&nbsp;that&nbsp;we&nbsp;have&nbsp;everything,&nbsp;let&#8217;s&nbsp;run&nbsp;?&nbsp;Click&nbsp;on&nbsp;the&nbsp;start&nbsp;Button&nbsp;above&nbsp;and&nbsp;see&nbsp;what&nbsp;happens.&nbsp;Nothing&nbsp;?&nbsp;Stop&nbsp;the&nbsp;process&nbsp;and&nbsp;let&#8217;s&nbsp;see&nbsp;what&nbsp;is&nbsp;missing.</p>



<p>The&nbsp;piece&nbsp;that&nbsp;is&nbsp;missing&nbsp;is&nbsp;<strong>listeners</strong>.&nbsp;We&nbsp;need&nbsp;listeners&nbsp;to&nbsp;understand&nbsp;what&nbsp;is&nbsp;happening.&nbsp;In&nbsp;this&nbsp;case,&nbsp;the&nbsp;<strong>View&nbsp;Results&nbsp;Tree</strong>&nbsp;and&nbsp;<strong>Summary&nbsp;Report</strong>.&nbsp;Let&#8217;s&nbsp;add&nbsp;these&nbsp;two&nbsp;listeners&nbsp;by&nbsp;Right-clicking&nbsp;in&nbsp;the&nbsp;Thread&nbsp;Group,&nbsp;then&nbsp;<strong>Add&nbsp;-&gt;&nbsp;Listener&nbsp;-&gt;&nbsp;View&nbsp;Results&nbsp;Tree</strong>&nbsp;and&nbsp;<strong>Add&nbsp;-&gt;&nbsp;Listener&nbsp;-&gt;&nbsp;Summary&nbsp;Report</strong>.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/Listeners-1024x246.png" alt="" class="wp-image-12256" width="1070" height="258" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/Listeners-1024x246.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/Listeners-300x72.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/Listeners-768x184.png 768w, https://blogit.create.pt/wp-content/uploads/2021/04/Listeners-1536x369.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/Listeners-696x167.png 696w, https://blogit.create.pt/wp-content/uploads/2021/04/Listeners-1750x420.png 1750w, https://blogit.create.pt/wp-content/uploads/2021/04/Listeners.png 1908w" sizes="(max-width: 1070px) 100vw, 1070px" /></figure>



<p>Now,&nbsp;if&nbsp;you&nbsp;start&nbsp;the&nbsp;process,&nbsp;you&nbsp;will&nbsp;see&nbsp;that&nbsp;these&nbsp;listeners&nbsp;represent&nbsp;information&nbsp;about&nbsp;the&nbsp;request.&nbsp;</p>



<p>The&nbsp;View&nbsp;Results&nbsp;Tree&nbsp;show&nbsp;every&nbsp;request&nbsp;information.&nbsp;In&nbsp;here,&nbsp;you&nbsp;can&nbsp;see&nbsp;the&nbsp;request&nbsp;body&nbsp;and&nbsp;headers,&nbsp;and&nbsp;the&nbsp;response&nbsp;body&nbsp;and&nbsp;headers.</p>



<p>In&nbsp;this&nbsp;example,&nbsp;when&nbsp;we&nbsp;choose&nbsp;the&nbsp;<strong>Response&nbsp;Body</strong>&nbsp;of&nbsp;one&nbsp;request&nbsp;we&nbsp;will&nbsp;see&nbsp;that&nbsp;there&nbsp;will&nbsp;be&nbsp;a&nbsp;JSON&nbsp;with&nbsp;data&nbsp;relative&nbsp;to&nbsp;what&nbsp;they&nbsp;call&nbsp;as&nbsp;posts.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/PostsExample-1024x551.png" alt="" class="wp-image-12257" width="1072" height="578" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/PostsExample-1024x551.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/PostsExample-300x161.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/PostsExample-768x413.png 768w, https://blogit.create.pt/wp-content/uploads/2021/04/PostsExample-1536x827.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/PostsExample-696x375.png 696w, https://blogit.create.pt/wp-content/uploads/2021/04/PostsExample-1068x575.png 1068w, https://blogit.create.pt/wp-content/uploads/2021/04/PostsExample-780x420.png 780w, https://blogit.create.pt/wp-content/uploads/2021/04/PostsExample.png 1906w" sizes="(max-width: 1072px) 100vw, 1072px" /></figure>



<p>The&nbsp;Summary&nbsp;Report&nbsp;Aggregates&nbsp;the&nbsp;information&nbsp;of&nbsp;different&nbsp;types&nbsp;of&nbsp;request.&nbsp;In&nbsp;this&nbsp;case,&nbsp;we&nbsp;only&nbsp;have&nbsp;one&nbsp;request,&nbsp;so,&nbsp;it&nbsp;will&nbsp;show&nbsp;informations&nbsp;about&nbsp;that&nbsp;request.What&nbsp;are&nbsp;the&nbsp;informations&nbsp;that&nbsp;this&nbsp;will&nbsp;show&nbsp;?&nbsp;</p>



<ul class="wp-block-list"><li>#Samples&nbsp;&#8211;&nbsp;are&nbsp;the&nbsp;number&nbsp;of&nbsp;requests&nbsp;made&nbsp;</li><li>Average&nbsp;&#8211;&nbsp;shows&nbsp;&nbsp;the&nbsp;average&nbsp;time&nbsp;needed&nbsp;to&nbsp;make&nbsp;these&nbsp;requests&nbsp;</li><li>Min&nbsp;&#8211;&nbsp;shows&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;request&nbsp;that&nbsp;take&nbsp;less&nbsp;time&nbsp;to&nbsp;finish</li><li>Max&nbsp;&#8211;&nbsp;shows&nbsp;the&nbsp;value&nbsp;of&nbsp;the&nbsp;request&nbsp;that&nbsp;take&nbsp;more&nbsp;time&nbsp;to&nbsp;finish</li><li>Std.&nbsp;Dev.&nbsp;&#8211;&nbsp;shows&nbsp;the&nbsp;standard&nbsp;deviation&nbsp;of&nbsp;the&nbsp;request&nbsp;times&nbsp;to&nbsp;the&nbsp;average</li><li>Error&nbsp;%&nbsp;&#8211;&nbsp;shows&nbsp;the&nbsp;percentage&nbsp;of&nbsp;requests&nbsp;that&nbsp;failed</li><li>Throughput&nbsp;&#8211;&nbsp;shows&nbsp;the&nbsp;number&nbsp;of&nbsp;requests&nbsp;processed&nbsp;by&nbsp;time&nbsp;</li><li>Received&nbsp;KB/sec&nbsp;&#8211;&nbsp;&nbsp;shows&nbsp;the&nbsp;amount&nbsp;of&nbsp;data&nbsp;downloaded&nbsp;from&nbsp;the&nbsp;server&nbsp;&nbsp;time</li><li>Sent&nbsp;KB/sec&nbsp;&#8211;&nbsp;shows&nbsp;the&nbsp;amount&nbsp;of&nbsp;data&nbsp;uploaded&nbsp;to&nbsp;the&nbsp;server&nbsp;time&nbsp;</li><li>Avg.&nbsp;Bytes&nbsp;&#8211;&nbsp;shows&nbsp;the&nbsp;average&nbsp;size&nbsp;of&nbsp;the&nbsp;response&nbsp;sample</li></ul>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/SummaryReport-1024x181.png" alt="" class="wp-image-12259" width="1069" height="190" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/SummaryReport-1024x181.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/SummaryReport-300x53.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/SummaryReport-768x136.png 768w, https://blogit.create.pt/wp-content/uploads/2021/04/SummaryReport-1536x271.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/SummaryReport-696x123.png 696w, https://blogit.create.pt/wp-content/uploads/2021/04/SummaryReport-1068x189.png 1068w, https://blogit.create.pt/wp-content/uploads/2021/04/SummaryReport.png 1920w" sizes="(max-width: 1069px) 100vw, 1069px" /></figure>



<p>We&nbsp;have&nbsp;all&nbsp;we&nbsp;need,&nbsp;let&#8217;s&nbsp;add&nbsp;more&nbsp;Requests.&nbsp;Let&#8217;s&nbsp;create&nbsp;a&nbsp;request&nbsp;that&nbsp;creates&nbsp;a&nbsp;post,&nbsp;and&nbsp;create&nbsp;a&nbsp;request&nbsp;that&nbsp;obtains&nbsp;only&nbsp;one&nbsp;post.&nbsp;Also,&nbsp;change&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;Http&nbsp;Request&nbsp;components&nbsp;to&nbsp;now&nbsp;what&nbsp;is&nbsp;the&nbsp;correspondent&nbsp;request.&nbsp;Remember&nbsp;to&nbsp;put&nbsp;the&nbsp;Http&nbsp;Request&nbsp;before&nbsp;the&nbsp;listeners.&nbsp;The&nbsp;Listeners&nbsp;will&nbsp;only&nbsp;listen&nbsp;to&nbsp;what&nbsp;are&nbsp;before&nbsp;them.&nbsp;Remember&nbsp;this!&nbsp;</p>



<p>The&nbsp;create&nbsp;a&nbsp;post&nbsp;request&nbsp;configurations&nbsp;are:</p>



<ol class="wp-block-list"><li><strong>Protocol</strong>&nbsp;-&gt;&nbsp;&#8220;https&#8221;</li><li><strong>Server&nbsp;Name&nbsp;or&nbsp;IP</strong>&nbsp;-&gt;&nbsp;${url}&nbsp;(because&nbsp;we&nbsp;have&nbsp;this&nbsp;value&nbsp;defined&nbsp;in&nbsp;a&nbsp;variable)</li><li><strong>HTTP&nbsp;Request</strong>&nbsp;-&gt;&nbsp;Post</li><li><strong>Path</strong>&nbsp;-&gt;&nbsp;&#8220;/typicode/demo/posts&#8221;</li><li><strong>Body&nbsp;Data</strong>&nbsp;&#8211;&nbsp;we&nbsp;will&nbsp;put&nbsp;a&nbsp;JSON&nbsp;like&nbsp;this&nbsp;{&#8220;title&#8221;:&nbsp;&#8220;Car&nbsp;Crash&#8221;}</li></ol>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://blogit.create.pt/wp-content/uploads/2021/04/CreatePost-1024x306.png" alt="" class="wp-image-12261" width="1086" height="326" srcset="https://blogit.create.pt/wp-content/uploads/2021/04/CreatePost-1024x306.png 1024w, https://blogit.create.pt/wp-content/uploads/2021/04/CreatePost-300x90.png 300w, https://blogit.create.pt/wp-content/uploads/2021/04/CreatePost-1536x459.png 1536w, https://blogit.create.pt/wp-content/uploads/2021/04/CreatePost-696x208.png 696w" sizes="(max-width: 1086px) 100vw, 1086px" /></figure>



<p>And,&nbsp;The&nbsp;get&nbsp;one&nbsp;post&nbsp;request&nbsp;configurations&nbsp;are:</p>



<ol class="wp-block-list" id="block-add80d93-dc9f-41db-9cbc-14ed3602e60e"><li><strong>Protocol</strong>&nbsp;-&gt;&nbsp;&#8220;https&#8221;</li><li><strong>Server&nbsp;Name&nbsp;or&nbsp;IP</strong>&nbsp;-&gt;&nbsp;${url}&nbsp;(because&nbsp;we&nbsp;have&nbsp;this&nbsp;value&nbsp;defined&nbsp;in&nbsp;a&nbsp;variable)</li><li><strong>HTTP&nbsp;Request</strong>&nbsp;-&gt;&nbsp;Get</li><li><strong>Path</strong>&nbsp;-&gt;&nbsp;&#8220;/typicode/demo/posts/${postId}&#8221;</li></ol>



<p>Run&nbsp;the&nbsp;test&nbsp;plan&nbsp;and&nbsp;see&nbsp;the&nbsp;results.&nbsp;Try&nbsp;to&nbsp;do&nbsp;it&nbsp;for&nbsp;another&nbsp;API.&nbsp;</p>



<p>These&nbsp;are&nbsp;the&nbsp;basic&nbsp;examples&nbsp;that&nbsp;we&nbsp;have&nbsp;for&nbsp;you&nbsp;right&nbsp;now.&nbsp;More&nbsp;advanced&nbsp;tips&nbsp;will&nbsp;come.&nbsp;</p>



<p>See&nbsp;you&nbsp;next&nbsp;time.</p>



<h3 class="wp-block-heading">References</h3>



<ul class="wp-block-list"><li><a href="https://www.guru99.com/jmeter-element-reference.html ">https://www.guru99.com/jmeter-element-reference.html</a></li><li><a href="https://www.guru99.com/hands-on-with-jmeter-gui.html">https://www.guru99.com/hands-on-with-jmeter-gui.html</a></li></ul>



<p></p>
<p>The post <a href="https://blogit.create.pt/diogocoelho/2021/04/23/performance-testing-an-api-how-to-start-doing-it-with-jmeter/">Performance Testing An API, How To Start Doing It With JMeter?</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/diogocoelho/2021/04/23/performance-testing-an-api-how-to-start-doing-it-with-jmeter/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
