<?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: TaheraFirdose</title>
    <description>The latest articles on DEV Community by TaheraFirdose (@taherafirdose).</description>
    <link>https://dev.to/taherafirdose</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%2F647549%2Fb00166d8-7f5c-4a66-bf66-1f08fd7976d6.jpeg</url>
      <title>DEV Community: TaheraFirdose</title>
      <link>https://dev.to/taherafirdose</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/taherafirdose"/>
    <language>en</language>
    <item>
      <title>Payload Creation using Org.Json Library - Part 7</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Sat, 16 Oct 2021 14:19:01 +0000</pubDate>
      <link>https://dev.to/taherafirdose/payload-creation-using-orgjson-library-part-7-2ph</link>
      <guid>https://dev.to/taherafirdose/payload-creation-using-orgjson-library-part-7-2ph</guid>
      <description>&lt;p&gt;In this blog we will learn how to create Payload using Org.json library and will see three different flows as below&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Sending simple payload&lt;/li&gt;
&lt;li&gt; Sending complex payload&lt;/li&gt;
&lt;li&gt; Sending payload using Array&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;JSON, as you know, is nothing more than a data representation using Object and Array. As a result, we can also construct payloads using the JSONObject and JSONArray classes. To use this feature, however, you must include the org.json library in your project. To obtain the org.json library, include this dependency in your project.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Steps:
&lt;/h3&gt;

&lt;p&gt;1.Create an object of the JSONObject class, in our case we create data Object and we will be assigning the values using put method.&lt;/p&gt;

&lt;h5&gt;
  
  
  Important Note:
&lt;/h5&gt;

&lt;p&gt;It is important to note that we must first convert the object of the JSONObject class to a string before passing it to the body method.&lt;/p&gt;

&lt;p&gt;To assign the values, we'll use the put() method. It should not be confused with a PUT Http request. Both of these are distinct from one another&lt;/p&gt;

&lt;p&gt;2.We are going to add below json.&lt;/p&gt;

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

&lt;p&gt;3.Create a class PostRequest_Simple_OrgJSON.java and add the below code.&lt;/p&gt;

&lt;p&gt;The org.json.simple package includes a class called JSONObject. This class represents a JSON string programmatically. Take a look at the Request JSON above; you'll note that it contains numerous nodes. The JSONObject.put(String, String) method can be used to add each node. After you've added all of the nodes, use the JSONObject.toJSONString() function to acquire the String representation of JSONObject.&lt;/p&gt;

&lt;p&gt;we will simply add the JSON String to the body of the HTTP Request and make sure that the Content-Type is json.&lt;/p&gt;

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

&lt;p&gt;4.Start the Json Server and the resource URI’s will be created as per the structure of the file: &lt;/p&gt;

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

&lt;p&gt;5.Run the program and verify the results in the output window:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZUuMgcm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y7v6cnv0wheb93j239g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZUuMgcm3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y7v6cnv0wheb93j239g.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6.Verify the result in the db.json file. Open the file in Notepad and double-check the data posted by the above program.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3wCcMr64--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4aifbwf0r6mgnlaz6bi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3wCcMr64--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4aifbwf0r6mgnlaz6bi.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7.The same can also be viewed in browser for the Items. &lt;/p&gt;

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

&lt;h2&gt;
  
  
  Sending Complex Json using Org.json:
&lt;/h2&gt;

&lt;p&gt;Complex json is nested json or we can say its a json within a json. Below is the example of how complex json looks like.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Steps:
&lt;/h3&gt;

&lt;p&gt;1.Create an object of the JSONObject class, in our case we create data Object for main json and childObject for nested json and we will be assigning the values using put method.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x7adwC-d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jmxx1wtrybpnw0zatxw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x7adwC-d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jmxx1wtrybpnw0zatxw.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.Start the Json Server and the resource URI’s will be created as per the structure of the file&lt;/p&gt;

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

&lt;p&gt;3.Run the program and verify the results in the output window:&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MS08xGu9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84smw6ydsj0rhzr8ra27.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MS08xGu9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84smw6ydsj0rhzr8ra27.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4.Verify the result in the db.json file. Open the file in Notepad and double-check the data posted by the above program.&lt;/p&gt;

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

&lt;p&gt;5.The same can also be viewed in browser for the Items.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Sending Json in Array form using Org.json:
&lt;/h2&gt;

&lt;p&gt;In the below json we can see we have main json and a nested json. The nested json consist of an array.&lt;/p&gt;

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

&lt;p&gt;1.Create an object of the JSONObject class, in our case we create dataObject for main json and childJson for nested json . Since topping consist of array we will create three array objects arrayOne, arrayTwo, arrayThree and we will be assigning the values using put method.&lt;/p&gt;

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

&lt;p&gt;2.Start the Json Server and the resource URI’s will be created as per the structure of the file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8ITw-jdb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d3krwi9eou47ug02o41m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8ITw-jdb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d3krwi9eou47ug02o41m.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.Run the program and verify the results in the output window: &lt;/p&gt;

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

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

&lt;p&gt;4.Verify the result in the db.json file. Open the file in Notepad and double-check the data posted by the above program.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MdQ-tCk_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nv62h2ox6ithrlxtqpjz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MdQ-tCk_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nv62h2ox6ithrlxtqpjz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.The same can also be viewed in browser for the Items.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N4Ksjcgw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87tw0x2vzv42nwu2jlr8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N4Ksjcgw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87tw0x2vzv42nwu2jlr8.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Multiple ways to send Payload - Part 6</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Thu, 16 Sep 2021 06:38:56 +0000</pubDate>
      <link>https://dev.to/taherafirdose/multiple-ways-to-send-payload-part-6-1a6f</link>
      <guid>https://dev.to/taherafirdose/multiple-ways-to-send-payload-part-6-1a6f</guid>
      <description>&lt;p&gt;In this blog, we are going to discuss more about POST request testing and automation using RestAssured. Request Body parameter is also called payload. In our previous blog we saw how to send payload as strings. &lt;/p&gt;

&lt;p&gt;There are three ways to send json payload.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using Json File &lt;/li&gt;
&lt;li&gt;Using Org.JSON &lt;/li&gt;
&lt;li&gt;Using POJO&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this tutorial we will learn about passing json data as a file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pass JSON file as payload
&lt;/h2&gt;

&lt;p&gt;Create a .json file in “src/test/resources” folder and write payload in that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NNb0z3Eu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgxdo8s9inzpxjvkhmne.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NNb0z3Eu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgxdo8s9inzpxjvkhmne.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Mention this file location using the File class in Java. Your file object will look like this:&lt;/p&gt;

&lt;h4&gt;
  
  
  File jsonData = new File(“src\test\resources\jsondemo.json”)
&lt;/h4&gt;

&lt;h4&gt;
  
  
  Below is the post request:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Tr2Fuedv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sa1ltjj3g3csg4iqdggk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tr2Fuedv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sa1ltjj3g3csg4iqdggk.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Below is the output after code execution:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wTDsNz5n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gmtgoysy9nii0hglyj1f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wTDsNz5n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gmtgoysy9nii0hglyj1f.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating Payload as JSON Object:
&lt;/h3&gt;

