<?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 Saira Mughal on Medium]]></title>
        <description><![CDATA[Stories by Saira Mughal on Medium]]></description>
        <link>https://medium.com/@saira.mughal?source=rss-30e8c32046bb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ex8_ZCfV97KbIzKO.jpg</url>
            <title>Stories by Saira Mughal on Medium</title>
            <link>https://medium.com/@saira.mughal?source=rss-30e8c32046bb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 15:46:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saira.mughal/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[Simplifying UI Test-Automation with Page Object Model and Controllers]]></title>
            <link>https://medium.com/motive-eng/simplifying-ui-test-automation-with-page-object-model-and-controllers-8115657908b9?source=rss-30e8c32046bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8115657908b9</guid>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[page-object-model]]></category>
            <dc:creator><![CDATA[Saira Mughal]]></dc:creator>
            <pubDate>Thu, 08 Oct 2020 17:02:43 GMT</pubDate>
            <atom:updated>2020-10-08T17:02:43.293Z</atom:updated>
            <content:encoded><![CDATA[<h3>Simplifying UI Testing with Page Object Model and Controllers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ip8iIpyFrt8GWZyk" /></figure><h3>Before we begin:</h3><p><strong>KeepTruckin</strong> is on a mission to connect the world’s trucks. With the leading ELD and fleet management platform, we are bringing the trucking industry online and fundamentally changing the way freight is moved on our roads.</p><p>Adding new features and support before the world imagines them is one of the core characteristics at KeepTruckin. As time passes, more features and enhancements are added; each addition makes the experience that much better.</p><p>Reaching our customers with a rich-featured but reliable product is a challenge that our teams are working on globally. Quality assurance is one of the main aspects before pushing anything to production. Ensuring quality through manual means can be time-consuming and is subject to human error. To speed up the process, automation testing is being exercised.</p><p>The key challenge while writing automation scripts is to design an architecture that is scalable and error-free, just like the company’s product. In this article, we will discuss the architecture and customized pattern, which was derived after thoughtful research and study.</p><p>The information available in this blog is helpful for readers who are interested to learn about:</p><ul><li>Design patterns for test automation.</li><li>Implementation of automation tests for web-based applications.</li></ul><p>In automation testing, writing test scripts is easy. But, writing scalable, reliable, and speedy tests are very challenging. The Internet is flooded with coding guidelines and design patterns to design and implement tests efficiently. One of the most popular design patterns being used is the Page Object Model.</p><h3>What is POM?</h3><p>As the name suggests, a Page Object Model comprises objects, each representing a page interface in the application under test. In the programming world, an object is an instance of a class, which contains data members and some actions to be performed on those data members. An object in POM is no different. Data members of a Page Object are merely elements present on the page such as a button or a label, while member functions are the actions that these elements can perform such as click or getText, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/0*U-AyhQqLOsc78O7y" /></figure><p>Collection of multiple Page Objects makes a single repository for the services or operations offered by the application rather than having these services scattered throughout the tests. This approach isolates the Tests layer from Page Object, so any change in the UI requires updating the relevant Page Object class only.</p><p>KeepTruckin is growing significantly, and to support our customers’ needs, the KeepTruckin web application is also getting enriched with many salient features. This increases the need to expand automation test coverage at a fast pace. Initially, we started writing our automation tests using POM, but eventually, we were forced to think for some innovation because of the following problems with typical POM pattern:</p><h3>Problems with POMS:</h3><h3>1: Test scalability:</h3><p>Generally, a test consists of expected user actions, TestData, and assertions. In the traditional POM model, supplying Data to Page Object’s methods, executing flows, and verifying expectations are all included in the spec files — making the spec files extremely thick. Any change or addition will cost significant time and effort.</p><h3>2: Code redundancy:</h3><p>There are cases when some specific set of steps are repeatedly executed. Adding those tests to the Page Object file means polluting the OOP architecture. But if these steps are added to a spec file, then we need to add the same steps in multiple scenarios. This will result in code redundancy which contradicts the claimed OOP’s basic advantages.</p><h3>3: Difficult to maintain:</h3><p>There can be a condition when some flows are stretched across the components. In traditional POMs, an automation engineer will have to add another Page Object file to access their methods. Consequently, as the app grows, too many components in a single file may result in significant code maintenance.</p><h3>Solve all the problems by introducing an intermediate layer, i.e. Controllers:</h3><p>After dealing with all the above-mentioned issues and immense brainstorming, the Page Object Model with Controller solution was conceived. Adding a controller layer simplifies the roles and responsibilities of specs and Page Object. To follow this pattern, Page Objects are designed purely on the bases of OOP’s basic principle i.e. abstraction and encapsulation. UI elements in the Page Objects are private and can be accessed only through Get/Set methods defined for them. Whereas a spec file just triggers the flow which needs to be verified. Finally, the Controller layer consists of all methods or flows which input the test data to Page Objects and are responsible for asserting the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*B_8ku5i52B1h15Si" /></figure><p>Below is a detailed explanation of how the above-mentioned issues are addressed by the controller:</p><h3>1: Tests are scalable:</h3><p>Introducing controllers specs files are clean and precise. Similarly, Page Objects are responsible for UI elements interaction only. Controllers will perform the interactions required by Specs with POMs along with any logical operations required. So any addition or update is very easy and convenient. The test writer just needs to update the appropriate layers only.</p><h3>2: Reduce Code Redundancy:</h3><p>If a set of steps is required to verify a particular scenario multiple times in a spec, then simply include the required controller to the calling spec/controller file and execute the flow as many times as you want. That particular part of code is written only once in any controller and eliminates the repetitive code.</p><h3>3: Easy to Maintain:</h3><p>When a QA engineer wants to verify a scenario across multiple UI components, then controllers can play a vital role in maintaining the codebase. Simply include a particular controller to any other controller or spec file, and verify the relevant functionality. As every controller is responsible for its scoped functionality, maintaining the codebase does not become hectic or time taking.</p><h3>To sum up…</h3><p>In the end, we can summarize that adding a controller layer is just like “<strong>Divide and conquer.</strong>” Test scripts are divided into three layers: specs, controller, and Page Objects. Page Objects are only responsible for UI elements interaction. Controllers manage all the interactions between specs and Page Objects by defining flows and verifying assertions. Specs files are light and easy to understand and simply call the required user flow from the controller. With the introduction of this architecture, we also observed that any new SDET or even manual QA resource can simply understand the architecture and make modifications if required.</p><p><strong>From our author…</strong></p><p>I would like to thank my mentor <strong>Ali Asim</strong> and my teammate <strong>Rabia Altaf</strong> for all their help and guidance to write and implement this idea. This turned out to be an excellent design pattern for test automation scripts!</p><p>I feel fortunate to be a part of KeepTruckin, where everyone is welcome to talk about what’s on their mind and get full support to implement. Leaders train, develop, and promote employees from within and maintain the best talent. It is one of the secrets to KeepTruckin’s fast-paced progress. This company is producing incredible tech leaders for the industry and I am glad to be a part of the team.</p><p>We’re excited to be a part of the Medium community! We plan to post many new stories, so be sure to follow our <a href="https://medium.com/keeptruckin-eng">publication</a>. Want to join the growing team at KeepTruckin? We’re <a href="https://keeptruckin.com/careers">hiring</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8115657908b9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/motive-eng/simplifying-ui-test-automation-with-page-object-model-and-controllers-8115657908b9">Simplifying UI Test-Automation with Page Object Model and Controllers</a> was originally published in <a href="https://medium.com/motive-eng">motive-eng</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Test Automation and Postman]]></title>
            <link>https://medium.com/motive-eng/api-test-automation-and-postman-3afd31f84d70?source=rss-30e8c32046bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/3afd31f84d70</guid>
            <category><![CDATA[api-test-automation]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Saira Mughal]]></dc:creator>
            <pubDate>Tue, 17 Dec 2019 17:01:01 GMT</pubDate>
            <atom:updated>2019-12-17T17:01:01.224Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://keeptruckin.com/">KeepTruckin</a> is on a mission to connect the world’s trucks with our electronic logging devices (ELD) and fleet management platform. Among the fastest-growing SaaS companies to date, in only 12 months KeepTruckin has grown from $1M to over $50M in annual recurring revenue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*zKIN1eFYf9E1yygAWkUnCA.jpeg" /></figure><p>KeepTruckin products are ever-evolving, and continually enriched with salient features. Quality assurance is an increasingly crucial step in the process that delivers products at our high standards. Our QA team is constantly devising and revising the best policies, standards, and methodologies for all testing, with assiduous attention to detail.</p><h3>Need for Automated API Testing</h3><p>Every change in our product offering requires verification of all existing features. But because of our rapid growth, testing each unit is extremely resource-consuming in terms of both time and headcount. We have addressed this problem through test automation.</p><p>Automated software testing has been a boon for the QA world, and can be applied to regression testing, load testing, performance testing, and design verification. The QA Automation team at KeepTruckin has scoured external and internal sources for the best tools and practices to maximize its benefits. Our testing automation efforts focus on user interfaces (UIs), application program interfaces (APIs), and end-to-end tests covering embedded code.</p><p>In the past, automated API testing has not been common. A QA engineer would spend hours creating tests for all services and plugging them into the main workflow, only to find unexpected results. They would then learn that the issue lay with the main building block: the APIs.</p><p>To eliminate these time-consuming nuisances, we have effectively automated our API testing. Our automation testing focuses on our APIs’ adherence to the expectations we set in terms of their functionality, reliability, performance, and application security. Read on to share in the learnings we have applied after intense research and experimentation with the tools and techniques for API testing.</p><h3><strong>API Testing Targets</strong></h3><p>API testing is included in our regression and load tests and is categorized as black-box testing. We’re looking to identify the following types of bugs in our product:</p><ul><li>Duplicate or missing functionality</li><li>Unused flags</li><li>Fails to handle error conditions gracefully</li><li>Reliability issues (difficulty in connecting and getting a response from API)</li><li>Security issues (does API testing protect data exchanges?)</li><li>Multi-threading issues</li><li>Performance issues (API response time)</li><li>Improper errors/warning to a caller</li><li>Incorrect handling of valid argument values</li><li>Incorrectly structured response data (JSON or XML)</li><li>Validation of response data values</li></ul><h3>The Building Blocks of API Tests</h3><h4><strong>1. Designing test cases</strong></h4><p>Designing test cases is a fundamental step in automation testing. Time invested in the test design phase can reduce test execution time and help to discover quality bugs.</p><blockquote>“A pinch of probability is worth a pound of perhaps.” — James Thurber</blockquote><p>Things to keep in mind when designing test cases so that you miss nothing:</p><ul><li>Test for the typical or expected results first.</li><li>Add stress to the system through a series of API load tests. See how the API handles unforeseen problems and loads by throwing as much as you can at it.</li><li>Test for failure. Make sure you understand how your API will fail. Just make sure the API fails consistently and gracefully.</li><li>Limit the tests from as many variables as possible by keeping them as isolated as possible.</li><li>Perform well-planned call sequencing.</li><li>For complete test coverage, create test cases for <em>all</em> possible API input combinations.</li></ul><h4><strong>2. Writing tests</strong></h4><p>We write our API tests in a modular approach. Each test is responsible for a request and contributes to the testing of an endpoint. Typically a test consists of the following parts:</p><ul><li><strong>Pre-requisite scripts: <br></strong>Before we execute a test, we lay the initial groundwork that creates the testing environment for a particular request. Two examples of prerequisites are: user authorization, or encrypting parameters to pass. We use <a href="https://www.getpostman.com/">Postman</a>’s pre-request script option to define the variables or functions required for our testing environment. Here’s an example of how we create a request URL using variables defined in our pre-request script:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UAFlxtsCwEqRFlaidHQo3A.png" /><figcaption>A request URL created using variables defined in our pre-request script</figcaption></figure><ul><li><strong>Response validation:</strong><br>After test execution, the heart of API testing is analyzing the response. We use scripts to ensure that response objects contain accurate status codes and data validation. For micro-level testing, we use <a href="https://learning.getpostman.com/docs/postman/scripts/test-examples/#assertion-library-examples">assertions</a> to validate every record and field within a response object. Below is an example of how we validate the response to a request:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8-vdxuTQgVADWg51hNT7SA.png" /><figcaption>Validating the response to a request</figcaption></figure><ul><li><strong>Global functions and variables:<br></strong>For exhaustive testing, we make sure to validate each corner case of an API. This can require using common data across objects, or verifying the same validation in multiple response objects. To avoid code redundancy in these cases, we use global objects to define global variables and functions. The scope of these global objects is set at the ‘collection’ level in Postman (see<em> “3. Grouping tests in collections” </em>below to learn more about this feature). In the screenshot shown below, we created a library of global functions. These functions are called from multiple requests to validate the same type of response:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K-W7ltKQX13NDsQWQrjCMA.png" /><figcaption>Defining a global function `ValidateResponse`</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fe5bm1yYwFkzgxeAGhls5A.png" /><figcaption>Using `ValidateResponse` function in tests</figcaption></figure><h4><strong>3. Grouping tests in collections</strong></h4><p><a href="https://learning.getpostman.com/docs/postman/collections/creating-collections/">Postman ‘collections’</a> allow you to group related requests in a folder. These clustered collections reduce the time spent searching and maintaining test scripts. Another of their great advantages is that you can execute multiple tests as a single unit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5iFJbSw4VraQXn49WwKmEQ.png" /><figcaption>Grouping tests in collections</figcaption></figure><h4><strong>4. Environments</strong></h4><p>The <a href="https://learning.getpostman.com/docs/postman/collection-runs/using-environments-in-collection-runs/">Postman ‘environment’</a> variable is a great option for testing the same request at different stages (say, preview, staging, and production). An ‘environment’ is a group of variables defined in the form of key-value pairs.</p><h4><strong>5. Sharing tests and version control</strong></h4><p>Collections and environments can be imported from and exported to JSON files. We push these JSON files on our official GitHub repository so that global teams can access and run these tests. We make these tests part of our continuous integration to avoid any defects or bugs during the development phase. It also helps that we maintain the version history of our testing scripts.</p><h4><strong>6. Running tests</strong></h4><p>As we discussed above, API tests are grouped in a collection, and environments are defined for every stage. These efforts save us a lot of time when we need to execute our tests for regression testing. A tester need only <a href="https://learning.getpostman.com/docs/postman-for-publishers/run-in-postman/environments-run-button/">select an environment and click ‘run’ </a>, without needing to specify every detail every time. After test execution, Postman displays a report of passed and failed tests.</p><p>One more simple option is to run tests using <a href="https://learning.getpostman.com/docs/postman/collection-runs/command-line-integration-with-newman/">Postman’s Newman</a> command-line tool. Anyone can use the JSON files we’ve made available in the KeepTruckin official repository, and run API tests with Newman.</p><h4><strong>7. Test reports</strong></h4><p>When using assertions, we found it crucial to add meaningful messages. This way, the reports generated by the collection runner contain meaningful result statements. Here is an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gX_Qa4VZxnGpai15VekGdg.png" /><figcaption>Collection runner results</figcaption></figure><h4><strong>8. Load testing</strong></h4><p>Many users are on their KeepTruckin concurrently, so load and performance testing is essential. After verifying API calls using Postman, we use <a href="https://jmeter.apache.org/">Jmeter</a> to validate required response time and results. JMeter examines how the system behaves during normal and high loads, and determines whether applications can handle high loads given a high volume of end users.</p><p>API testing allows us to execute requests that may not be possible to execute in the UI, tests instrumental for exposing potential bugs.</p><h3>Our QA Journey</h3><p>This post is only a high-level summary showcasing a small stretch of our KeepTruckin Quality Assurance journey. It is not the end. Check back often, and we will soon share our optimized testing techniques.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3afd31f84d70" width="1" height="1" alt=""><hr><p><a href="https://medium.com/motive-eng/api-test-automation-and-postman-3afd31f84d70">API Test Automation and Postman</a> was originally published in <a href="https://medium.com/motive-eng">motive-eng</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>