<?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 Amarendra Singh on Medium]]></title>
        <description><![CDATA[Stories by Amarendra Singh on Medium]]></description>
        <link>https://medium.com/@assaini007?source=rss-8d08bcf48b22------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Z1s71NdEzDnUa1uSVfl91A.jpeg</url>
            <title>Stories by Amarendra Singh on Medium</title>
            <link>https://medium.com/@assaini007?source=rss-8d08bcf48b22------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 21:02:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@assaini007/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[Enhancing Reliability in Cypress Tests with API Request Interception]]></title>
            <link>https://medium.com/@assaini007/enhancing-reliability-in-cypress-tests-with-api-request-interception-7a9abe3cd85b?source=rss-8d08bcf48b22------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a9abe3cd85b</guid>
            <dc:creator><![CDATA[Amarendra Singh]]></dc:creator>
            <pubDate>Wed, 20 Sep 2023 06:26:52 GMT</pubDate>
            <atom:updated>2023-09-20T06:26:52.131Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nVyPBmTNZ6jyPohQp1_nRQ.png" /></figure><h3>Introduction</h3><p>Intercepting API Requests means manipulating the HTTP requests made by the browser through the user. In Cypress, it has built-in support for intercepting and stubbing network requests, that allow you to control the data returned from the server.</p><p>The cy.intercept() is a method used to intercept and modify HTTP requests and responses. This feature allows control over network requests and responses, which, in turn, helps to address synchronization issues.</p><p>Additionally, API request interception empowers testers to stub responses effectively. This means you can provide predefined responses to simulate various scenarios, enhancing your ability to thoroughly test your application’s behavior under different conditions.</p><h3>How cy.intercept() Works</h3><p>cy.intercept does not make a request but rather ‘listens’ to requests that occur on the network layer. We can expect a certain request to occur after some action or wait for the certain request to be completed before moving to the next step.</p><p>cy.intercept is typically used in conjunction with two other commands ‘.as’ for naming the intercepted request and ‘cy.wait’ for waiting until the request is complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*AaasO-FwJcldbdflLRmXXQ.png" /><figcaption>Intercepting API Requests</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*OpYRYlDSIELQ0hiJnZPD2A.png" /><figcaption>XHR Request</figcaption></figure><p>In the above example, you can observe that after clicking on the login button, the ‘events/push’ request takes the maximum time to execute.</p><p>To intercept this request, we provide the HTTP method using the endpoint URL the API is requesting, and we assign it an alias using the .as(‘events’) command.</p><p>Once the login button is clicked, the ‘events’ request should be triggered. Therefore, we use cy.wait(‘@events’) to proceed to the next step only after the request has been completed.</p><h3>Challenges Faced in Cypress Tests</h3><ul><li><strong>Flaky Tests</strong></li></ul><p>Tests that fail intermittently due to unpredictable network behavior.</p><ul><li><strong>Testing Error Scenarios</strong></li></ul><p>Difficulty in simulating error responses for robust error-handling testing.</p><ul><li><strong>Timing Dependency</strong></li></ul><p>Inability to ensure that data is available for testing at the right moment.</p><h3>How API Request Interception Handles the Cypress Tests Challenges</h3><p><strong>Control Over Timing</strong></p><ul><li>By intercepting API requests, you can control when responses are returned.</li><li>This means you can ensure that the API request has been completed before proceeding with the rest of your test.</li><li>This reduces the chances of flaky tests that fail due to timing issues.</li></ul><p><strong>Example:</strong> Imagine you are testing a real-time chat application. When a user sends a message, the application sends an API request to the server to post the message. To ensure that the sent message appears in the chat feed before proceeding with the test, you can intercept the message-posting API request and wait for it to complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*sBhRBt8a0OMSkCMjOTsCNg.png" /><figcaption>Control Over Timing</figcaption></figure><p><strong>Stubbing Responses</strong></p><ul><li>You can stub responses for API requests.</li><li>This means you can provide predefined responses to simulate different scenarios.</li><li>This can be helpful when you want to simulate success, error, or loading states to test how your application handles these conditions.</li></ul><p><strong>Example:</strong> Suppose you’re testing an e-commerce website, and you want to ensure that when a product is out of stock, the application displays the appropriate message to the user. To achieve this, you can intercept the API request responsible for checking the product’s availability and stub a response indicating that the product is out of stock.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*R_E-QO2Ffn1szFXvuMi2TQ.png" /><figcaption>Stubbing Response</figcaption></figure><p><strong>Predictable Tests</strong></p><ul><li>You’re removing external dependencies and ensuring that the data you need is available when you need it.</li><li>This is particularly useful when you’re waiting for specific data to be available before performing actions on your web application.</li></ul><p><strong>Example:</strong> In an e-commerce application, you want to verify that product information is displayed after loading it from an API. Intercepting the product retrieval request allows you to guarantee that the data is available, leading to more predictable and reliable tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*T4kM5DLNoDBX20Php6_Vdw.png" /><figcaption>Predictable Test</figcaption></figure><h3>Conclusion</h3><p>API request interception in Cypress is a powerful tool for addressing synchronization issues, but it does come with certain challenges.</p><p>Testers with basic API knowledge can overcome these challenges through collaboration with developers, referring to API documentation, and using Cypress features effectively.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a9abe3cd85b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Role of QA and Automation in DevOps]]></title>
            <link>https://medium.com/@assaini007/role-of-qa-and-automation-in-devops-903ec2fe32b5?source=rss-8d08bcf48b22------2</link>
            <guid isPermaLink="false">https://medium.com/p/903ec2fe32b5</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Amarendra Singh]]></dc:creator>
            <pubDate>Tue, 07 Apr 2020 16:19:34 GMT</pubDate>
            <atom:updated>2020-04-07T16:19:34.025Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is DevOps?</h3><p>DevOps is a Software Development methodology that integrates all the operations related to the Software Development from <strong><em>Development and Quality Assurance</em></strong><em> </em>to deploy the code to production in an automated &amp; repeatable way. With DevOps, the delivery is faster and more reliable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*fDTUfXzvb4vRsrn8SEIGsg.png" /></figure><h3>Components of DevOps</h3><h4>1. Continuous Integration:</h4><p><em>“Continuous Integration is a team practice where the developers/testers (who are working in automation) frequently merge their code changes to a central repository.”</em></p><p>Continuous Integration is a team activity in which a team of developers/testers check-in their code to the shared repository. After the check-in, there is a need to integrate all the code in a common build server and perform an automated build followed by running Unit tests and finding out the error early and easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*pcDmRqsGHkdP6SLTJrNbdg.png" /><figcaption><strong>Continuous Integration</strong></figcaption></figure><h4>2. Continuous Delivery:</h4><p>Continuous Delivery is a process of developing the software in small iterations and making it ready for the release in a shorter span of time with more accuracy and reliability. It includes all the software development life cycle processes like coding, building, testing, etc. through an automated way.</p><p>Before moving to the Production, the software goes through various stages in the lifecycle of delivery i.e. QA, Staging, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dZMLtng-sEpmalasUZ0o4w.png" /><figcaption><strong>Continuous Delivery</strong></figcaption></figure><h4>3. Continuous Testing:</h4><p>Continuous testing is a way of testing continuously in an automated way to reduce the testing efforts, to detect the errors early and deliver more quality to the software.</p><p>Continuous testing involves both CI/CD approach. After integrating all the work into a common build server team needs to run a certain number of unit tests. Once the unit tests pass then the changes are deployed to the QA environment.</p><p>When the changes are deployed to any environment then we need to perform different types of Testing i.e. Unit/Functional/UI/Acceptance testing etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_mi2QfM0G_kCOvZFPRBzqA.png" /><figcaption><strong>Continuous Testing</strong></figcaption></figure><h4>4. Continuous Monitoring:</h4><p>Once the application or changes are deployed to the Production environment, we need to check on various performance parameters of application to continuous monitor like how long application in running, stability, performance, etc.</p><p>This monitoring must be automated in the same way as previous operations like integration, testing, and deployment were done. In highly dynamic and scaled environments, the process of monitoring microservices must adapt to changes without manual intervention and configuration.</p><h3>Role of Automation in DevOps</h3><p>If we talk about Automation in DevOps, it means everything in DevOps life cycle starting from code generation till the code is pushed to the production and even after that to monitor the application and system in production should be work in an automated way. So, in DevOps practice, automation plays a key role in Development, Quality Assurance &amp; Operations.</p><p>Automation in Development starts from the code generation and carried out at every phase of the development. Each time a commit is made in the version control system that commits was continuously pulled, build and tested (Unit testing and Integration testing) and then pushed to a non-production environment. All these steps are automated to make the delivery faster.</p><p>As soon as the code release to any environment, automated test cases should be triggered out automatically to perform the various types of testing. For better quality and performance, we need to automate test cases, not just the unit and UI tests but also installation tests, integration tests, user experience tests, etc.</p><p>In addition to development and QA activities, the operations team also works to automate in configuring the servers, configuring firewalls, monitoring the application in the production system, etc.</p><p>So, automation in DevOps takes place at each and every stage of DevOps life cycle i.e. Continuous Integration, Continuous Testing, Continuous Deployment, and Continuous Delivery.</p><h3>Role of QA in DevOps</h3><p>Not only developers but testers too play a very important role in DevOps. The role of the QA in DevOps is not only in writing and executing the automation scripts, but he/she also helps in fulfilling and delivering all the objectives in DevOps. The very purpose of DevOps is that both Developer and QA work in collaboration with each other and QAs’ are required to align their efforts to all the activities in the DevOps cycle.</p><p>Here are some key points on which QA needs to focus:</p><h4>1. Implementing Automation Testing:</h4><p>Automation in the testing area requires that there is a little or no human intervention is required. In Continuous Delivery, we need to perform the same type of testing continuously in different environments to better ensure the quality to deliver faster, but if we need to perform with the manual testing techniques the Delivery process would be slower.</p><p>The same set of test cases can be automatically executed in different environments with the same or different data sets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*YGTi3jRL1S_BGk8Z1aL27g.png" /><figcaption><strong>Implementing Automation Testing</strong></figcaption></figure><h4>2. Ensuring Code maintainability:</h4><p>QA needs to Automate the test cases to ensure maximum code coverage. Test automation scripts should be well maintained in a timely manner to accommodate any change requests/enhancements/bug fixes in the automation code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*hvLHHF4gDghS2So-JEvOsQ.png" /><figcaption><strong>Ensuring Code maintainability</strong></figcaption></figure><h4>3. Using various Testing Techniques and Testing Tools:</h4><p>QA needs to leverage the use of automation tools and techniques to automate the test scripts wherever possible. Using different types of testing techniques (Functional and Non-functional Testing) delivers a quality product and Automation Test scripts can be runs across various platforms (and cross-browser in case of web applications) and environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*hRbBgR6fBq3yqK3IG3qD5g.png" /><figcaption><strong>Testing Techniques</strong></figcaption></figure><h4>4. Pre-Testing/Post-Testing Efforts should be automated:</h4><p>All their pre-testing tasks, cleanups, post-testing tasks, etc. are automated and aligned with the Continuous Integration cycle. There is no room for manual testing.</p><h4>5. Aligning testing Efforts to each Deployment:</h4><p>The test automation scripts should be properly configured with the release pipelines in order to be triggered the testing process automatically with the completion of each deployment. All test configurations should be set up properly for each test environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRFQ64SYMXtV02VIIRnZgQ.png" /><figcaption><strong>Aligning testing Efforts</strong></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=903ec2fe32b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Testing Using REST Assured]]></title>
            <link>https://medium.com/@assaini007/api-testing-using-rest-assured-56d21d8be762?source=rss-8d08bcf48b22------2</link>
            <guid isPermaLink="false">https://medium.com/p/56d21d8be762</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Amarendra Singh]]></dc:creator>
            <pubDate>Thu, 02 Jan 2020 18:12:21 GMT</pubDate>
            <atom:updated>2020-01-03T11:35:27.178Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is REST Assured?</strong></h3><p>It is a Java-based library, one of the most popular libraries to test RESTful Web Services and used to perform testing and validation of Rest Services with simplicity. We can use any Java IDE for writing code to test our API. REST assured is helpful in writing small Unit tests as well as large automation frameworks, where we can create test cases for large APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iIAGKMOUHcttACgV2b0Brw.png" /></figure><blockquote>It provides a BDD-like structure to write the code that is one of the advantages of using it as it makes it simple to use.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*DNiAFIHqWvi417oR2m5CxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*afmC5wlRsWjJSGR0DEFRAA.png" /></figure><h3><strong>REST Assured API Structure</strong></h3><p>REST-assured provides a lot of nice features, such as XPath-Validation, Specification Reuse, easy file uploads and with those features, we will handle automated API testing much easier.</p><blockquote>It can easily be integrated with JUnit and TestNG frameworks to achieve Continuous Integration and Continuous Deployment. Extent reports produce an interactive report, which gives a good overview of the automation test results. We can easily generate the extent reports using the REST Assured API structure.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*3Qej4jdnYl4csQMVhjFeJw.png" /></figure><h3>Introduction to REST API testing</h3><p>REST Assured supports <strong>POST, GET, PUT, DELETE, OPTIONS, PATCH, and HEAD </strong>requests and can be used to validate and verify the response of these requests.<strong> </strong>For e.g. we can verify the Status code, Status message, Headers and even the Body of the response. One of the powerful features of REST assured is the support of XML Path and JSON Path syntax to check specific elements of the response data. It’s very similar to using XPath API.</p><p>To explain the REST Assured API requests, we need the following pre-requisites:</p><ol><li>For dummy REST Assured APIs, we have taken a sample from the following site: http://dummy.restapiexample.com/</li></ol><p>2. Need to configure the TestNG Framework.</p><p>3. Need to configure the REST Assured API with the project.</p><p><strong>How to make a GET request using REST Assured?</strong></p><p>GET method is one of the most common methods of HTTP Protocol which is used to request data from a specific resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*6sFhI3bVrWhVMiFpUnI9aA.png" /></figure><p><strong>get():- </strong>Is used to perform GET request.</p><p><strong>How to send a POST request using REST Assured?</strong></p><p>POST is one of the most common methods of HTTP which is used to <strong><em>send data</em></strong> to a server to create/update the resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*x3mYv0Uqg8io9YHtsNUvcA.png" /></figure><p><strong>contentType():- </strong>Content-Type is the type of resource that we used to send data.</p><p><strong>body():- </strong>Body is nothing but carries the details that we want to POST<strong>.<br>post():- </strong>Is used to perform POST request.</p><p><strong>How to send a PUT request using REST Assured?</strong></p><p>PUT should be used when you want to <strong><em>modify</em></strong> a resource that is already a part of the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*5gzR7eVRFWWFBZdIc5u_-Q.png" /></figure><p>Like a POST request, contentType functionality is the same.</p><p><strong>body():- </strong>Body is nothing but carries the details that we want to POST<strong>.<br>put():- </strong>Is used to perform PUT Request.</p><p><strong>How to send a DELETE request using REST Assured?</strong></p><p>DELETE method is quite easy and straightforward to understand as its name suggest, it is used to <strong><em>Delete</em></strong> any resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*hyQsZKQ-gFdv56BzoZMHwQ.png" /></figure><p><strong>delete ():- </strong>Is used to perform Delete any resource.</p><p><strong>How to get an access token using REST Assured?</strong></p><p>Access tokens are the thing that applications use to make API requests on behalf of a user. The access token represents the authorization of a specific application to access specific parts of a user’s data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*zfMPIsLRACWHfGTbJe4oGQ.png" /></figure><p><strong>Response response:- </strong>response object is used to collect the data like status code, response body, content, etc.</p><p><strong>contentType():- </strong>contentType is the type of resources that we used to send data.</p><p><strong>formParms():-</strong> Is used to pass the parameter.</p><p><strong>uri:- </strong>Root address of the resource.</p><p><strong>How to make requests using the access token?</strong></p><p>We can pass the authorization token as a header for GET/POST/PUT/DELETE method in Rest Assured and here is the procedure how we can do so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*7SMJFKLBovuR0cfS2-xnLQ.png" /></figure><p><strong>Response response:- </strong>response object is used to collect the data like status code, response body, content, etc.</p><p><strong>header():- </strong>Is used to set the request header.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*55UHQK6E-YS3gjSazdvNQA.png" /></figure><h3><strong>Best Practices</strong></h3><p><strong>Validate the response for every key:- </strong>The best practice is to validate the response for every key you get in JSON along with the correct STATUS code. If the entire response is as per the expected data, then everything should be working fine.</p><p><strong>Write Clean Test Code:- </strong>The test code written for the API requests should be clean i.e. it should follow the proper coding standards like giving proper variable names, parameter passing, etc.</p><p><strong>Create Reusable Methods:- </strong>Create a Request Specification to reuse request configurations (base URL, parameters, content type, debugging logging) that you want to use for all requests.</p><p><strong>Use POJOs and Object Mapping:- </strong>90% of the time the data is sent in a form of JSON Object, so the best approach is to follow the concept of POJO classes and then send it to the request body.</p><p><strong>Use JSONPath for Simple Cases:- </strong>If you are only interested in a single value of a JSON response, creating a POJO class for mapping is a little bit overkill. In this case, JSONPath can be used to extract certain values out of a JSON document. JSONPath is like XPath for JSON.</p><h3><strong>Pros and Cons of REST Assured</strong></h3><p><strong>Pros: -</strong></p><p>· <strong>Easy to use: </strong>It supports a Given/When/Then test notation, which instantly makes your test’s human-readable.</p><p>· <strong>Easy integration with TestNG/Junit: </strong>Easy to integrate with JUnit and TestNG frameworks.</p><p>· <strong>Code Reusability: </strong>As it is a Java client, it supports the ability to reuse the code for a new function.</p><p>· <strong>Support Data-Driven framework: </strong>It supports the <strong>Data-Driven framework</strong> for separating the “data set” from the actual “test case” (code). The test data is fed from external sources such as an excel file, JSON file, etc.</p><p>· <strong>CI/CD integration: </strong>We can easily integrate with other tools like Maven, Jenkins GitHub to provide Continuous Integration and Continuous Deployment functionality.</p><p>· <strong>Customize Reports: </strong>Can be used with any customized/open-source reporting tool.</p><p><strong>Cons: -</strong></p><p>· Requires knowledge of the Java programming language.</p><p>· Does not support SOAP APIs explicitly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56d21d8be762" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automation Architecture Design Pattern]]></title>
            <link>https://medium.com/@assaini007/automation-architecture-design-pattern-5f81817ed530?source=rss-8d08bcf48b22------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f81817ed530</guid>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Amarendra Singh]]></dc:creator>
            <pubDate>Thu, 12 Dec 2019 17:07:11 GMT</pubDate>
            <atom:updated>2020-01-02T18:05:44.839Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Architecture in general?</h3><p>Architecture is the process of planning, designing and constructing a building or any other structures. For an automation testing project, architecture is as important as it is for constructing a building. The best architecture design is one that won’t cost much but will continue to drive the economic flow. Designing and building architecture takes time, money, and collaboration.</p><p>In this blog, we will focus on the high-level architecture of the Selenium framework. We will provide you an insight through the steps to be followed and core components required to build a strong framework for your Selenium project.</p><h3>What is a Selenium automation framework?</h3><p>A Selenium automation framework is a platform that can be developed by integrating various tools and services to efficiently design and develop automated test scripts.</p><p>Selenium is the most favorite tool among testers when coming to automation testing because of the benefits it provides. Selenium is an open-source tool and provides support for multiple languages and browsers. It can be integrated into other third-party tools as well. But “Selenium alone does not fulfill the needs of the best framework.”</p><p>The biggest challenge in developing a framework is to identify the tools and resources that best suites our needs to build a reliable framework that can be maintained easily with changing requirements.</p><h3>Steps to create a Selenium Automation Framework:</h3><p>We can build a real automation framework that we can utilize without worrying about technology. We perform black-box automation testing with Selenium because of the regression tests that need to be executed again and again. So, here are the steps listed to create a good automation framework for the Selenium project.</p><ol><li>Choosing the right set of tools</li><li>Building the components required for application functionality</li><li>Implementing CI/CD</li></ol><blockquote><strong>Choosing the right set of tools:</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/0*hDCHihziNF2PCZt0" /></figure><p>Choosing the right combination of tools that best suits your project requirement is the foremost task in designing a framework. The right set of tools is a combination of programming language and Unit test framework. Depending upon the core technology your application is developed in the choice of programming language to write test script can be made.</p><p>As most of the applications, these days are developed in Java or C#. So, these languages are the most popular languages among the Selenium testers and are the safest choices to be made so that testers can get all the required online support for tutorials as well as code snippets.</p><p>Depending upon the choice of language of the tester, the unit test framework can be chosen.</p><p>1. Java as a Programming language: TestNG is the Next Generation unit testing framework that is used by testers for writing selenium test cases with Java as the programming language. It is inspired from JUnit in using the annotations and is more powerful than JUnit. TestNG provides additional advantages over Junit.</p><p>a) Default Selenium tests do not generate the properly formatted report but with TestNG, the properly formatted report can be generated displaying the number of test cases that are passed, failed or skipped.</p><p>b) The same tests can be executed multiple numbers of times</p><p>c) Easy integration with other tools like Maven, Jenkins, etc.</p><p>2. C# as a Programming language: NUnit is the unit test framework in .NET that can be used to write the test script for C#. Although NUnit is not as powerful and flexible in use as TestNG if our choice of language is C# then we would use NUnit framework.</p><p>Just because of the advantages of TestNG over other unit testing frameworks we have chosen Java with TestNG as our set of tools to describe the architecture in detail.</p><blockquote><strong>Building the components required for application functionality:</strong></blockquote><p>To build the application core functionality components, the POM (Page Object Model) is the best model to follow. To implement POM in your project you should learn how to manage the core components in the folder structure.</p><p>POM is the basic building block in test automation frameworks because it reduces duplication of code as you will organize your code into Page Objects which in result reduces the test maintenance cost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/0*6of8Il13TXy-r4zr" /></figure><p>Here are the important steps that are listed to build the core components of the framework: -</p><p>Selenium Core components are designed to manage the browser instances as well as element interactions. To achieve this purpose and manage the functionality you should create folders inside your project and name them as Main and Test. The main folder could be further segregated into 3 folders — Base, Pages, and Utility.</p><p>a) Base Folder — Base folder contains the Base class. The Base class is a collection of all those methods that would be called once inside the entire script. The Base class contains the functionality of browser instances, implicit wait, deletion of cookies.</p><p>b) Pages Folder — There would be one class for every page of the application. So, as many pages are there in the application as many classes would be created under this folder. For example, my application has several pages like Login, Logout, Dashboard, Documents page, etc.</p><p>Each page has different actions that you perform on the elements of the page. Each class will contain different methods depending on the core functionality of the respective page. Every class is a combination of element locators to locate all the web elements on the page and methods that contain the actions to be performed on those elements.</p><p>c) Utility Folder — This folder contains all custom methods like wait, screenshot, scroll, etc. You can directly call these methods anywhere you required in the script without creating again and again.</p><ul><li>The test folder could be organized in further folders as follows:</li></ul><p>a) Config folder — Every application runs on a specific configuration and every user is provided with a different authentication. All these fields need to be provided from some external source so that if the script is to run with a different configuration, the code need not be touched and configuration variables like browser, username, and password, etc. fields can be changed easily. To achieve this purpose, you need to create a config file under this folder to store all the configuration variables.</p><p>b) Test folder — All the test cases need to be in a different test class. There can be more than one class for the TestNG test cases as per the convenience of the tester.</p><p>c) Test Data folder — Designing, managing and storing the test data is itself a tedious task. Managing the test data means separating the test data from the test script. You need to store the data centrally for easy access. Test data could be either a PDF document, an image file or an excel file containing some registration information, etc. All these test data would be stored in this folder.</p><p>d) Logs folder — Logs folder contain all the custom as well as the application logs file.</p><p>e) Test Controller folder — The controller folder contains those files that help to execute multiple test cases parallel at the same time.</p><p>f) Reports folder — The reports folder contains all types of reports that are generating on executing the automation script like “TestNG HTML Reports”, “Extent Reports”. Users can easily check reports from this folder.</p><p>The POM makes the life of a tester easier by making the code maintenance easier. If there happens to be any change in the functionality of any page, it can be easily located, and changes can be made effortlessly.</p><blockquote><strong>Implementing CI/CD:</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/0*Ru5GYEs9SjqbxW4a" /></figure><p>Selenium can be easily integrated with other tools to provide Continuous Integration and Continuous Deployment functionality. It can be integrated into various tools like Maven, Jenkins GitHub, etc.</p><p>Maven is a powerful project management tool based on the concept of a POM.</p><p>GitHub is a repository where developer/QA store their projects and code for other people to use and take benefit from them. Git is a version control system. When developer/QA create an application, continuous changes are being made to the code and new versions are released and store that code at a centralized location. This allows developers/QA to collaborate easily, as they can download a new version of the software, make changes, and upload the newest revision. Every developer/QA can see these new changes, download them, and contribute.</p><p>Jenkins is a continuous integration tool which allows Selenium tests to run every time your software changes and deploy the software to a new environment when the tests pass. Jenkins can also schedule your tests to run at a specific time and save the execution history and Test Reports.</p><h3>Conclusion:</h3><p>Selenium is a powerful tool to perform functional and regression testing. A strong foundation is required to build a stable project which can be provided by good architecture. A selenium project with good architecture is easy to maintain.</p><p>Hope you have learned to create the architecture with my blog. If you like my blog, click on the like icon. Feel free to post your queries on the same and stay tuned for more tutorials on Selenium.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f81817ed530" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>