&lt;p&gt;JSON, as you know, is nothing more than a data representation using Object and Array. As a result, we can also construct payloads using the JSONObject and JSONArray classes. To use this feature, however, you must include the org.json library in your project. To obtain the org.json library, include this dependency in your project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BfIoeLb4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ju2fkevi4g9f0x2if9rw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BfIoeLb4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ju2fkevi4g9f0x2if9rw.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6kK7Wcc_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46e7i2s18rcdl3lglors.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6kK7Wcc_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46e7i2s18rcdl3lglors.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So here's the code and explanation for converting above JSON to JSONObject.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ReOU9h4b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5k0gauvtkudze88ljhi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ReOU9h4b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5k0gauvtkudze88ljhi.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to pass the json object in the body as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XZtyFh5w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/whvyd5jhu42hn17zisf9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XZtyFh5w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/whvyd5jhu42hn17zisf9.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to send POST Request in Rest Assured - Part 5</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Wed, 08 Sep 2021 05:45:26 +0000</pubDate>
      <link>https://dev.to/taherafirdose/how-to-send-post-request-in-rest-assured-part-5-1lk0</link>
      <guid>https://dev.to/taherafirdose/how-to-send-post-request-in-rest-assured-part-5-1lk0</guid>
      <description>&lt;p&gt;In the previous blog, we covered the basic terminology that we will be using during rest assured testing. We also learned how to setup Rest Assured JAR or maven dependency in our project.&lt;/p&gt;

&lt;p&gt;Rest Assured supports all the HTTP methods like GET, POST, PUT and DELETE. Here GET stands for Read operation, POST stands for Write operation, PUT stands for Update operation and DELETE stands for Delete operation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Once you have the import of REST Assured set up, add the following static imports to your test class:
&lt;/h3&gt;

&lt;p&gt;import static io.restassured.RestAssured.&lt;em&gt;;&lt;br&gt;
import static org.hamcrest.Matchers.&lt;/em&gt;;&lt;/p&gt;

&lt;h3&gt;
  
  
  Now let's look at an example of POST Request using Rest Assured
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OPs13CMh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jtibd9mydg1gbfnirtw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OPs13CMh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jtibd9mydg1gbfnirtw.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1.Set URI:
&lt;/h3&gt;

&lt;p&gt;First we need to set the base uri of our api.. The base url without the resource is represented by uri. In our case, the full url is &lt;a href="http://localhost:3000/comments"&gt;http://localhost:3000/comments&lt;/a&gt;, and the uri is &lt;a href="http://localhost:3000/"&gt;http://localhost:3000/&lt;/a&gt;, with comment as the rescue name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GVU-pnRA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6axo9cj1n92bzlw8y545.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GVU-pnRA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6axo9cj1n92bzlw8y545.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Call post method
&lt;/h3&gt;

&lt;p&gt;In the post method, we begin with the Given method and specify the data to be added as a String in the body method. We simply add a check ‘contentType(ContentType.JSON)‘ to make sure that the response we get is in JSON format and under POST method we specify the path '/comment'&lt;/p&gt;

&lt;h3&gt;
  
  
  3.Validate Response Code
&lt;/h3&gt;

&lt;p&gt;Validating http status code of the response is quite easy using Rest Assured. The method statusCode() takes an integer as input and validate against the response code. If the status code is not matching with the actual one, then the test case will fail. Any validation we want to perform can be written after .then().&lt;/p&gt;

&lt;h3&gt;
  
  
  4.Rest Assured – Validate Response Content
&lt;/h3&gt;

&lt;p&gt;Validating response content from the JSON response is quite easy using rest assured. Check below the way we are validating the comment from the JSON response.&lt;br&gt;
Here the function body takes 2 parameters. First one is the path to the field which we want to validate. In this case, it is the comment. Here we are using org.hamcrest.CoreMatchers.equalTo() method as well to compare the content against expected response. Also notice that we have combined the status code validation and response body validation together.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Number Validation Using Rest Assured
&lt;/h3&gt;

&lt;p&gt;We can use the same equalTo method to validate numbers as long as they are integers. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SLt0qC1l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sp0wvve3sqghw7dyx83r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SLt0qC1l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sp0wvve3sqghw7dyx83r.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Below is the output after code execution
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j2Em1Bt9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tkvgwp69igchz9frm5cy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j2Em1Bt9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tkvgwp69igchz9frm5cy.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Rest Assured E2E Testing - Part 4</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Sun, 05 Sep 2021 16:19:36 +0000</pubDate>
      <link>https://dev.to/taherafirdose/rest-assured-e2e-testing-part-4-22c</link>
      <guid>https://dev.to/taherafirdose/rest-assured-e2e-testing-part-4-22c</guid>
      <description>&lt;h1&gt;
  
  
  Understanding HTTPS methods, status codes and syntax
&lt;/h1&gt;

&lt;h2&gt;
  
  
  What is HTTP?
&lt;/h2&gt;

&lt;p&gt;The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. This is the foundation for data communication for the World Wide Web (i.e. internet) since 1990. HTTP is a generic and stateless protocol which can be used for other purposes as well using extensions of its request methods, error codes, and headers.&lt;/p&gt;

&lt;p&gt;In Simple, HTTP works as a request-response protocol between a client and server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Different Types of HTTP Methods:
&lt;/h2&gt;

&lt;h4&gt;
  
  
  GET:
&lt;/h4&gt;

&lt;p&gt;GET requests should only be used to retrieve resource representation/information – not to modify it in any way. Because GET requests do not alter the state of the resource, they are considered safe methods.&lt;br&gt;
For any given HTTP GET API, if the resource is found on the server, then it must return HTTP response code 200 (OK) – along with the response body, which is usually either XML or JSON content (due to their platform-independent nature).&lt;/p&gt;

&lt;h3&gt;
  
  
  POST:
&lt;/h3&gt;

&lt;p&gt;A POST request is used to create a new resource into the collection of resources.&lt;br&gt;
If a resource is created on the origin server, the response SHOULD be HTTP response code 201 (Created) and include an entity that describes the status of the request and refers to the new resource, as well as a Location header.&lt;/p&gt;

&lt;h4&gt;
  
  
  PUT:
&lt;/h4&gt;

&lt;p&gt;PUT APIs are primarily used to update existing resources (if the resource does not exist, then API may decide to create a new resource or not). If the PUT API creates a new resource, the origin server MUST notify the user agent via the HTTP response code 201 (Created), and if an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful request completion.&lt;/p&gt;

&lt;h4&gt;
  
  
  DELETE
&lt;/h4&gt;

&lt;p&gt;DELETE APIs, as the name implies, are used to delete resources (identified by the Request-URI).&lt;br&gt;
A successful response of DELETE requests SHOULD be HTTP response code 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has been queued, or 204 (No Content) if the action has been performed but the response does not include an entity.&lt;/p&gt;

&lt;h4&gt;
  
  
  PATCH
&lt;/h4&gt;

&lt;p&gt;PATCH requests are used to perform a partial update on a resource. PUT requests also modify a resource entity, so to be clear – the PATCH method is the correct choice for partially updating an existing resource, and PUT should only be used if you are completely replacing a resource.&lt;/p&gt;

&lt;h4&gt;
  
  
  HTTP Response codes
&lt;/h4&gt;

&lt;p&gt;The HTTP response codes are divided broadly in five categories :&lt;br&gt;
• 1xx – Informational codes&lt;br&gt;
• 2xx – Success codes&lt;br&gt;
• 3xx – Redirect codes&lt;br&gt;
• 4xx – Client error codes&lt;br&gt;
• 5xx – Server error codes&lt;/p&gt;

&lt;h4&gt;
  
  
  Some of the most common HTTP response codes used with REST are as follows :
&lt;/h4&gt;

