<?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 Rajatshandilya on Medium]]></title>
        <description><![CDATA[Stories by Rajatshandilya on Medium]]></description>
        <link>https://medium.com/@automationinja?source=rss-a65165c814d6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fCmI_S3G1IyTepz7</url>
            <title>Stories by Rajatshandilya on Medium</title>
            <link>https://medium.com/@automationinja?source=rss-a65165c814d6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 10:22:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@automationinja/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[Postman Crash Course for beginners]]></title>
            <link>https://automationinja.medium.com/postman-crash-course-for-beginners-6e9602f22fb?source=rss-a65165c814d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e9602f22fb</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[api-testing]]></category>
            <dc:creator><![CDATA[Rajatshandilya]]></dc:creator>
            <pubDate>Wed, 27 Jan 2021 19:02:49 GMT</pubDate>
            <atom:updated>2021-01-27T19:02:49.741Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*tMUhrhr16HA07Rn1LOemSw.jpeg" /></figure><p><strong>Postman</strong> is an API client for developing, sharing, testing the Api’s. You can easily integrate you API automation tests into CI/CD pipeline.</p><p><strong><em>What you’ll learn in this course:</em></strong></p><ul><li>What is a Request, Collection and how to create them</li><li>What is Environment and how to Parameterize Requests</li><li>How to add assertions</li><li>How to run collections using Collection Runner</li><li>How to run postman from CLI</li><li>Integrate Postman tests with Github &amp; Jenkins</li></ul><blockquote><strong><em>What is a Request, Collections and how to create them.</em></strong></blockquote><p>You can send requests in Postman to connect with your APIs. You can send a request to create, read, update or delete the data.A <strong>collection </strong>however is noting but a collection for requests.</p><p><strong>How to create and work with request:</strong></p><h3>GET REQUEST</h3><ol><li>In your workspace, click on the NEW button on the top left corner and you’ll be prompted with a menu with multiple options. Click on the Request option.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*eAS8v16bti2mV3oJ.png" /></figure><p>2. Enter the request name and save. You’ll be redirected to your workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*y_u2ri_IIAiJhrzx.png" /></figure><p>3. Enter the below request url in the “Enter the URL” text box and select <strong>GET </strong>from the dropdown menu of the left side.</p><p>url: <a href="https://reqres.in/api/users?page=2">https://reqres.in/api/user</a>s</p><p>4. Click <strong>SEND</strong>.</p><p>5. You’ll see a <strong>200 OK</strong>(For GET request, 200 is the success code) message and response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*iyg1DeXoyVZEJ5ZL.png" /></figure><h3>POST REQUEST</h3><p>1. Click on the “<strong>+</strong>” icon to open a new tab for new request.</p><p>2. Enter the URL and select <strong>POST</strong> method from the dropdown menu url: <a href="https://reqres.in/api/users?page=2">https://reqres.in/api/user</a>s</p><p>3. For the post request, everything will be same except that in POST request you have to send some <strong>Parameters</strong>. Parameters to send:</p><pre>{<br>    &quot;name&quot;: &quot;morpheus&quot;,<br>    &quot;job&quot;: &quot;leader&quot;<br>}</pre><p>So, you can send params in a different ways depending upon the type of parameters you need to send: (i) In body tab, you can send params in a JSON format</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*goAi7EYTFS21FPBU.png" /></figure><p>(ii) You can click on <strong>Params </strong>and Enter the data in <strong>Keys</strong> and <strong>Values</strong> columns</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*TAisR0C1hnQuFScw.png" /></figure><p>OR You can use the <strong>Bulk Edit</strong> option on the right side if you prefer to enter your parameters in text instead of using the UI. In Bulk Edit, you can enter data in <strong>Key:Value</strong> pair</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*8l23dlxvPgXOPL3I.png" /></figure><p>4. After adding parameters, Click <strong>Send</strong>.</p><p>5. You’ll see a <strong>201 Created</strong>(For POST request, 201 Created is the success code) message and response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*khVC9ariUsqPpekG.png" /></figure><h3>COLLECTIONS</h3><p><strong>Colletions</strong> are nothing but group of multiple requests. Collections help you organize your tests and create a suite or workflow of your requests.</p><p><strong>Creating collections:</strong></p><p>You can create collections by :</p><p>- Clicking on <strong>NEW</strong> button on the top left corner and selecting <strong>Collection</strong> option.</p><p>- Enter Collection name and enter proper description about the collection.</p><p>- After submitting, collection will be available at the left pane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*PUYP3SpT4RfzyXuB.png" /></figure><p>- You can create a request in this collection by doing mouse hover over the collection &gt; Click on 3 dots menu &gt; <strong>Add Request</strong></p><p><strong>OR</strong></p><p>You can just drag — drop any request from any other collection into this collection</p><p>- On mouse hover, you can click on the star icon to add this collection to favourites and this collection will be available on top.</p><p>- To <strong>RUN </strong>collection, mouse hover on the collection and click on the arrow button. A side window will open. Click on the <strong>RUN</strong> button to execute all the requests in the collection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*J_dGYvu9Ru9pTFIl.png" /></figure><blockquote><strong><em>What is Environment and how to Parameterize Requests</em></strong></blockquote><p>An environment is a set of variables which we can use in our tests to manage common values for different tests.</p><p><strong>Example</strong>:</p><p>You work with api’s on different environments in your organization such as Dev env, QA Env and Prod Env. For these api, only “base url” would differ depending on the environment you are working on and rest of the parameters could be same. So, instead of changing base url every time for different environments, We’ll create a variable and save the url in that variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*5quiU6Z7NYKLVQE7.png" /></figure><p><strong>Creating Variables(Parameterization):</strong></p><p>We can parameterize our API tests or scripts by creating local, global, environment variables etc.</p><p><strong>Local variables</strong> are temporary, and only accessible in your request scripts.</p><p><strong>Global variables</strong> allow you to access data between collections, requests, test scripts, and environments.</p><p><strong>Environment variables</strong> allow you to tailor your processing to different environments</p><p>To create a variable:</p><p>- Select the date from the address, parameters, headers, or body.</p><p>- Select <strong>Set as variable</strong> &gt; <strong>Set as new variable</strong></p><p><strong>- </strong>Give some meaningful name to the variable and select the scope.</p><p>- Click on <strong>Set Variable</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*7w7QTe5JWWZM9niN.png" /></figure><p>- Variables can be used using the syntax {{Variable name}}.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*Ii8u_mXFajtnXVAF.png" /></figure><p>- You can also create and edit global and environment variables using the <strong>Environment quick Look.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*YbMvlHM2IVF1Eg98.png" /></figure><p>Similarly, you can create variables for different environments as well and saving their base url in values. So, you only have to select the environment from the dropdown.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*yx7nh3jJbqxpa-SU.png" /></figure><p><strong><em>Note</em></strong><em>: Keep the environment variable name same so that you don’t have to change the variable name in your tests every time you change the environment.</em></p><p><strong>Example</strong>: In below images you can see I kept the <strong>environment variable</strong> name as “<strong>url</strong>” but changed the values so on switching b/w diff. environment, i don’t have to change the variable name in my script but my url value changes automatically according to the selected environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*yzUN2aL7oYRl5p0b.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*lk_PH5XhG-8BW_ZQ.png" /></figure><p>- You can create variables at diff. scopes and pass them in your tests, url, parameters, headers etc.</p><blockquote><strong><em>How to add assertions</em></strong></blockquote><p><strong>At request level:</strong></p><p>Assertions can be added against your requests in the <strong>Tests</strong> tab. They are also called Tests which are written in JavaScript.</p><p>You can write your JavaScript test manually or can use code <strong>snippets</strong> on the right side of the editor.</p><p><strong><em>Note</em></strong><em>: If you want some script to execute before requests runs, you can use </em><a href="https://learning.postman.com/docs/writing-scripts/pre-request-scripts/"><em>Pre-request Scripts</em></a><em> tab.</em></p><p>- You can use <strong>pm.response</strong> object to carry out tests in order to validate the response.</p><p>- You can define tests using the <strong>pm.test</strong> function, providing a name and function that returns a boolean (true or false) value indicating whether the test passed or failed. You can use <a href="https://www.chaijs.com/api/bdd/"><strong>ChaiJS BDD</strong></a> syntax and <strong>pm.expect</strong> in your assertions to test the response detail.</p><p>- You can user <strong>console.log()</strong> to print values in console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*Thhw1z9B2djpMqBG.png" /></figure><p><strong>At collection level:</strong></p><p>- Mouse hover on the collection &gt; Click on (…) menu &gt; Edit</p><p>- Under Tests tab, you an write tests which will be applicable for all the requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*9FrAws870UbJHJLo.png" /></figure><blockquote><strong><em>How to Run Collections using Collection Runner</em></strong></blockquote><p>Collection Runner allows you to run your requests or collections at a specified sequence.</p><p>- To <strong>RUN </strong>collection, mouse hover on the collection and click on the arrow button. A side window will open. Click on the <strong>RUN</strong> button to execute all the requests in the collection. This will open the Collection Runner window.</p><p><strong>OR</strong></p><p>You can click on the <strong>Runner</strong> option next to <strong>New.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*9PdcM1-pqsmCVT1E.png" /></figure><p>- Postman will display your request and test results . To the right you will see a number for each iteration — click to select one. You will see an overview for each request, including its passed or failed tests — you can filter on each using the red and green buttons on the left.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*hVTco_W2aepv60Qv.png" /></figure><blockquote><strong><em>How to run run postman from CLI</em></strong></blockquote><p>- To run postman collection using CLI, you’ll need to install <strong>NEWMAN </strong>postman add-on. To run Newman, make sure you have <strong>Node.js</strong> installed on your system.</p><p>To confirm if you’ve Node installed or not. Open CLI or CMD and enter</p><pre>node -v</pre><p>If you have it installed, then you are good to go.</p><p>- Enter this command in terminal to install Newman</p><pre>npm install -g newman</pre><p><strong>OR</strong></p><pre>$ brew install newman</pre><p><strong>To run a collection from CLI:</strong></p><p>- Open collection menu from postman &gt; Export &gt; Choose recommended method &gt; Save the file as .JSON in a separate folder in your system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/139/0*O_Z3v4JGANVXwXzF.png" /></figure><p>- Now open CLI and enter</p><pre>newman run &lt;Collection File&gt;</pre><p><strong><em>Note</em></strong><em>: Above command won’t work if you have set any variables in your script.</em></p><p><em>- </em>To <strong>run your tests with variables</strong>, we’ve to export variables as well.</p><p>Go to Env Variable tab &gt; Edit &gt; Export &gt; Save them in the same directory and folder as Collection.json file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*fGSk_3TgfRYYwzed.png" /></figure><p>- Now open CLI and use <strong>cd</strong> command to switch to the directory where you have stored your files.</p><pre>cd &lt;Directory or folder name&gt;</pre><p>Now enter following command</p><pre>newman run &lt;Collection.json file name&gt; -e &lt;Environment variable file name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*hvIhg0pUGkyJkbu-.png" /></figure><p><strong>Results</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*Y2UWhG02dGKsI8lM.png" /></figure><blockquote><strong><em>Integrate Postman tests with Github &amp; Jenkins</em></strong></blockquote><p><strong>Pre-requisites</strong>:</p><p>- Jenkins and Newman should be installed and setup on the system.</p><p>- Push both Postman Collection and Env variable files to your repo.</p><p><strong>To run your postman tests from Jenkins:</strong></p><p>- Go to <strong>Manage Jenkins &gt; Plugin Manager &gt; Install NodeJS plugin.</strong></p><p>- Restart Jenkins &gt; <strong>Manage Jenkins &gt; Global Tool Configuration &gt; NodeJS</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*HA51-pDf87-L9CV1.png" /></figure><p>- Go to Jenkins dashboard &gt; New Item &gt; Freestyle Project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*7tLR2swJKw2vUqqR.png" /></figure><p>- Scroll to <strong>Source code management</strong> &gt; Add repository url, Branch name and credentials.</p><p>- Scroll to <strong>Build Environment </strong>and check <strong>Provide Node &amp; npm bin/ folder to PATH</strong>(Keep settings default)</p><p>- Scroll down to <strong>Build</strong> &gt; <strong>Execute shell</strong>(For Mac/Linux) or <strong>Windows windows batch command</strong>(For Windows)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*I4bLAz5ubLiccYCe.png" /></figure><p>Enter following command:</p><pre>newman run &lt;Collection.json file form git&gt; -e &lt;Env variable.json file form git&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*Dm6g70d3NQzGiq9P.png" /></figure><p>- Click <strong>Save</strong></p><p><strong>- </strong>Click <strong>Build Now</strong></p><p>- Click on the Build below &gt; <strong>Console Output</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/0*6-KIc99R7sxaQkJh.png" /></figure><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*DikV0aZIXQ-uwel-.png" /></figure><p>Cheers!!</p><p>To read some more awesome blog visit <a href="https://www.automationinja.com/blog"><strong>https://www.automationinja.com/blog</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e9602f22fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD for Automation Testers]]></title>
            <link>https://automationinja.medium.com/ci-cd-for-automation-testers-826fa16b621?source=rss-a65165c814d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/826fa16b621</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[continuous-deployment]]></category>
            <dc:creator><![CDATA[Rajatshandilya]]></dc:creator>
            <pubDate>Sun, 06 Dec 2020 14:43:30 GMT</pubDate>
            <atom:updated>2020-12-06T14:43:30.923Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*aXNO6Qb6rp-BfnAHuPcQng.jpeg" /></figure><p><strong>CI/CD pipeline</strong> or Continuous Integration/ Continuous Deployment is the backbone of today’s app deployment process.</p><p>A <strong>pipeline</strong> is a workflow which consist of multiple jobs to deliver the software to the customers.</p><blockquote><em>Version control &gt; Build &gt; Unit tests &gt; Deploy &gt; Automation tests &gt; Deploy to production</em></blockquote><p>Above representation is the basic flow of the whole pipeline process that represents how software will move along the different stages before it reaches the customer.</p><blockquote><em>As an Automation tester, we majorly needs to focus on Continuous Integration.</em></blockquote><p>Continuous Integration process after the planning stage. In this stage, developer integrate their code very frequently (multiple times a day) in some central source code repository. Each integration is verified by automated build and automated tests.</p><p><strong>Major key benefit of continuous integration</strong></p><p>1. Continuous feedback on the recent changes in code.</p><p>2. Detects the errors early and quickly.</p><p>3. Cost effective</p><p>4. Decrease testing time and QA team can invest more time in building quality culture.</p><h3>Continuous delivery VS. Continuous deployment</h3><p><strong>Continuous deliver</strong>y is an extension to the Continuous Integration process.It deploys all the new code to the testing or production environment after going through the automated build stage.In other words, we can set an automated release process as per our requirements(daily, weekly or fortnightly) with just a click of a button.</p><p>However, <strong>Continuous Deployment</strong> is an add-on to the Continuous Delivery process. In this every change that passes all the stages of the pipeline is released to the customers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*kP75IdFcnmhUNb7MsVA6HQ.png" /></figure><p>Cheers!! 🍻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=826fa16b621" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scrum guide 2020 update]]></title>
            <link>https://automationinja.medium.com/scrum-guide-2020-update-8cd6d3d22805?source=rss-a65165c814d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cd6d3d22805</guid>
            <category><![CDATA[scrum-guide-revision]]></category>
            <category><![CDATA[agile-methodology]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[scrum-guide]]></category>
            <category><![CDATA[2020]]></category>
            <dc:creator><![CDATA[Rajatshandilya]]></dc:creator>
            <pubDate>Wed, 02 Dec 2020 14:07:36 GMT</pubDate>
            <atom:updated>2020-12-02T14:07:36.324Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*_3k8IN327SdlXTNg-oD-XQ.jpeg" /></figure><p>A new Scrum guide has been released on 18 November 2020 and it’s quite a big change.</p><p>Below are the few points which are the major changes:</p><ol><li><strong>LESS PRESCRIPTIVE AND MORE ROOM TO EXPLORE </strong>— The scrum guide has been reduced to 13 pages, earlier it used to be 19 pages(released in 2017) which makes it LESS PRESCRIPTIVE and gives Scrum team more room to EXPLORE. — Major change in the scrum guide 2020 is the changes in the daily scrum meetings. Three questions (What you did in last 24 hrs, What are the plans for today and What are the plans for tomorrow)that needs to be answered by each scrum team member has been removed. Now team can decide what is the most valuable step that we can take to achieve the sprint goal. Which Scrum meetings more than just a Status report meetings — Work estimates has been removed which means now team does not have to provide estimates on how long it will take to complete a task.</li><li><strong>ONE TEAM ONE GOAL — </strong>Earlier we used to have different teams such as Development team, QA team etc. But, now they have been removed. Everybody will be called as Developers irrespective of whether they are from Development, qa or any other ream. Collectively there will be only one scrum team. — If scrum team is too large or have more than 10 members, it should be split into multiple cohesive Scrum Teams with one Product Owner working towards the same goal.</li><li><strong>CLEAR ACCOUNTABILITY FOR SCRUM MASTER </strong>Scrum master is now accountable for establishing scrum process and defined in the guideline and also for the scrum team effectiveness. So, if scrum team is not effective in delivering values to the customer, we can say that Scrum master has done a great job.</li><li><strong>THE INTRODUCTION OF PRODUCT GOAL </strong>A new term has been added in the scrum guide ie…”Product Goal”. Product goal can be described as the future state of the product which can help scrum team to plan accordingly. Now Product owner needs to have a long term product goal ie…Product owner needs to have a clear picture of what’s gonna happen with the product after 6 months or 1 year. Product owner needs to move from “Project mindset” to “Product mindset”.</li><li><strong>A HOME FOR THE SPRINT GOALS, DEFINITION OF DONE &amp; THE PRODUCT GOAL </strong>Earlier Sprint goals and Dod were not the part of the Scrum artifacts but they have been added this year. — Sprint goals: Committed for sprint backlogs — Dod: Committed for the increment — Product goals: Committed for the product backlog If product backlog does not meed the DOD and quality standards then it cannot be released for the review.</li><li><strong>SCRUM TEAM IS MORE EMPOWERED TO BE SELF MANAGED </strong>In 2017 scrum guidelines, it used to be self organizing team and now it has been changed to self managing team. Self managing team decides who does what, when and how. This gives scrum team more power and authority to deliver valuable products to the customers.</li><li><strong>SPRINT GOAL IS “WHY” OF THE SPRINT </strong>In this year scrum guideline, a new topic “WHY” has been introduced to discuss during sprint planning. From now, during sprint planning, team also need to have an idea of “Why the current sprint is valuable ?”. The goal of the sprint could be anything, maybe to get more customers, Improve customer experience or service etc.</li></ol><p>Check-out more blogs here:</p><p><a href="https://www.automationinja.com/">https://www.automationinja.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cd6d3d22805" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generating Extent report during parallel testing on Suite level (Thread safe extent report)]]></title>
            <link>https://automationinja.medium.com/generating-extent-report-during-parallel-testing-on-suite-level-thread-safe-extent-report-5c3e7457d041?source=rss-a65165c814d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c3e7457d041</guid>
            <category><![CDATA[threadlocal]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[parallel-testing]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[extentreport]]></category>
            <dc:creator><![CDATA[Rajatshandilya]]></dc:creator>
            <pubDate>Mon, 05 Oct 2020 09:46:19 GMT</pubDate>
            <atom:updated>2020-10-05T09:51:33.328Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*-DwWRCv2xB4pyyV-tFGG_g.jpeg" /><figcaption>Thread safe extent report during parallel testing</figcaption></figure><p>Reporting is one of the most important feature of any automation framework as it shows overall report of your test cases. Although, Selenium provides inbuilt HTML framework using framework like JUnit and TestNG but that report but they lack in customisation and in look and feel.</p><p>Extent reports are more customisable and can be integrated in your automation framework using selenium. Also, they’ve a much better UI and UX and can be shared with the stakeholders.</p><p><em>Check the article below on how to integrate extent report into framework.</em></p><p><a href="https://www.automationinja.com/post/add-extent-report-4-in-selenium-webdriver-on-suite-level"><em>https://www.automationinja.com/post/add-extent-report-4-in-selenium-webdriver-on-suite-level</em></a></p><p>Now let’s discuss on how to make these reports thread safe because if you are running multiple threads of same tests, chances are you first test object will be replaced or overridden by second test object and Extent Report only reports the active threads.</p><p>To prevent that form happening, we’ve to user ThreadLocal class in java We’ve discussed on ThreadLocal java class in parallel testing blog.</p><p><a href="https://www.automationinja.com/post/thread-safe-parallel-testing-with-selenium"><em>https://www.automationinja.com/post/thread-safe-parallel-testing-with-selenium</em></a></p><p>To implement this, we only have to make ExtentTest class object Thread safe and thats it.</p><p>Also, you can make ThreadLocal <strong>private</strong> and <strong>static</strong> so that it’s confined to only this class. So, Now when same tests are called in multiple threads at the same time, there objects won’t be overridden by each other.</p><p><strong><em>On test start:</em></strong></p><p>All tests object will be stored in the ThreadLocal class ref. variable and this will be implemented by passing the test object in “ .set() “ method.</p><p><strong><em>On test finish:</em></strong></p><p>We’ve to retrieve those test objects and to do that we’ll use “ .get() “ method.</p><p>Refer to below complete code snippet:</p><pre>public class TestListner implements ITestListener<br>{</pre><pre>    ExtentReports extent = ExtentReportGenerator.<em>ExtentReport</em>();<br>    ExtentTest test;;</pre><pre>    private static ThreadLocal&lt;ExtentTest&gt; <em>extent_test </em>= new ThreadLocal&lt;ExtentTest&gt;();</pre><pre>    public void onTestStart(ITestResult result)<br>    {<br>        test =           extent.createTest(result.getMethod().getMethodName());<br>        <em>extent_test</em>.set(test);<br>    }</pre><pre>    public void onTestSkipped(ITestResult result)<br>    {<br>        <em>extent_test</em>.get().skip(result.getThrowable());<br>    }</pre><pre>    public void onTestSuccess(ITestResult result)<br>    {<br>        test.log(Status.<em>PASS</em>, &quot;Successful&quot;);<br>    }</pre><pre>    public void onTestFailure(ITestResult result)<br>    {<br>        <em>extent_test</em>.get().fail(result.getThrowable());<br>    }</pre><pre>    public void onFinish(ITestContext context)<br>    {<br>        extent.flush();</pre><pre>    }<br>}</pre><p>Thanks</p><p>Cheers!! 🍻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c3e7457d041" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>