<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sithira Pathirana on Medium]]></title>
        <description><![CDATA[Stories by Sithira Pathirana on Medium]]></description>
        <link>https://medium.com/@sithirapathirana1989?source=rss-2b08e253621b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*E6mH1uHVo9FA7auAlgoREg.jpeg</url>
            <title>Stories by Sithira Pathirana on Medium</title>
            <link>https://medium.com/@sithirapathirana1989?source=rss-2b08e253621b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 06:55:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sithirapathirana1989/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[TestProject.io - Codeless Test Automation | Ep 01]]></title>
            <link>https://medium.com/@sithirapathirana1989/testproject-io-codeless-test-automation-ep-01-88e1f1ea096e?source=rss-2b08e253621b------2</link>
            <guid isPermaLink="false">https://medium.com/p/88e1f1ea096e</guid>
            <category><![CDATA[testproject]]></category>
            <category><![CDATA[codeless-automation]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[scriptless-testing]]></category>
            <category><![CDATA[qa-automation]]></category>
            <dc:creator><![CDATA[Sithira Pathirana]]></dc:creator>
            <pubDate>Sat, 13 Nov 2021 07:34:38 GMT</pubDate>
            <atom:updated>2021-11-13T07:34:38.479Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYImf5rWA-uWrXeVPd0M-w.jpeg" /></figure><p>Whaaaaat … Record, and Playback ??? Its sucks right !!! Only Programmers can be the Automation engineers !!! Sooner QA will become programmers !!! Technically sound people only become QA s !!! No QA future for weak Programmers :( !!! Try only the coding !!! SDET !!!</p><p>There are Rumors that everyone needs to be a very talented programmer to become Software QA s. Everyone is not comfortable with coding. But as a Software QA Professional throughout the journey you have to do Test automation, Scripting, Technical Researches and for that, you need programming skills. So no matter you try to record and playback tools or any you need the <strong><em>Programming skills and technical knowledge</em></strong> to overcome challenges.</p><blockquote>Learning Programming is the best Weapon for a QA</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FF_EnZMCoYjc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DF_EnZMCoYjc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FF_EnZMCoYjc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c446db9f058e0f3cc88982e9ded316b/href">https://medium.com/media/9c446db9f058e0f3cc88982e9ded316b/href</a></iframe><h4>Today Codeless Automation become a #TopTrend . Any Idea Why?</h4><ol><li>Non Technical people also can do Programming.<br>- End to End Test Automation is not impossible but most companies automate their regression test suites only. So there is a space for Manual testers and they are capable of creating codeless scripts.</li><li>It Saves a lot of time and speeds up feature deliverables.</li><li>Reduce the cost. Easy to train anyone to use codeless automation tools.</li></ol><p>World moving Fast 🏃‍♀️🏃‍♂️ … Technology moving Fast … So why don&#39;t we ??</p><h3>👑 TestProject.io👑</h3><p><strong><em>Welcome to the Codeless Test Automation</em></strong></p><h3>What is TestProject.io ?</h3><p>It&#39;s a community-powered Record playback test automation framework that is built top of Selenium and Appium but removes a lot of complexities like Install drivers, cross-browser support. You only need to install a <strong>single executable (TestProject Agent) </strong>and TestProject.io will do the rest.</p><h3>Why do you choose TestProject.io ?</h3><p>Read this. The most Important reason is …. Yeyyyy Its 🆓</p><h3>What makes TestProject.io unique from other tools?</h3><ol><li>It provides the ability to extend the framework by using <a href="https://addons.testproject.io/">Addons</a>.</li><li>AI-based self-healing mechanism which identifies locator changes and automatically handles the fixes.</li><li>Supports iFrames, Popups, and Dynamic Elements (Get rid of headache)</li><li>Built-in Adaptive-wait handles loading times and etc…</li><li>Support Windows / Mac / Linux OS s</li><li>Support UI, Mobile , API Automation . Do you mean for FREE? 🥰</li></ol><h3>Now without wasting time Let’s Setup the Test Project Agent (For this example I use a <strong><em>Windows machine</em></strong>)</h3><ol><li>Go to the <a href="https://testproject.io/">https://testproject.io/</a> URL and create an account using email</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*dTXdfl4_2AdFnHBtJFgiOQ.jpeg" /></figure><p>2. Now Sign up with your User</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*j1iyvYDiBBiKq4Euyaanbg.jpeg" /></figure><p>3. Go to your Email Inbox and Confirm your email received from TestProject.</p><p>4. Now you will be automatically navigated to the TestProject.io web page and Click “Skip Now” button of all the displaying pages until you see the Home page with a sample Test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fW_EsHKkBokK9DiAra5M3Q.jpeg" /></figure><p>5. Click “Agents” menu button and then click “Download Agent” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CWOp7l3opB9Igpl988-ybA.jpeg" /></figure><p>6. Then you will see a page with 2 options and click “Download for Windows”(I use windows for this example) under “TestProject for Desktop” title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*58GU64dxhvHqNsXyTKaqiw.jpeg" /></figure><blockquote>Now the set up for your TestProject.io Agent is downloaded. To use TestProject for the UI Automation this Agent file should be installed to your machine -&gt; Register as TestProject agent -&gt; then Agent should be up and running.</blockquote><p>7. So First Install the Agent by clicking downloaded “TestProject_Agent_{versionNo}”.exe file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*WELcYLl2ybs8A_bmL_PoOQ.jpeg" /></figure><p>8. Search from windows search bar and you can see the installed Agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*q17bkQtVp-FFUMngz4qAqg.png" /></figure><p>9. Now click the Agent and it will spin up and run. You can check it by expanding the icons in the “lower right corner” of the windows bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*fMFMhq06uDjaxc8dJ6EdBQ.png" /></figure><p>10. That will be not enough. We need to Register our downloaded local Agent with TestProject. In the TestProject website Click “Agents” menu button and then click “Register Agent” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FIxX7H-Eu0jFZ3-JITUHBA.jpeg" /></figure><p>11. Name your TestProject Agent and click “Save” button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*RBvFiuGRlEp_6QXvtAotSA.jpeg" /></figure><p>12. Now you will see a browser pop up saying Agent Registration completed. Also a notification on windows “lower right corner”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-_zYuJuxT15i-DT7kttdnQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*zWoZ3STJDtYbJ4uYXwM5yw.png" /></figure><p>13. Your Agent set up is completed when you see an Agent with status “Ready” in TestProject.io Web site -&gt; Agent Menu -&gt; Ready tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0g1zwbCyzPjbJxho5KjQTg.jpeg" /></figure><p>14. <strong>Congratulations !!!</strong> Your TestProject.io Agent is Set Up now.</p><p>Now we will do the Web UI Automation with TestProject.io codeless tool. Let&#39;s discuss it in the next tutorial.</p><p><em>References</em></p><p><a href="https://testproject.io/">https://testproject.io/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88e1f1ea096e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploratory Testing with “Test Charter”]]></title>
            <link>https://medium.com/@sithirapathirana1989/exploratory-testing-with-test-charter-f55f2741ea25?source=rss-2b08e253621b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f55f2741ea25</guid>
            <category><![CDATA[test-case]]></category>
            <category><![CDATA[software-quality-engineer]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[exploratory-testing]]></category>
            <dc:creator><![CDATA[Sithira Pathirana]]></dc:creator>
            <pubDate>Mon, 18 Oct 2021 12:16:23 GMT</pubDate>
            <atom:updated>2021-10-19T04:36:24.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*_5ypAgeM_TK64KGYWmSa5w.png" /></figure><h4>Exploratory testing</h4><p>What:- <em>Art of testing your product based on the experience.</em></p><p>Problem:- you can&#39;t guarantee the <strong>Test coverage</strong>. There can be a risk of missing flows due to the time, resources, view, and situation.</p><p>Solution:- <em>Test Charter.</em></p><h4>Test charter</h4><p>Less documentation + set a purpose and a scope for your exploratory testing cycles.</p><p><strong>Explore </strong>&lt;target&gt; <br>*This is the feature<br><strong>With </strong>&lt;resource&gt; <br>*Resources can be target input data (ex:- characters, valid or corrupted files)<br><strong>To discover</strong> &lt;information&gt; <br>*Simply what you want to find out.</p><p>Test Charter has characteristics such as Charter, Coverage, Timebox, Tester Name, Time Breakdown, Data, Bugs.</p><h4>A Good charter</h4><p>Simple, descriptive, and understandable direction for testing.</p><p>Generally, we can use modules, particular areas of the system to include in a test charter.</p><p><strong><em>Case 1 </em></strong>❌</p><blockquote>Explore Ebay Login page password<br>With value “ xxx’) OR 1 = 1 — ]”<br>To discover if login page is not vaulnarable to a SQL injection attack</blockquote><ul><li>This is not a test charter. this is a “<em>Test Case</em>” with too specific details.</li><li>If you write a charter in this way it gives the disadvantage of large documentation.</li></ul><p><strong><em>Case 2 </em></strong>❌</p><blockquote>Explore Security of Ebay web application<br>with all type of security attacks<br>To discover Security loopholes</blockquote><ul><li>This is too broad.</li><li>you cant finish this within a timebox. to explore this have to put a lot of effort and still won’t be able to cover all the vulnerabilities.</li></ul><p><strong><em>Case 3 </em></strong>✔️</p><blockquote>Explore input fields of Ebay Web application<br>with Javascript, html and vbscript malicious scripts <br>To discover XSS security vulnarabilities</blockquote><ul><li>This is a good Test Charter.</li><li>Neither too specified nor too broad. only focus on the specific types of security issues.</li></ul><p><strong><em>Case 4 </em></strong>✔️</p><blockquote>Explore Ebay Payment gateway security<br>with PCI DSS(Payment card indsutry data security standards) checklist<br>To discover protecting sensitive user data when processing payments</blockquote><ul><li>This Test charter focus on a single area of the application hence it&#39;s a nicely written Test Charter.</li></ul><h4>Test Charter Example</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qrEJvRLvW_XPLj5EaGR15A.jpeg" /></figure><p><strong><em>Charter 001:-</em></strong> <br>Explore product Search module on eBay Products page<br>With filtering by values, invalid/valid Search terms, Sorting checkboxes<br>To discover Search module functionality working as expected</p><p><strong><em>Coverage:-</em></strong><br>* Search with valid and invalid inputs<br>* Filter by categories<br>* Related items suggestion<br>* Sorting<br>* Search results pagination</p><p><strong><em>Timebox:-<br></em></strong>#Total Duration — 2 Hrs<br>#Test Design and execution — 1 Hr 30 minutes<br>#Bugs Investigation and Reporting — 30 minutes</p><p><strong><em>Tester Name:-</em></strong> Mr. Bug</p><p><strong><em>Test Notes:- </em></strong>Executed browsers are Chrome and firefox</p><p><strong><em>Bugs:-<br></em></strong>* Filtering when “from” price greater than “to” price still retrieve some random records.<br>* Search results are not automatically displayed when searching from a minimum of 3 characters.</p><p><strong><em>Test Data:-</em></strong><br>testData.XSLX</p><p>👋 👋 👋 <strong><em>Thank you </em></strong>👋 👋 👋</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f55f2741ea25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I did a search, they were chasing me ]]></title>
            <link>https://medium.com/@sithirapathirana1989/i-did-a-search-they-were-chasing-me-e103de677e60?source=rss-2b08e253621b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e103de677e60</guid>
            <category><![CDATA[digital-marketing]]></category>
            <category><![CDATA[online-advertising]]></category>
            <category><![CDATA[programmatic-advertising]]></category>
            <category><![CDATA[real-time-bidding]]></category>
            <category><![CDATA[marketing]]></category>
            <dc:creator><![CDATA[Sithira Pathirana]]></dc:creator>
            <pubDate>Wed, 10 Jun 2020 08:13:23 GMT</pubDate>
            <atom:updated>2020-06-10T08:13:23.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*654LaTvEzH5GLBZKSiPqxQ.jpeg" /></figure><p>Once upon a time, you might have seen marketing advertisements in the visited web pages. But most of those ads would drive you mad or something you’ve never wanted.</p><p>Things have been changed !!!</p><p>Nowadays Advertisers are smart enough to advertise their products to people only who are interested in their products. They have displayed the ads of your favourite products/services, or something you wish you had, or alternative which suits you.</p><p>As an example, you wanted to buy a perfume and you searched it in Ebay.com but didn&#39;t make a purchase. Instantly within few mins, you can see a “branded perfume advertisements” right next to the article you are reading on Facebook or on your favourite web page. There is a possibility that you could click the ad and buy the product.</p><blockquote>Yes “they” know you better than your spouse.</blockquote><p>I am sorry. who are them? Search engines, web browsers and web sites.</p><h3>I asked this question myself several times. How on earth did this happen?</h3><p>The Internet knows who are you and what you did by tracking your data in more ways than once.</p><ol><li>Storing your device/personal information through the cookies of your browser.</li><li>There are 3rd party tracking tools such as <em>Google analytics, Matamo </em>which injects scripts into the web site you visited and track your behaviours and maintain a profile for you with a unique Id(Email, NIC).</li><li>Connecting with your mobile phones via applications, games. As an example when social media application asks to access your location.</li></ol><p>Now we will talk about a process we never thought would happen which is called <strong><em>programmatic advertising.</em></strong></p><blockquote>programmatic advertising is defined as the automated buying and selling of online advertising space.</blockquote><p>First of all, will understand the key terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKKQn5IWvcoUpSr-6IyPAg.png" /></figure><ul><li><strong>Advertisements / Ads</strong>:- Promoting a product/service (Remember a TV Ad).</li><li><strong>Publisher</strong>:- Simple web site Owner who allows a place(<strong><em>Ads space/ Ad slot/ inventory</em></strong>) on their web page to display advertisements.</li><li><strong>Advertiser</strong>:- They buy ad space on a <strong><em>publisher page </em></strong>and waiting for their Ads to be viewed by the Users to increase sales.</li><li><strong>Visitor/ Audience</strong>:- The one who visit the web site.</li><li><strong>Target / Right audience</strong>:- Targeted specific group of people(visitors) to display ads in a more convenient way. Otherwise, if your ads have been pushed to the “<em>random people or wrong audience”</em> then you will be not getting a profit from your business.</li></ul><blockquote>Mobitel.lk wants to promote there newest couple package to the visitors “who previously visited Mobitel.lk web site at least once and Age is between 15–30 and who previously purchased couple packages from the web site”.</blockquote><ul><li><strong>DMP (Data management platform):-</strong> Platform where connect with web pages and collect, manage, analyze and store <strong><em>visitor profile data</em></strong> and their behaviours. For example which products are purchased by a user, how many times the user clicked a URL and that user’s email, location and etc.</li><li><strong>SSP (Supply-side platform):- </strong>Network of connected <strong><em>publishers</em></strong>. Help publishers to sell the ad space for the highest price and increase profit.</li><li><strong>DSP (Demand Side Platform):-</strong> Cooperate with <strong><em>advertisers</em></strong> to buy ad space for the <strong><em>advertisement</em></strong>. An advertiser signs up with a DSP and finds the right audience they want to reach and promote their ads.</li><li><strong>Ad exchange:- <em>Publishers and Advertisers meet </em></strong>(through SSP and DSP) and agree on a price to display their ads.</li><li><strong>RTB (Real-time Bidding):- </strong>Selling and Buying the ads through a live auction with the support of ad exchange. Real-time take a decision and display ads to the right visitors.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*wgvyuTiGywPa5RCxc6P0MQ.jpeg" /></figure><blockquote>Before web page loads real-time bidding is happened to fill some free advertisement slot. The funniest part of this is, it only takes 100ms to complete the auction process and load the web page with the winning advertisment.</blockquote><p><em>Alright !! Let’s turn our attention to a use case and how it works.</em></p><p>One day you logged in to the ebay.com and searched for a Men&#39;s perfume. you didn&#39;t get a one for an affordable price. you changed your mind and logged in to “hetaderana.lk” which was your favourite news broadcasting space. Suddenly you saw some ads suggesting some budget perfumes from a Perfume store. Then you checked them and ordered a one.</p><ol><li>When you search for perfume products in ebay.com, 3rd party tracking tools and browser cookies track your personal identity details and what you are searched.</li><li>These collected data are shared with the <strong>DMP</strong> to analyze.</li><li>Now as a <strong>visitor</strong> you navigate to the publisher&#39;s web page (hetaderana.lk).</li><li><strong>Publisher</strong>(hetaderana.lk) already connected their web site with <strong>SSP</strong>.</li><li>Simultaneously SSP informs <strong>ad exchange</strong> about the web site information, available ad slots and visitor information.</li><li><strong>Advertisers</strong> are registered with <strong>DSP</strong>. <strong>DSP</strong> doesn&#39;t have enough information to decide where and a way to buy ad space.</li><li>So <strong>DMP</strong> creates a <strong>Target audience</strong> for <strong>DSP</strong> and based on this information <strong>DSP</strong> make a decision about placing a right bid amount.</li><li>Imagine if the advertiser wants to promote High-quality perfume product to a “<em>Visitor from Sri Lanka who recently searches perfumes and at least bought 1 or 2 perfumes online</em>” then you also will be included into his <strong><em>target audience.</em></strong></li><li>Now perfume advertisers need to win the bid to display the perfume ad next time when you are visiting a web page. oh, you have the demand !!!</li><li><strong>Ad exchange</strong> asks the <strong>DSP</strong> about the ads that might fit the slot. If then <strong>DSP</strong> sends a signal to enter the real-time bidding auction with other advertisers.</li><li>Now the <strong>RTB</strong> process started and as soon as <strong>Advertiser</strong> won the bid, SSP will push the received winning bid information and ad URL to Publisher&#39;s web site. (Winner is decided based on the highest bid algorithms).</li><li>When page(hetaderana.lk) is loaded, you will see the winning advertisement on the ad space. BOOM !!!!</li></ol><p>So I hope now you got a very basic idea about the <strong>Real-Time Bidding (RTB) </strong>process and reasons for being amazed by the advertisements appears on your web pages. See you again.</p><p>👋 👋 👋 <strong><em>Adios, Amigos </em></strong>👋 👋 👋</p><h3>The best marketing doesn’t feel like marketing !!!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e103de677e60" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL Test Automation with Rest Assured | Json-Snapshot]]></title>
            <link>https://medium.com/@sithirapathirana1989/graphql-test-automation-with-rest-assured-json-snapshot-ee9156f217e4?source=rss-2b08e253621b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee9156f217e4</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[snapshot-testing]]></category>
            <category><![CDATA[jackson]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[restassured]]></category>
            <dc:creator><![CDATA[Sithira Pathirana]]></dc:creator>
            <pubDate>Sun, 17 May 2020 15:33:32 GMT</pubDate>
            <atom:updated>2020-05-17T15:37:05.545Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>REST(Representational state transfer) protocol was a good fit for many applications but had some drawbacks such as <em>Increased Mobile usage, low power devices, and sloppy networks.</em></blockquote><h3>What is GraphQL ?</h3><blockquote><em>When using REST API standards </em>Facebook<em> noticed that their newsfeed need to call multiple API endpoints in order to retrieve all the data it needed. So they were looking for a way to load their newsfeed in a reliable way with a good performance on mobile.</em></blockquote><p>GraphQL invented as a result of the effort. it is a “New Query language provide a more efficient and powerful alternative to REST”. It is a specification that can be implemented in any programming language.</p><h4><em>Example:-</em></h4><p>A simple application needs to show the User name, created Posts, and last 3 Followers of the User on the screen.</p><p>If we do this task via REST we may need 3 endpoints such as,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*-ajDnauguBne4TvZ" /></figure><ol><li>GET /users/{id}</li><li>GET /users/{id}/posts</li><li>GET /users/{id}/followers</li></ol><p>Instead of having multiple endpoints, GraphQL exposes a single endpoint and using that we access the data available on the server. The structure of the data returned from GraphQL is not fixed.</p><p>In our example, we are going to automate a GraphQL query. So I will only explain the GraphQL query.</p><p><em>Queries are Data requests made by the Client from the Server. Similar to the GET calls in REST</em></p><pre>query {<br>   User(id: &quot;ek33orffi4&quot;) {<br>    name<br>    age<br>    posts {<br>        title<br>    }<br>    followers(last: 3){<br>        name<br>    }<br>  }<br>}</pre><p>This query will result in the <em>name</em>, created post titles, and last 3 followers of the User. In this example, “query” the <em>root field </em>and data comes after that are the <em>payload. </em>This query returns the response in JSON format stated below.</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;User&quot;:{<br>      &quot;name&quot;: &quot;Sithira&quot;,<br>      &quot;posts&quot;:[<br><br>        {&quot;title&quot; : &quot;GraphQL history&quot;}   ,<br>        {&quot;title&quot; : &quot;How to use work form home effectively&quot;}<br><br>      ],<br>      &quot;followers&quot;:[<br><br>        {&quot;name&quot; : &quot;Kate&quot;},<br>        {&quot;name&quot; : &quot;Jane&quot;},<br>        {&quot;name&quot; : &quot;David&quot;}<br><br>      ]<br>    }<br>  }<br>}</pre><h3>How GraphQL works in a simple way?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/0*aaKG826f4mUtkoNg" /></figure><ol><li>A client sends a query request to retrieve all the person’s names from Server.</li><li>Then the server validates the request with the schema and verifies the data inside Query type and Person Type are according to the contract.</li><li>If validation passed then the server reads the query’s payload and fetches the required information from the data source (Database, In-memory) and returns the response to the client in a JSON format. <em>Resolver</em> is responsible to retrieve the correct data for each requested field.</li></ol><blockquote>Lets start the automation part</blockquote><h3>Phase 1</h3><p>First of all, manually Send a Query(same as GET) request to the GraphQL test API server using POSTMAN. Since there is a response body, the request method will be a POST.</p><p>Request URL:- <a href="https://api.graph.cool/simple/v1/cjrqzet3c0fc30162tgt8wzf4/">https://api.graph.cool/simple/v1/cjrqzet3c0fc30162tgt8wzf4/</a></p><p>Headers:- Content-Type:application/json</p><p>Request body:-</p><pre>{<br>  allPersons {<br>    name<br>    age<br>    posts {<br>        title<br>    }<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jamRQo66fAlBil4V" /></figure><p>Now navigate to the “code” section near the top right corner and Generate code snippets under the left navigation tag named “HTTP”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/0*xJ5MRCpoteLlz5NV" /></figure><p>Now save that Json String for later uses as the request body in our automation.</p><h3>Phase 2</h3><p>Precondition:-</p><ol><li>Set up Java 8 in the machine and set the path variables accordingly with your OS (Linux/Ubuntu/Mac)</li><li>Install maven and set the path in your OS</li></ol><p>Create a maven project using IntelliJ idea (you can use any IDE ex:- Eclipse) and add these dependencies into the pom.xml file</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;<br>    &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;<br>    &lt;version&gt;4.1.1&lt;/version&gt;<br>&lt;/dependency&gt;</pre><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;junit&lt;/groupId&gt;<br>    &lt;artifactId&gt;junit&lt;/artifactId&gt;<br>    &lt;version&gt;4.10&lt;/version&gt;<br>    &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;<br></pre><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.github.json-snapshot&lt;/groupId&gt;<br>    &lt;artifactId&gt;json-snapshot&lt;/artifactId&gt;<br>    &lt;version&gt;1.0.17&lt;/version&gt;<br>&lt;/dependency&gt;</pre><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;<br>    &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;<br>    &lt;version&gt;2.9.6&lt;/version&gt;<br>&lt;/dependency&gt;</pre><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;<br>    &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;<br>    &lt;version&gt;2.9.6&lt;/version&gt;<br>&lt;/dependency&gt;</pre><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;<br>    &lt;artifactId&gt;lombok&lt;/artifactId&gt;<br>    &lt;version&gt;1.18.10&lt;/version&gt;<br>    &lt;scope&gt;provided&lt;/scope&gt;<br>&lt;/dependency&gt;</pre><p>Assume you have to Assert a Response which is with 50–100 lines of fields. Also, what if these schemas were changed and again you have to do bulk updates to your tests. weird right?</p><p>Here I have used Junit as the testing framework since json-snpashot only supports Junit currently. If we can get a snapshot of the <em>initial request</em> of the GraphQL query response, in the later runs (ex:- After a few bug fixes) we only need to check the current response matches with the stored snapshot. Jackson is used for the response deserialization. project Lombok plugin is used to generate getters and setters automatically using the @Getter and @Setter annotations. (additionally, add Lombok plugin from the Intelijidea plugins section )</p><h3>Phase 3</h3><p>Now I will explain the code in the GraphQLSampleTest Class. For the purpose of getting a better idea, I have separated code into six sections as shown below.</p><pre>@Test<br>public void testGraphQLGetRequestWithValidDetails(){<br>    //Section1<br>    String body = &quot;{\&quot;query\&quot;:\&quot;{\\n &quot;+<br>            &quot; allPersons {\\n &quot; +<br>            &quot; name\\n  &quot; +<br>            &quot; age\\n &quot; +<br>            &quot; posts {\\n &quot;+<br>            &quot; title\\n    }\\n  }\\n}\&quot;,\&quot;variables\&quot;:{}}&quot;;<br>    //Section2<br>    RestAssured.baseURI = &quot;https://api.graph.cool/simple&quot;;<br>    RestAssured.basePath = &quot;v1/cjrqzet3c0fc30162tgt8wzf4&quot;;</pre><pre>    //Section3<br>    RequestSpecBuilder reqSpecBuilder = new RequestSpecBuilder();<br>    reqSpecBuilder.setContentType(&quot;application/json; charset=UTF-8&quot;);<br>    reqSpecBuilder.setBody(body);</pre><pre>    //Section4<br>    RequestSpecification requestSpecification = RestAssured.given(reqSpecBuilder.build());</pre><pre>    //Section5<br>    GraphQLGetResponse graphResponse = requestSpecification.expect().when().post().as(GraphQLGetResponse.class);</pre><pre>    //Section6<br>    expect(graphResponse).toMatchSnapshot();<br>  <br>}</pre><blockquote>Section 1</blockquote><p>we have assigned the “query” section of generated code snippet in Phase 1 into a variable called “body”. this will be the valid request body format we are going to use with Rest Assured.</p><blockquote>Section 2</blockquote><p>Set the URL into the Static variables of RestAssured class.</p><blockquote>Section 3</blockquote><p>Construct request specification including <em>content-type header</em> and the <em>request body.</em></p><blockquote>Section 4</blockquote><p>build the request specification and attach it to the given() method to prepare the request.</p><blockquote>Section 5</blockquote><p>We have sent the Query request into the server.</p><p>Created POJO from “GraphQLGetResponse.class” and mapped the deserialized response received from the Server into it. for this operation, we have used Jackson object mapper.</p><blockquote>Section 6</blockquote><pre>@BeforeClass<br>public static void beforeAll() {<br>    start();<br>}</pre><pre>@AfterClass<br>public static void afterAll() {<br>    validateSnapshots();<br>}</pre><p>Now we are going to validate the response with a snapshot we have taken. while we run code for the very first time you can see {your_Testclass_name}.snap file is created in your test folder. Assume the first run test passed then we commit the .snap file to reuse. When we rerun the same test, the response will be compared with the contents of the snapshot file. According to that, the status is updated as pass or fail.</p><p><em>start() </em>method is responsible for instantiating a SnapshotFile for the test class. before the class, it will be executed once.</p><p>validatSnapshots() method should be called at the end of the test. This method makes sure that all the snapshots in the .snap file for a test class have used snapshots only.</p><p>The assertion part of the response happens in section 6. we use expect() and toMatchSnapshot() methods to match the snapshot with the current response.</p><p>That&#39;s it. You can clone the sample project I have created for this example here <a href="https://github.com/sith89/GraphQLAPIAutomation">GraphQL API Automation with Rest Assured</a>.</p><h3>References</h3><p><a href="https://www.howtographql.com/basics/3-big-picture/">https://www.howtographql.com/basics/3-big-picture/</a></p><p><a href="https://levelup.gitconnected.com/getting-started-with-graphql-its-pretty-easy-3ea803426298">https://levelup.gitconnected.com/getting-started-with-graphql-its-pretty-easy-3ea803426298</a></p><p><a href="https://medium.com/@weblab_tech/graphql-everything-you-need-to-know-58756ff253d8">https://medium.com/@weblab_tech/graphql-everything-you-need-to-know-58756ff253d8</a></p><p><a href="https://courses.edx.org/courses/course-v1:LinuxFoundationX+LFS141x+3T2019/course/">https://courses.edx.org/courses/course-v1:LinuxFoundationX+LFS141x+3T2019/course/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee9156f217e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>