&lt;p&gt;•200 (OK): This response  code indicates that the request was made successfully.&lt;br&gt;
•201 (Created): This response code indicates that request was successful and a resource was created. It is used to confirm success of a PUT or POST request.&lt;br&gt;
•400 (Bad Request) : This code indicates that the data is in incorrect format.&lt;br&gt;
•401 (Unauthorized) : This code indicates an authentication error.&lt;br&gt;
•405 (Method Not Allowed) : This code indicates that HTTP method used is not supported for this resource.&lt;br&gt;
•409 (Conflict) : This code indicates that there is a conflict request to create the same resource twice.&lt;br&gt;
•404 (Not Found) :This code indicates that the required resource could not be found.&lt;br&gt;
•500 (Internal Server Error) : This code indicates that there is some error on Server side.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Payload?
&lt;/h3&gt;

&lt;p&gt;The body of your request and response message is the Payload of an API Module. It holds the information that you send to the server when you make an API request. Payload can be sent and received in a variety of formats, including JSON.&lt;/p&gt;

&lt;h4&gt;
  
  
  JSON Syntax Rules
&lt;/h4&gt;

&lt;p&gt;• Data is in name/value pairs&lt;br&gt;
• Data is separated by commas&lt;br&gt;
• Curly braces hold objects&lt;br&gt;
• Square brackets hold arrays&lt;/p&gt;

&lt;h3&gt;
  
  
  WHAT is JSON?
&lt;/h3&gt;

&lt;p&gt;JSON stands for JavaScript Object Notation and it is lightweight format for storing and transporting data and is often used when data is sent from a server to a web page.&lt;/p&gt;

&lt;p&gt;Below is the sample JSON File.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wOTxquwz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3p4i61jrxdbtfj16w2cq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wOTxquwz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3p4i61jrxdbtfj16w2cq.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What Is XML?
&lt;/h3&gt;

&lt;p&gt;XML stands for extensible Markup Language. It plays an important role in many different IT systemsand  is often used for distributing data over the Internet.&lt;/p&gt;

&lt;p&gt;Below is the sample XML File.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ed75HSjv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0msmj4k2vx1t7c4v84sw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ed75HSjv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0msmj4k2vx1t7c4v84sw.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Rest Assured is one of the most powerful libraries for testing RESTful API using Java language. This should be the first-choice when you need to test a REST. All tests should be written in the BDD (Behavior Driven Development) format and its framework syntax is very clean and easy to use. The framework sends a network request to an application under test and verifies the response based on the expectations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u7NxcGUJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sh65qgb85yph506b33rp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u7NxcGUJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sh65qgb85yph506b33rp.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Let’s have a look at REST-Assured Syntax:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLckeDVR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4nkum32jv54uj6i8zc5p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLckeDVR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4nkum32jv54uj6i8zc5p.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Let's try to understand the above code:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;  In the above example, no method has been passed to ‘given.' It means that there are no specific prerequisites.&lt;/li&gt;
&lt;li&gt; There is a ‘get' method that is passed to ‘when,' and it indicates that an event occurs when we visit the URL specified in the ‘get' method.&lt;/li&gt;
&lt;li&gt; When we hit the URL in ‘when', ‘then‘, we will receive output as a response, and then we will validate it. In this example, as shown in the above image, we are performing an assertion on the status code.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>restassured</category>
      <category>httpmethods</category>
      <category>automateapitesting</category>
    </item>
    <item>
      <title>Rest Assured E2E Testing - Part 3</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Sun, 05 Sep 2021 13:05:58 +0000</pubDate>
      <link>https://dev.to/taherafirdose/rest-assured-e2e-testing-part-3-422j</link>
      <guid>https://dev.to/taherafirdose/rest-assured-e2e-testing-part-3-422j</guid>
      <description>&lt;h1&gt;
  
  
  Setup A Basic REST Assured Maven Project In Eclipse IDE
&lt;/h1&gt;

&lt;p&gt;In this post we will learn to setup a Maven – REST Assured in Eclipse IDE.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;p&gt;To begin your project, you must have the following installed and configured on your computer.&lt;br&gt;
Java and Eclipse IDE •&lt;br&gt;
 TestNG which is unit testing framework • &lt;br&gt;
Maven (either we can add jar file manually to our project or we can create a maven project)&lt;/p&gt;

&lt;p&gt;Lest’s get started with creating the project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Maven Project in Eclipse
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Open eclipse and click on File&amp;gt; New&amp;gt; Project&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ScRFxEa2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nnby0jiilstjfel36gw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ScRFxEa2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nnby0jiilstjfel36gw2.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the wizard text box, type Maven and then select Maven from the list box, as shown below. Click the Next&amp;gt; button.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G8iAf6HN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4vtum5lo6u3y8jc2rbf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G8iAf6HN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p4vtum5lo6u3y8jc2rbf.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Click on Next button(select maven-archetype-quickstart) &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rerEtycc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u47uys06h72zs1tf4fgp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rerEtycc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u47uys06h72zs1tf4fgp.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type in the Group Id and Artifact Id (You can give any name to that) and click Finish button &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--28UU5vYP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1ma6f2cyfmoyje0k32e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--28UU5vYP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p1ma6f2cyfmoyje0k32e.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, the Maven Project “RESTAssured_APITesting” is successfully created. Please keep in mind that this Maven project generates pom.xml, as highlighted and shown below.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mG4scnIk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ci98gk1k33wcaipw2fz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mG4scnIk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ci98gk1k33wcaipw2fz.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add dependency of rest assured in pom.xml. For getting maven dependency, visit Maven Repository.&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DjNrR_Ai--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pg9u1051la631pe0la6p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DjNrR_Ai--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pg9u1051la631pe0la6p.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add Maven dependency of TestNG/Junit in your framework. These tests framework will help in managing tests. TestNG is preferable as compared to Junit because of additional features in TestNG. You can copy the dependency from Maven Repository and then paste it in pom.xml.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZXydPIRn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wv4msg0d7lw64j1g22x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZXydPIRn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wv4msg0d7lw64j1g22x.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add Maven dependency of Jackson JSON java parser and JSON Schema Validator in pom.xml. JSON Schema Validator will be used to validate JSON Schema while JSON java parser will be used for parse JSON to map java objects to and from JSON. 
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SCrwyEqv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/28pgyykcj4zl4945ik1b.png" alt="image"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rOwDONCS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xhvrputvxtp8fwzpy8q4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rOwDONCS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xhvrputvxtp8fwzpy8q4.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install hamcrest Assertion &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L8m1iamU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wo4xxvrzdj64cpx4dvov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L8m1iamU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wo4xxvrzdj64cpx4dvov.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After adding all the dependencies, the final pom.xml will look just like below.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fvlLVPDd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebdq47kpu0gkx699qrpt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fvlLVPDd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebdq47kpu0gkx699qrpt.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After successful addition of dependencies, you will see JAR files in Maven dependencies in your project structure.  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ij6y4O6G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ewuo4scuzi37y3a24324.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ij6y4O6G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ewuo4scuzi37y3a24324.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>apitesting</category>
      <category>restassured</category>
      <category>automationtesting</category>
    </item>
    <item>
      <title>Rest Assured E2E Testing - Part 2</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Sun, 05 Sep 2021 12:56:14 +0000</pubDate>
      <link>https://dev.to/taherafirdose/rest-assured-e2e-testing-part-2-1a8j</link>
      <guid>https://dev.to/taherafirdose/rest-assured-e2e-testing-part-2-1a8j</guid>
      <description>&lt;h1&gt;
  
  
  How to create a Fake REST API with JSON-Server
&lt;/h1&gt;

&lt;p&gt;We currently do not have any real business exposed APIs with us for testing, so we will be creating dummy APIs (which will be provided by the developers in the real time scenario) using NodeJS. The npm package in Node JS will help us even more by installing JSON Server, which will allow us to create dummy APIs for practise.&lt;br&gt;
To install Json server, first install nodejs and npm (npm is installed automatically when we install nodejs).&lt;/p&gt;

&lt;h1&gt;
  
  
  Installation and Configuration of NodeJS:
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to google.com and search “download Node JS&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ITXAnls7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l08kg5tyemsyswwu6j59.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ITXAnls7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l08kg5tyemsyswwu6j59.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Download Node.js from the link &lt;a href="https://nodejs.org/en/download/"&gt;https://nodejs.org/en/download/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select the installer based on your system, I am downloading &lt;br&gt;
windows installer &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--V8e32KtZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/584nqonofs7usqdsumjr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V8e32KtZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/584nqonofs7usqdsumjr.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After successfully downloading, install by clicking next -&amp;gt; next -&amp;gt; next till finish&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The nodejs setup can be found in the nodejs folder, which is usually created by default at C:\Program Files\nodejs. Start the setup. Copy the path C:\Program Files\nodejs from the nodejs folder.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A8Ea18sA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a35tghezl4d43fh9phvr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A8Ea18sA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a35tghezl4d43fh9phvr.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Now set up the path variables as shown below&lt;br&gt;
In the search bar, enter sys and select Edit the system environment variables.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JVnQ10sC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bemkkw2j6fbw4qd9qlp4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JVnQ10sC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bemkkw2j6fbw4qd9qlp4.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on Advanced tab and Environment variables&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kQYPdnVg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ros47dl0dfcluqte3q0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kQYPdnVg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ros47dl0dfcluqte3q0.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Under system Variables, click on new and add as below&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9Edg3nRX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sxz5h3ke0yrsjnvnustu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9Edg3nRX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sxz5h3ke0yrsjnvnustu.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select Path Variable under the System variables and click on Edit Button&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iHgEe4CV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxpbptcgv9jcf0crigt0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iHgEe4CV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxpbptcgv9jcf0crigt0.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on New and Paste the path that was copied earlier in step 5 C:\Program Files\nodejs and click Ok…Ok and Ok.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZogZhmbq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/408xq5u846njbvjpf6g4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZogZhmbq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/408xq5u846njbvjpf6g4.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify the installation in command prompt by entering node -v&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9NatxjFo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e5yegef4x5uxaoeo7ixo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9NatxjFo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e5yegef4x5uxaoeo7ixo.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Please note that after installing nodejs, another file named npm (node package manager) is installed under the nodejs folder, and this npm facilitates the installation of various nodejs packages.&lt;br&gt;
verify npm installation by typing the following command: C:&amp;gt;npm - -version&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SisxUa3V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pc3bl5547tm4mb2a3774.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SisxUa3V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pc3bl5547tm4mb2a3774.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Json Server
&lt;/h2&gt;

&lt;p&gt;JSON Server is available as a NPM package. The installation can be done by using the Node.js package manager:&lt;/p&gt;

&lt;h4&gt;
  
  
  $ npm install -g json-server
&lt;/h4&gt;

&lt;p&gt;By adding the -g option we make sure that the package is installed globally on your system.&lt;/p&gt;

&lt;h2&gt;
  
  
  JSON File
&lt;/h2&gt;

&lt;p&gt;Let's make a new JSON file called db.json. This file contains the data that the REST API should expose. CRUD entpoints are automatically created for objects contained in the JSON structure. Take a look at the sample db.json file below:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yyy0E7UQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/49u3eh4jcocgl9pmgtvz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yyy0E7UQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/49u3eh4jcocgl9pmgtvz.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Running The Server
&lt;/h2&gt;

&lt;p&gt;Let’s start JSON server by executing the following command:&lt;/p&gt;

&lt;h3&gt;
  
  
  $ json-server --watch db.json
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a7pKCyZ5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/79fgrlagvwsavtxuq3zf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a7pKCyZ5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/79fgrlagvwsavtxuq3zf.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a parameter, we must supply the file containing our JSON structure (db.json). In addition, we're employing the — watch parameter. By using this parameter, we ensure that the server is started in watch mode, which means that it monitors for file changes and updates the exposed API as needed.&lt;/p&gt;

&lt;p&gt;The json server is up and it has created four dumpy API’s for us as per the json data present in file:&lt;br&gt;
 • &lt;a href="http://localhost:3000/employees"&gt;http://localhost:3000/employees&lt;/a&gt; &lt;br&gt;
• &lt;a href="http://localhost:3000/posts"&gt;http://localhost:3000/posts&lt;/a&gt;&lt;br&gt;
 • &lt;a href="http://localhost:3000/comments"&gt;http://localhost:3000/comments&lt;/a&gt;&lt;br&gt;
 • &lt;a href="http://localhost:3000/profile"&gt;http://localhost:3000/profile&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we can open URL &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt; in the browser and we’ll get to see below result.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qkJEsMS3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/blleud7s8j2e8jogk2u1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qkJEsMS3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/blleud7s8j2e8jogk2u1.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To terminate the server we have to type Ctrl+C command and then press Y as per confirmation message prompted below&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eIogT74j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eqpc4h753w6y2ttp3zdn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eIogT74j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eqpc4h753w6y2ttp3zdn.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>restapi</category>
      <category>automationtesting</category>
      <category>restassured</category>
    </item>
    <item>
      <title>Rest Assured E2E Testing - Part 1</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Sun, 05 Sep 2021 12:45:59 +0000</pubDate>
      <link>https://dev.to/taherafirdose/rest-assured-e2e-testing-part-1-35b3</link>
      <guid>https://dev.to/taherafirdose/rest-assured-e2e-testing-part-1-35b3</guid>
      <description>&lt;h1&gt;
  
  
  API Testing Process Using REST Assured
&lt;/h1&gt;

&lt;p&gt;APIs enable risk-free legacy modernization and drive businesses toward digital transformation. APIs must be precisely optimised to meet a specific business request in a specific context. API testing is the key to success in ensuring a robust API. API testing can be done manually using POSTMAN tools or automatically using Rest Assured dependency code. We'll talk about API testing with REST Assured in this section.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is REST Assured?
&lt;/h1&gt;

&lt;p&gt;Rest Assured is a Java-based library for testing RESTful Web Services. The fact that this is a Java-based library of course does not matter because REST Assured is based only on JSON and HTTP . These are language-independent, we can use REST Assured to create tests for applications written in any language. To access REST web services, this library acts as a headless client. In just one line, we can create a complex HTTP request.&lt;br&gt;
REST Assured also provides us with a lot of validations to our requests, such as for example Status Code, Status Response, Headers, or even Body response. This means that the library is really flexible when it comes to testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of Rest Assured
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Open source, and hence, it is free of any license cost&lt;/li&gt;
&lt;li&gt; Based on Java&lt;/li&gt;
&lt;li&gt; Offers support for all kinds of HTTP methods like POST, GET, PUT, DELETE, OPTIONS, PATCH and HEAD&lt;/li&gt;
&lt;li&gt; Supports both path and query parameters&lt;/li&gt;
&lt;li&gt; Supports the BDD/Gherkin style of writing, which supports clean coding &amp;amp; enhances readability&lt;/li&gt;
&lt;li&gt; Enables easy integration with classic testing &amp;amp; reporting frameworks such as TestNG, JUnit runner and Allure Report&lt;/li&gt;
&lt;li&gt; One can test an application written in any language like Java, .Net, Python, Ruby, etc.&lt;/li&gt;
&lt;li&gt; JSON schema validation can be performed&lt;/li&gt;
&lt;li&gt; Makes it easy to test and validate REST services in the Java domain which is usually tough&lt;/li&gt;
&lt;li&gt;Now let us look at how we an perform API testing with the help of REST Assured.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Disadvantages of Rest assured
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Requires knowledge of the Java programming language.&lt;/li&gt;
&lt;li&gt;Does not support SOAP APIs explicitly.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>restassured</category>
      <category>apitesting</category>
      <category>automation</category>
    </item>
    <item>
      <title>Git CheatSheet</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Sat, 28 Aug 2021 07:07:18 +0000</pubDate>
      <link>https://dev.to/taherafirdose/git-cheatsheet-for-testers-11c0</link>
      <guid>https://dev.to/taherafirdose/git-cheatsheet-for-testers-11c0</guid>
      <description>&lt;p&gt;This guide includes an introduction on Git, a definition of terms, and lists of commonly used Git commands. If you're having trouble getting started with Git, or if you're an experienced tester looking for a refresher, this cheat sheet can help.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is GIT
&lt;/h1&gt;

&lt;p&gt;Git is a free, open source distributed version control system tool designed to handle everything from small to very large projects with speed and efficiency. It was created by Linus Torvalds in 2005 to develop Linux Kernel. Git has the functionality, performance, security and flexibility that most teams and individual developers and testers need. It also serves as an important distributed version-control DevOps tool. &lt;/p&gt;

&lt;h1&gt;
  
  
  Git Terminologies:
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Repositories
&lt;/h3&gt;

&lt;p&gt;Repositories can be compared to folders on your computer. A Github repository contains all of the project's files, including the documentation and all revisions. It is the most basic element of &lt;br&gt;
Github.&lt;/p&gt;

&lt;h3&gt;
  
  
  Branch:
&lt;/h3&gt;

&lt;p&gt;Branch is a version of the repository that diverges from the main working project. It is an essential feature available in most modern version control systems. A Git project can have more than one branch. We can perform many operations on Git branch-like rename, list, delete, etc&lt;/p&gt;

&lt;h3&gt;
  
  
  Remote:
&lt;/h3&gt;

&lt;p&gt;Remote is the term used to refer to the repository hosted in Github. A company's local Git repository hosted in Github or any other Git host platform for sharing and collaboration is generally called Remote repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  Master
&lt;/h3&gt;

&lt;p&gt;The master is the primary branch of all your repositories. It should include the most recent changes and commits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Checkout
&lt;/h3&gt;

&lt;p&gt;Use the git checkout command to switch between branches. Just enter git checkout followed by the name of the branch you wish to move to, or enter git checkout master to return to the master branch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Commit
&lt;/h3&gt;

&lt;p&gt;Commit is one the most frequently used feature of Git, it’s like saving the updated file to its original folder and overwrite on already existing.A commit is a collection of content, a message about how you got there, and the commits that came before it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fetch
&lt;/h3&gt;

&lt;p&gt;Fetching refers to getting the latest changes from an online repository (like GitHub.com) without merging them in. Once these changes are fetched you can compare them to your local branches (the code residing on your local machine).&lt;/p&gt;

&lt;h3&gt;
  
  
  Fork
&lt;/h3&gt;

&lt;p&gt;A 'fork' is a personal copy of another user's repository on your GitHub account. Forks allow you to freely modify a project without affecting the original, providing limitless opportunities for experimentation and learning from the work of others.&lt;/p&gt;

&lt;h3&gt;
  
  
  Head
&lt;/h3&gt;

&lt;p&gt;A HEAD is a snapshot of the most recent commit on each branch. On each branch, it is a short name or a pointer reference to a SHA-1 of a commit ID.A HEAD always points to the branch's most recent commit (code) and moves forward with each commit to point to the most recent commit ID.&lt;/p&gt;

&lt;h3&gt;
  
  
  Index
&lt;/h3&gt;

&lt;p&gt;When you add, delete, or modify a file, it is retained in the index until you are ready to commit the changes. Think of it as Git's staging area. To view the contents of your index, use the git status command. Changes highlighted in green are ready to commit, while those highlighted in red must still be added to staging.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stash
&lt;/h3&gt;

&lt;p&gt;Git stash removes changes from your index and "stashes" them for later use. It's useful if you want to put something on hold and work on something else for a while. You can only stash one set of changes at a time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tags
&lt;/h3&gt;

&lt;p&gt;Tags provide a way to keep track of important commits. Lightweight tags simply serve as pointers while annotated tags get stored as full objects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Upstream
&lt;/h3&gt;

&lt;p&gt;In the context of Git, upstream refers to where you push your changes, which is typically the master branch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Merge
&lt;/h3&gt;

&lt;p&gt;To add changes from one branch to another, use the git merge command in conjunction with pull requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Origin
&lt;/h3&gt;

&lt;p&gt;The default version of a repository is referred to as the origin. Origin can also be used as a system alias to communicate with the master branch. To push local changes to the master branch, use the command git push origin master.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pull
&lt;/h3&gt;

&lt;p&gt;Pull requests represent suggestions for changes to the master branch. If you're working with a team, you can create pull requests to tell the repository maintainer to review the changes and merge them upstream. The git pull command is used to add changes to the master branch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Push
&lt;/h3&gt;

&lt;p&gt;Pushing refers to sending your committed changes to a remote repository such as GitHub.com. For instance, if you change something locally, you'd want to then push those changes so that others may access them&lt;/p&gt;

&lt;h1&gt;
  
  
  GIT Commands
&lt;/h1&gt;

&lt;p&gt;Here are some basic GIT commands you need to know&lt;/p&gt;

&lt;h3&gt;
  
  
  How to setup your Git username:
&lt;/h3&gt;

&lt;p&gt;With the command below you can configure your user name:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxqehkh2zgws87a4idgw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxxqehkh2zgws87a4idgw.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to setup your Git user email:
&lt;/h3&gt;

&lt;p&gt;This command lets you setup the user email address you'll use in your commits.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0zrcec3vmxyzrgacnlq7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0zrcec3vmxyzrgacnlq7.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Initialize a Git repo:
&lt;/h3&gt;

&lt;p&gt;Everything begins here. The first step is to create a new Git repo in your project's root directory. You can do so with the command below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7dopv8yzlxepr68k35hx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7dopv8yzlxepr68k35hx.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to clone a Repository:
&lt;/h3&gt;

&lt;p&gt;Git clone is a Git command line utility which is used to target an existing repository and create a clone, or copy of the target repository&lt;/p&gt;

&lt;h4&gt;
  
  
  Cloning to a specific folder
&lt;/h4&gt;

&lt;p&gt;Clone the repository located at ＜repo＞ into the folder called ~＜directory＞! on the local machine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdba2w4mhqpdz5nypedw8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdba2w4mhqpdz5nypedw8.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Create a New Branch in Git:
&lt;/h3&gt;

&lt;p&gt;By default, there is only one branch, the main branch. You can use this command to create a new branch. Git will not switch to it automatically; you must do so manually with the following command.&lt;/p&gt;

&lt;h4&gt;
  
  
  To create a new branch use:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1u2lcimfylxe6e5lcwj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1u2lcimfylxe6e5lcwj.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to List Branches in Git:
&lt;/h3&gt;

&lt;p&gt;Using the git branch command, you can see all of the branches that have been created. It will display a list of all branches, with the current branch marked with an asterisk and highlighted in green.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzmm583z1ip1cre44vpfz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzmm583z1ip1cre44vpfz.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Switch Branches in Git:
&lt;/h3&gt;

&lt;p&gt;When you create a new branch, Git will automatically switch to it.&lt;br&gt;
If you have multiple branches, you can easily switch between them by running git checkout:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcdw9neczu5lasm45zlum.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcdw9neczu5lasm45zlum.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to delete a branch in Git:
&lt;/h3&gt;

&lt;p&gt;You can delete the branch using below command&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fymcyb4g6v6z4jt69kleq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fymcyb4g6v6z4jt69kleq.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to add a file to the staging area in Git:
&lt;/h3&gt;

&lt;p&gt;The command below will add a file to the staging area. Simply replace filename here with the name of the file you want to include in the staging area.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0wr8531ndth20apihfi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi0wr8531ndth20apihfi.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to add all files in the staging area in Git:
&lt;/h3&gt;

&lt;p&gt;You can use a wildcard to add all files in your project to the staging area.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8jr6ydusb0p8u4s43m1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8jr6ydusb0p8u4s43m1.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to add only certain files to the staging area in Git:
&lt;/h3&gt;

&lt;p&gt;You can add all files beginning with 'str' to the staging area by using the command below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxbfekf0gy5csuhsamzgk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxbfekf0gy5csuhsamzgk.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Check repository's status in Git:
&lt;/h3&gt;

&lt;p&gt;This command displays the current repository's status, including staged, unstaged, and untracked files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnkapfkb9olqghk50rgpa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnkapfkb9olqghk50rgpa.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Commit changes with a message:
&lt;/h3&gt;

&lt;p&gt;This command allows you to specify a brief summary of your commit message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4wjemui8pxtjbzg5wqqe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4wjemui8pxtjbzg5wqqe.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Commit changes (and skip the staging area) in Git:
&lt;/h3&gt;

&lt;p&gt;Using the -a and -m options, you can add and commit tracked files with a single command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftflvmugbcca870in7enx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftflvmugbcca870in7enx.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to View your commit history in Git:
&lt;/h3&gt;

&lt;p&gt;This command displays the commit history for the current repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi239opy48993hy6stnfv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi239opy48993hy6stnfv.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to view commit history including changes in Git:
&lt;/h3&gt;

&lt;p&gt;This command displays the current repository's commit history:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu3zv0juyei52u78r6bb3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu3zv0juyei52u78r6bb3.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to view log stats in Git:
&lt;/h3&gt;

&lt;p&gt;This command causes the Git log to display some statistics about the changes in each commit, such as the number of lines changed and file names.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgdg9jr2glcog3oyc1vex.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgdg9jr2glcog3oyc1vex.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Amend the most recent commit in Git:
&lt;/h3&gt;

&lt;p&gt;You can use git commit —amend to modify and add changes to the most recent commit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzcxc6jis8dunz4lpc2ff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzcxc6jis8dunz4lpc2ff.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to view a specific commit in Git
&lt;/h3&gt;

&lt;p&gt;Replace commit-id with the id of the commit found in the commit log.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3rqlr7hoba014w4rg656.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3rqlr7hoba014w4rg656.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to view changes made before committing them using "diff" in Git:
&lt;/h3&gt;

&lt;p&gt;You can specify a file as a parameter to only see changes to that file. By default, git diff displays only unstaged changes.&lt;/p&gt;

&lt;h4&gt;
  
  
  To see any staged changes, we can use diff with the —staged flag.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehqgrseiiq0kpedao1jt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fehqgrseiiq0kpedao1jt.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to revert staged changes in Git:
&lt;/h3&gt;

&lt;p&gt;If you want to remove a certain file from the stage:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq95ptbdbj7wtc5faww94.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq95ptbdbj7wtc5faww94.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Remove all staged files:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0vuyh9i2cqig50sr69c8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0vuyh9i2cqig50sr69c8.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Rename files in Git:
&lt;/h3&gt;

&lt;p&gt;This command stages the changes, then it expects a commit message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5qp5svj9zuyuzvf6ogpl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5qp5svj9zuyuzvf6ogpl.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to push changes to a remote repo in Git:
&lt;/h3&gt;

&lt;p&gt;When all of your work is complete and ready to be saved on a remote repository, use the commands below to push all changes:&lt;/p&gt;

&lt;h4&gt;
  
  
  First Push
&lt;/h4&gt;

&lt;p&gt;Push a local branch for the first time:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjal86r9cs86jvs0oc4fn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjal86r9cs86jvs0oc4fn.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  After that, then you can just use:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp7nc8ghrjef6to3m7dd9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp7nc8ghrjef6to3m7dd9.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Push local branch to different remote branch
&lt;/h4&gt;

&lt;p&gt;To push a local branch to a different remote branch, you can use:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5x5chogvmu813tg86wv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx5x5chogvmu813tg86wv.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Undo Last Push
&lt;/h3&gt;

&lt;p&gt;If you have to undo your last push, you can use below command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgrr0f43rp5oa99kitvia.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgrr0f43rp5oa99kitvia.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to fetch remote repo changes in Git:
&lt;/h3&gt;

&lt;p&gt;This command will download changes from a remote repository but will not merge them into your local branch (use git pull to do that).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvv6zagquwrw2hg06qdy2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvv6zagquwrw2hg06qdy2.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to pull changes from a remote repo in Git:
&lt;/h3&gt;

&lt;p&gt;If other team members are working on your repository, you can use the command below to retrieve the most recent changes made to the remote repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6uputg5ykeo8843y21tr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6uputg5ykeo8843y21tr.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  If you have a branch called my_feature and you want to pull that branch, you can use:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlxktsjpxl1hay4xzh5q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlxktsjpxl1hay4xzh5q.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to merge two branches in Git or Rebase:
&lt;/h3&gt;

&lt;p&gt;When you run git merge, your HEAD branch will generate a new commit, preserving the ancestry of each commit history.&lt;br&gt;
The rebase re-writes the changes of one branch onto another without creating a new commit.&lt;/p&gt;

&lt;h4&gt;
  
  
  Merge Master Branch to Feature Branch:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpyvmkrxsoprgb2kmlrn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkpyvmkrxsoprgb2kmlrn.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Or with rebase option, use below command:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl2417c0ekg8ohsmbk8on.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl2417c0ekg8ohsmbk8on.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Merge Feature Branch to Master Branch:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7qd6ahnj7dxqmjlfdsg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7qd6ahnj7dxqmjlfdsg.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  How to use GIT STASH:
&lt;/h3&gt;

&lt;p&gt;Git stash temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on. &lt;/p&gt;

&lt;h4&gt;
  
  
  To stash changes use below command
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fks8irhxs1nuyr5exai2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fks8irhxs1nuyr5exai2l.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  If you want to unstash those changes and bring them back into your working directory use:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1u11mvsmup5h0f4ce84.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn1u11mvsmup5h0f4ce84.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>github</category>
      <category>automationtesting</category>
    </item>
    <item>
      <title>API Response Validation using Postman</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Sun, 20 Jun 2021 18:15:08 +0000</pubDate>
      <link>https://dev.to/taherafirdose/how-to-automate-api-testing-with-postman-3ie6</link>
      <guid>https://dev.to/taherafirdose/how-to-automate-api-testing-with-postman-3ie6</guid>
      <description>&lt;p&gt;In this article, we will learn how to validate the response by writing test scripts and assertions for testing API using postman.&lt;/p&gt;

&lt;p&gt;Postman is an excellent utility tool for creating integration tests for rest API endpoints because it allows you to write test scripts and add assertions. We can determine if a test passes or fails based on the output of these assertions.&lt;/p&gt;

&lt;h1&gt;
  
  
  Writing tests
&lt;/h1&gt;

&lt;p&gt;In your requests and collections, you can use the Tests tab to write tests that will run when Postman receives a response from the API you requested. For each request, you can add as many tests as you need. When you add tests to a Collection, they will execute after each request inside it.&lt;br&gt;
We can enter the script manually or use the Snippets, which is available on the right side of the code editor&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0lB_EMW4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pp0xet76o0qk3ii3ecgu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0lB_EMW4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pp0xet76o0qk3ii3ecgu.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Basic test syntax
&lt;/h1&gt;

&lt;p&gt;The pm.* API is used to write your test under the Tests tab in Postman. The pm.test() method accepts 2 parameters.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; The first parameter is the name of the test(as a string), it's important to give your test a descriptive name so that you can provide more information if it fails. &lt;/li&gt;
&lt;li&gt; The second parameter is a function that will pass or fail the test if any assertions within your function pass/fail. The function returns a boolean (true or false) &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Postman uses the Chai assertion library for creating assertions. It’s based on the BDD style of assertions which make it highly readable and understandable&lt;/p&gt;

&lt;h1&gt;
  
  
  Test results
&lt;/h1&gt;

&lt;p&gt;After you execute the request with the test scripts, go to the Tests tab in the response viewer. It will display a list of tests with the results passed or failed. A boolean which returns true is marked as passed while a boolean which returns false is marked as failed.&lt;/p&gt;

&lt;h1&gt;
  
  
  Writing test scripts
&lt;/h1&gt;

&lt;p&gt;Scenario 01: Verify the status code is 200&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ujAzIwTq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jse3t0kg0lwmwco7obs0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ujAzIwTq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jse3t0kg0lwmwco7obs0.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 02: Verify status code contains a string. Example: 201 (created), 200(OK) &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gP-N64F5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nugnkmwmeewe9sjixu33.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gP-N64F5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nugnkmwmeewe9sjixu33.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 03: Verify the status code from a list of expected status code (include them all in an array and use one of)&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SOo1nppv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bscgvevnkplo25rry4f8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SOo1nppv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bscgvevnkplo25rry4f8.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 04: Verify the response time is below 1000ms and above 200ms &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PZKhjR_A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crzttb808hrnofcj1n2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PZKhjR_A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crzttb808hrnofcj1n2u.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 05: Verify the presence of header and the value.&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--es3bDf-W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7oiole9996yqkvwojnz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--es3bDf-W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7oiole9996yqkvwojnz.png" alt="image"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xer7l3pl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lj2cwhytq90g986nz5gv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xer7l3pl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lj2cwhytq90g986nz5gv.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 06: Verify the properties of the objects in response body&lt;/p&gt;

&lt;p&gt;The below test include multiple assertions as part of a single test, Even if one assertions fails, the test as a whole will fail. All assertions must be successful for the test to pass&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HDd1UZ57--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekf708ehbcoze2409f3t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HDd1UZ57--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ekf708ehbcoze2409f3t.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 07: Verify the values in the response body&lt;br&gt;&lt;br&gt;
Response Body&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--i7cMq4Df--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjwo5n6jjr7541qnjakw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i7cMq4Df--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjwo5n6jjr7541qnjakw.png" alt="image"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--h_cnpOci--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wpqeedzkfqcqfxx1w6gr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h_cnpOci--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wpqeedzkfqcqfxx1w6gr.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 08: Verify the response value against a variable  &lt;/p&gt;

&lt;p&gt;Setup variable in Pre-request Script &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qT813n5T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fiyez9ujq3ah1pgatgmo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qT813n5T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fiyez9ujq3ah1pgatgmo.png" alt="image"&gt;&lt;/a&gt;&lt;br&gt;
ResponseBody&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oxmKXnVE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qikxsqgsyrwmixh4p8r4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oxmKXnVE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qikxsqgsyrwmixh4p8r4.png" alt="image"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M6BZF4b7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kclz37e39dghq6o7ci68.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M6BZF4b7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kclz37e39dghq6o7ci68.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 09 : Verify the current Environment&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ajt5d-UK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8225uvlxomtposz7k8j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ajt5d-UK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8225uvlxomtposz7k8j.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 10 : Verify the response is valid and has a body and the bodytype is JSON&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HYoIBgLS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7rxdw22b0q1vpjwi7n4d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HYoIBgLS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7rxdw22b0q1vpjwi7n4d.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Scenario 11 : Verify the data type of the response&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NuMc95MY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7owji2n7y2ltvdupa6bt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NuMc95MY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7owji2n7y2ltvdupa6bt.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;This article aims at showing you how to utilize Postman to write automated tests for your APIs which will allow you to bridge the gap between development and quality assurance, and also minimize the surface area of bugs in your API.&lt;/p&gt;

</description>
      <category>apitesting</category>
      <category>postman</category>
      <category>testscript</category>
    </item>
    <item>
      <title>How To Automate API Testing With Postman</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Sun, 20 Jun 2021 17:02:34 +0000</pubDate>
      <link>https://dev.to/taherafirdose/how-to-automate-api-testing-with-postman-1b1d</link>
      <guid>https://dev.to/taherafirdose/how-to-automate-api-testing-with-postman-1b1d</guid>
      <description>&lt;p&gt;In this article, we will learn how to validate the response by writing test scripts and assertions for testing API using postman.&lt;/p&gt;

&lt;p&gt;Postman is an excellent utility tool for creating integration tests for rest API endpoints because it allows you to write test scripts and add assertions. We can determine if a test passes or fails based on the output of these assertions.&lt;/p&gt;

&lt;h1&gt;
  
  
  Writing tests
&lt;/h1&gt;

&lt;p&gt;In your requests and collections, you can use the Tests tab to write tests that will run when Postman receives a response from the API you requested. For each request, you can add as many tests as you need. When you add tests to a Collection, they will execute after each request inside it.&lt;/p&gt;

&lt;p&gt;We can enter the script manually or use the Snippets, which is available on the right side of the code editor&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4LXO8XO4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2ijfhyspo1dllngnboh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4LXO8XO4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a2ijfhyspo1dllngnboh.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Basic test syntax
&lt;/h1&gt;

&lt;p&gt;The pm.* API is used to write your test under the Tests tab in Postman. The pm.test() method accepts 2 parameters.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; The first parameter is the name of the test(as a string), it's important to give your test a descriptive name so that you can provide more information if it fails. &lt;/li&gt;
&lt;li&gt; The second parameter is a function that will pass or fail the test if any assertions within your function pass/fail. The function returns a boolean (true or false) &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Postman uses the Chai assertion library for creating assertions. It’s based on the BDD style of assertions which make it highly readable and understandable.&lt;/p&gt;

&lt;h1&gt;
  
  
  Test results
&lt;/h1&gt;

&lt;p&gt;After you execute the request with the test scripts, go to the Tests tab in the response viewer. It will display a list of tests with the results passed or failed. A boolean which returns true is marked as passed while a boolean which returns false is marked as failed.&lt;/p&gt;

&lt;h1&gt;
  
  
  Writing test scripts
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Scenario01: Verify the status code is 200
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_-Fc0nir--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s3dyxmoqknjiqzmgfhe7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_-Fc0nir--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s3dyxmoqknjiqzmgfhe7.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Scenario02: Verify status code contains a string. Example: 201 (created), 200(OK)
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r_qyBXUz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ux6mmxno9sohqkg7ted4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r_qyBXUz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ux6mmxno9sohqkg7ted4.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Scenario03: Verify the status code from a list of expected status code (include them all in an array and use one of)
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g2y-ob5w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tgzp202jn0updga7jtg9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g2y-ob5w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tgzp202jn0updga7jtg9.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Scenario04: Verify the response time is below 1000ms and above 100ms
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ahw34rW2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wv36l3061yb3409kdf86.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ahw34rW2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wv36l3061yb3409kdf86.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Scenario05: Verify the presence of header and the value.
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iY_toX9r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e11nmyn8vys9bhpl9nvb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iY_toX9r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e11nmyn8vys9bhpl9nvb.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Grzscl76--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4p8jv0wskolgrsm5b06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Grzscl76--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g4p8jv0wskolgrsm5b06.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Scenario06: Verify the properties of the objects in response body
&lt;/h1&gt;

&lt;p&gt;The below test include multiple assertions as part of a single test, Even if one assertions fails, the test as a whole will fail. All assertions must be successful for the test to pass&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0mvr9TaZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fm9nedtormlbgtwadv52.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0mvr9TaZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fm9nedtormlbgtwadv52.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Scenario07: Verify the values in the response body
&lt;/h1&gt;

&lt;p&gt;Response Body&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hIQucd5L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xt27i10gdwwp99jw4nk4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hIQucd5L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xt27i10gdwwp99jw4nk4.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5FMnc86C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdnytb5tks9qev3gqp7w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5FMnc86C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdnytb5tks9qev3gqp7w.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Best Practices for REST API Testing</title>
      <dc:creator>TaheraFirdose</dc:creator>
      <pubDate>Fri, 11 Jun 2021 15:26:09 +0000</pubDate>
      <link>https://dev.to/taherafirdose/best-practices-for-rest-api-testing-1ge4</link>
      <guid>https://dev.to/taherafirdose/best-practices-for-rest-api-testing-1ge4</guid>
      <description>&lt;h1&gt;
  
  
  What is REST, and what are REST APIs?
&lt;/h1&gt;

&lt;p&gt;REST stands for Representational State Transfer and API stands for Application Program Interface. It is a type of architectural design pattern for APIs. It is a predominant development style for web applications and services. APIs that are designed using REST are called REST APIs, and they allow web applications and services to interact with resources stored in a web server. These interactions typically take place over HTTP and usually consist of the following:&lt;/p&gt;

&lt;p&gt;GET (retrieval of the resource)&lt;br&gt;
POST (creation of the resource)&lt;br&gt;
PUT (updating the resource)&lt;br&gt;
DELETE (deletion of the resource)&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Make an API testing strategy checklist
&lt;/h1&gt;

&lt;p&gt;The test strategy is the high-level description of the test requirements from which a detailed test plan can later be derived, specifying individual test scenarios and test cases. An API test strategy lays out your goals and the steps to get there. This can be a detailed formal document or a checklist such as below.&lt;/p&gt;

&lt;p&gt;• Define the testing process, level of testing, roles, and responsibilities of every team member.&lt;br&gt;
• Discuss with the Product owner and development team about the list of API’s the organization is going to use and prioritize them in order of their importance to applications and customers.&lt;br&gt;
• Determine how often the tests should be run, and how are they deployed with a commercial testing tool or an internally developed tool.&lt;br&gt;
• Define the types of tests to run. For example access security, endpoint security, data security, data validation and file validation.&lt;br&gt;
• Develop a plan that ensures test data won't harm production data that's required for business analytics and reporting.&lt;br&gt;
• Evaluate and select an API testing tool. &lt;br&gt;
• Schedule and regularly conduct functional and security tests.&lt;br&gt;
• Plan for resources to maintain and update API tests.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Pick the right API tool
&lt;/h1&gt;

&lt;p&gt;API testing isn’t very different from any other testing. But, it requires specific tools to test it. All API testing tools let testers submit requests manually — in other words, you write out the request, send it, and see how the API reacts. However, it would take a while to test any API this way, which is why many testing tools also support automated tests. Automated testing systems run many scenarios quickly with minimal human input. A good API testing tool, especially one with automated testing, saves time and helps testers shift left to catch bugs earlier. Many of these tools are available for download completely free of charge, while others require a purchase.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Perform API smoke testing.
&lt;/h1&gt;

&lt;p&gt;When a new API is ready for testing, the very first test that needs to be performed is smoke testing. Smoke test is a mini and rapid regression test to ensure that the basic and critical functionality is working. This helps determine if the API code is flawed and avoids any further testing which will be a waste of time and resources. As such, a typical API smoke test could be the following:&lt;/p&gt;

&lt;p&gt;• Ensure API responds to correct authorization via all agreed auth methods – Bearer token, cookies, OAuth, etc. – as defined in the spec&lt;br&gt;
• Test the basic API’s to check if it responds&lt;br&gt;
• Test the API’s with only positive test data to see if it responds with a payload in the correct format.&lt;br&gt;
• Test the API and how it interacts with the other APIs and components it’s supposed to interact with.&lt;/p&gt;

&lt;h1&gt;
  
  
  4. Mirroring API Testing and Production Phase
&lt;/h1&gt;

&lt;p&gt;During the API testing phase, the development teams need to create identical conditions like the one in the production. This will ensure that the APIs function accurately and will allow testing bug fixes, performance bottlenecks and important security bugs in an environment similar to the one the customers are facing.&lt;/p&gt;

&lt;h1&gt;
  
  
  5. Keep track of API Responses and save them for future use.
&lt;/h1&gt;

&lt;p&gt;Many testers on the success or failure of each API, discard the set of responses after they’ve finished running their functional tests. This is wrong, as responses from an API are very useful data that can be used for comparing the inconsistency or error caused in future builds. This can help testers to figure out exactly which modification is causing the error. Without recording these test results, important history is lost.&lt;/p&gt;

&lt;h1&gt;
  
  
  6. Test Positive and Negative Scenarios
&lt;/h1&gt;

&lt;p&gt;As a tester, we often think about the “Happy Path”- the path that the user will most likely take when they are using our application. We often perform API testing to verify that every endpoint returns a “200 OK” or similar successful response.&lt;br&gt;
It’s equally important to think about negative testing as it can expose improperly handled errors that could impact a user. By performing negative testing, a tester can see whether or not their API can deal with receiving incorrect or invalid data with an error message instead of a hard crash. This will improve the efficiency of the application and help the app to respond in scenarios where invalid data is provided.&lt;/p&gt;

&lt;h1&gt;
  
  
  7. Never Ignore Security Tests
&lt;/h1&gt;

&lt;p&gt;API allows data exchange between applications. If a hacker breaches API security, he/she can access sensitive data stored on the website. In order to protect applications from exploitation and security breaches, all APIs must be tested for security flaws and exploits. This can be performed using various testing tools that help to run and scan security tests with some extra features.&lt;/p&gt;

</description>
      <category>apitesting</category>
      <category>restapi</category>
    </item>
  </channel>
</rss>
