<?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 Mehrdad Kiani on Medium]]></title>
        <description><![CDATA[Stories by Mehrdad Kiani on Medium]]></description>
        <link>https://medium.com/@mehrdad.kian71?source=rss-142a8c359f4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*WpOLxcj22MvHrExJ.jpg</url>
            <title>Stories by Mehrdad Kiani on Medium</title>
            <link>https://medium.com/@mehrdad.kian71?source=rss-142a8c359f4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 18 May 2026 06:36:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mehrdad.kian71/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[Software Testing]]></title>
            <link>https://medium.com/@mehrdad.kian71/software-testing-9108b197a20c?source=rss-142a8c359f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/9108b197a20c</guid>
            <dc:creator><![CDATA[Mehrdad Kiani]]></dc:creator>
            <pubDate>Sat, 27 Sep 2025 09:58:24 GMT</pubDate>
            <atom:updated>2025-09-27T09:58:24.750Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*UZNUOg8JscQfe_g0Eigt8w.gif" /></figure><h3>1. Introduction to Software Testing</h3><h3>What is Software Testing?</h3><p>Software Testing is a method to assess the functionality of the software program. The process checks whether the actual software matches the expected requirements and ensures the software is bug-free. The purpose of software testing is to identify the errors, faults, or missing requirements in contrast to actual requirements. It mainly aims at measuring the specification, functionality, and performance of a software program or application.</p><p>Software testing can be divided into two steps:</p><ul><li><strong>Verification:</strong> It refers to the set of tasks that ensure that the software correctly implements a specific function. It means “Are we building the product right?”.</li><li><strong>Validation:</strong> It refers to a different set of tasks that ensure that the software that has been built is traceable to customer requirements. It means “Are we building the right product?”.</li></ul><h3>Need for Software Testing</h3><p>Software bugs can cause potential monetary and human loss. There are many examples in history that clearly depicts that without the testing phase in software development lot of damage was incurred. Below are some examples:</p><ul><li><strong>1994:</strong> China Airlines Airbus A300 crashed due to a software bug killing 264 people.</li><li><strong>1996:</strong> A software bug caused U.S. bank accounts of 823 customers to be credited with 920 million US dollars.</li><li><strong>2015:</strong> A software bug in fighter plan F-35 resulted in making it unable to detect targets correctly.</li></ul><h3>Why is Software Testing Important?</h3><p>Software testing is crucial for several reasons:</p><ul><li><strong>Quality Assurance:</strong> Ensures the software meets the required quality standards.</li><li><strong>Bug Detection:</strong> Identifies and fixes bugs before the software is released.</li><li><strong>User Satisfaction:</strong> Ensures a smooth and error-free user experience.</li><li><strong>Saves time and money:</strong> After the application is launched it will be very difficult to trace and resolve the issues, as performing this activity will incur more costs and time. Thus, it is better to conduct software testing at regular intervals during software development.</li></ul><h3>Types of Software Testing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*bakagAwczLSFVlRPbpJgjw.png" /></figure><p>There are several types of software testing, including:</p><ul><li><strong>Manual testing:</strong> It includes testing software manually, i.e., without using any automation tool or script. In this type, the tester takes over the role of an end-user and tests the software to identify any unexpected behavior or bug. There are different stages for manual testing such as unit testing, integration testing, system testing, and user acceptance testing. Testers use test plans, test cases, or test scenarios to test software to ensure the completeness of testing. Manual testing also includes exploratory testing, as testers explore the software to identify errors in it.</li><li><strong>Automation testing:</strong> It is also known as Test Automation, is when the tester writes scripts and uses another software to test the product. This process involves the automation of a manual process. Automation Testing is used to re-run the test scenarios quickly and repeatedly, that were performed manually in manual testing. Various types of functional testing are Unit testing, Integration testing, System testing, Smoke testing, and so on.</li></ul><h3>Several types of software automation testing</h3><ul><li><strong>Unit Testing:</strong> Unit testing involves testing individual components or units of code in isolation. It is typically done by developers and focuses on ensuring that each unit of code works as expected.</li><li><strong>Integration Testing:</strong> Integration testing involves testing the interaction between different units or components of the software. It ensures that the integrated components work together as expected.</li><li><strong>End-to-End (E2E) Testing:</strong> End-to-End testing involves testing the entire application flow from start to finish. It simulates real user scenarios and ensures that the application works as expected in a real-world environment.</li></ul><h3>The Importance of Writing Tests as a Developer</h3><p>As a developer, writing tests is essential for:</p><ul><li><strong>Code Reliability:</strong> Ensures that your code works as expected.</li><li><strong>Refactoring Confidence:</strong> Allows you to refactor code with confidence, knowing that tests will catch any regressions.</li><li><strong>Documentation:</strong> Tests serve as documentation for how the code is supposed to work.</li><li><strong>Collaboration:</strong> Helps other developers understand the expected behavior of the code.</li></ul><h3>2. Comparing Software with and without Tests</h3><h3>Benefits of Tested Software</h3><ul><li><strong>Higher Quality:</strong> Tested software is more likely to be free of bugs and errors.</li><li><strong>Better Maintainability:</strong> Tests make it easier to maintain and update the software.</li><li><strong>Faster Development:</strong> Automated tests can speed up the development process by catching issues early.</li><li><strong>security:</strong> Security testing is a type of software testing that is focused on testing the application for security vulnerabilities from internal or external sources.</li></ul><h3>Risks of Untested Software</h3><ul><li><strong>Increased Bugs:</strong> Untested software is more likely to have undetected bugs.</li><li><strong>Higher Costs:</strong> Fixing bugs after release is more expensive than catching them early.</li><li><strong>Poor User Experience:</strong> Untested software can lead to a poor user experience, resulting in lost customers.</li></ul><h3>3. Deep Dive into End-to-End (E2E) Testing</h3><h4>1. What is being tested?</h4><p>End-to-End (E2E) testing focuses on testing the <strong>entire application flow</strong> from start to finish. It ensures that all integrated components of the application work together as expected in real-world scenarios. This includes:</p><ul><li>User interfaces (UI)</li><li>APIs and backend services</li><li>Databases and external integrations</li><li>Business logic and workflows</li></ul><p>For example, in an e-commerce application, E2E testing would simulate a user browsing products, adding items to the cart, proceeding to checkout, and completing the purchase.</p><h4>2. Who will perform the testing?</h4><p>E2E testing is typically performed by:</p><ul><li><strong>QA Engineers:</strong> Responsible for designing and executing test cases.</li><li><strong>Developers:</strong> Write automated E2E tests as part of the development process.</li><li><strong>End Users:</strong> In some cases, real users participate in beta testing to provide feedback (e.g Canary test).</li><li><strong>DevOps Engineers:</strong> Ensure E2E tests are integrated into CI/CD pipelines for automated execution.</li></ul><h4>3. Where will the testing be conducted?</h4><p>E2E testing is conducted in environments that closely mimic the production environment, such as:</p><ul><li><strong>Staging Environment:</strong> A replica of the production environment where tests are run before deployment.</li><li><strong>Production Environment:</strong> In some cases, tests are run in production to validate real-world behavior</li><li><strong>Local Development Environment:</strong> For initial testing during development, though this is less common for full E2E testing.</li></ul><h4>4. Why is End-to-End testing necessary?</h4><p>E2E testing is necessary because:</p><ul><li><strong>Real-World Scenarios:</strong> It simulates real user interactions and scenarios.</li><li><strong>Bug Detection:</strong> It helps identify issues that may not be caught by unit or integration tests.</li><li><strong>Ensures Application Integrity:</strong> Verifies that all components work together as expected.</li><li><strong>Improves Confidence:</strong> Provides confidence that the application is ready for release.</li><li><strong>Reduces Production Issues:</strong> Catches critical bugs before they reach end users.</li></ul><h4>6. How is End-to-End testing performed?</h4><p>E2E testing is performed using the following steps:</p><ul><li><strong>Define Test Scenarios:</strong> Identify key user workflows to test (e.g., login, checkout, etc.).</li><li><strong>Set Up the Test Environment:</strong> Configure an environment that mimics production.</li><li><strong>Write Test Cases:</strong> Create manual or automated test scripts for each scenario.</li><li><strong>Execute Tests:</strong> Run the tests manually or using automation tools like Cypress, Selenium, or Playwright.</li><li><strong>Mock External Dependencies:</strong> Use tools to mock APIs, databases, or third-party services if needed.</li><li><strong>Validate Results:</strong> Compare the actual outcomes with expected results.</li><li><strong>Report and Fix Bugs:</strong> Document any issues and work with developers to resolve them.</li><li><strong>Automate Tests:</strong> Integrate E2E tests into CI/CD pipelines for continuous validation.</li></ul><h3>4. Tools for Writing End-to-End Tests</h3><h3>Comparison of E2E Testing Tools</h3><p>Here’s the updated table with only the <strong>Pros</strong> for each tool:</p><h3>End-to-End (E2E) Testing Tools Comparison</h3><p><strong>ToolDescriptionCypress</strong>- Fast and reliable Easy to set up Real-time reloads Automatic waiting<strong>Selenium</strong>- Supports multiple browsers and languages Highly customizable Large community<strong>Puppeteer</strong>- Fast and lightweight Supports headless Chrome/Chromium Great for scraping and automation<strong>TestCafe</strong>- Easy to set up Supports multiple browsers No browser plugins required<strong>Playwright</strong>- Supports multiple browsers Fast and reliable Built-in auto-waiting and retries Supports mobile emulation</p><h3>When to Use Which Tool?</h3><ul><li><strong>Cypress:</strong> If you need a fast, developer-friendly tool for testing in Chromium, Firefox, or Edge.</li><li><strong>Selenium:</strong> If you need cross-browser testing with support for multiple programming languages.</li><li><strong>Puppeteer:</strong> If you’re focused on Chrome/Chromium automation or web scraping.</li><li><strong>TestCafe:</strong> If you want a simple setup with support for multiple browsers.</li><li><strong>Playwright:</strong> If you need cross-browser testing with modern features and reliability.</li></ul><h3>Introduction to Cypress</h3><p>Cypress is a modern, JavaScript-based end-to-end testing framework that is designed to make testing easier and more reliable. It is built on top of Mocha and Chai and provides a rich set of features for writing and running tests.</p><h3>Why Use Cypress?</h3><ul><li><strong>Fast Execution:</strong> Cypress tests run directly in the browser, making them faster than other testing tools.</li><li><strong>Easy Setup:</strong> Cypress is easy to set up and requires minimal configuration.</li><li><strong>Real-Time Reloads:</strong> Cypress provides real-time reloads, allowing you to see the results of your tests as you write them.</li><li><strong>Automatic Waiting:</strong> Cypress automatically waits for elements to appear and actions to complete, reducing the need for manual waits.</li></ul><h3>Deep Dive into Cypress</h3><p>Cypress is built on a unique architecture that allows it to run tests directly in the browser. This architecture provides several advantages, including faster execution, real-time reloads, and automatic waiting. Cypress also provides a rich set of APIs for interacting with the DOM, making it easy to write tests that simulate real user interactions.</p><h3>5. Writing End-to-End Tests with Cypress</h3><h3>Simple E2E Test Example</h3><pre>describe(&quot;My First Test&quot;, () =&gt; {<br>  it(&quot;Visits the page&quot;, () =&gt; {<br>    cy.visit(&quot;https://example.cypress.io&quot;);<br>    cy.contains(&quot;type&quot;).click();<br>    cy.get(&quot;.action-email&quot;)<br>      .type(&quot;fake@email.com&quot;)<br>      .should(&quot;have.value&quot;, &quot;fake@email.com&quot;);<br>  });<br>});</pre><h3>Testing a User Table with Cypress</h3><p>In this example, we’ll write a Cypress test for a page that fetches a list of users from a backend API and displays them in a table. The test will verify that the data is correctly fetched and rendered in the table.</p><h3>Scenario</h3><ul><li>The page has a table to display user data.</li><li>The user data is fetched from a backend API (e.g., GET /api/users).</li><li>The table should display the following columns: ID, Name, Email, and Role.</li></ul><ol><li><strong>Mocking the API Response:</strong></li><li><strong>Visiting the Page:</strong></li><li><strong>Waiting for the API Call:</strong></li><li><strong>Verifying the Table:</strong></li></ol><h3>Advanced Example: Dynamic Data and Pagination</h3><p>If the table supports pagination and dynamically fetches data, you can extend the test to verify pagination behavior.</p><h3>Mocking Paginated Data:</h3><pre>cy.intercept(&quot;GET&quot;, &quot;/api/users?page=1&quot;, {<br>  statusCode: 200,<br>  body: [<br>    { id: 1, name: &quot;John Doe&quot;, email: &quot;john@example.com&quot;, role: &quot;Admin&quot; },<br>    { id: 2, name: &quot;Jane Smith&quot;, email: &quot;jane@example.com&quot;, role: &quot;User&quot; },<br>  ],<br>}).as(&quot;getPage1&quot;);</pre><pre>cy.intercept(&quot;GET&quot;, &quot;/api/users?page=2&quot;, {<br>  statusCode: 200,<br>  body: [<br>    { id: 3, name: &quot;Alice Johnson&quot;, email: &quot;alice@example.com&quot;, role: &quot;User&quot; },<br>    { id: 4, name: &quot;Bob Brown&quot;, email: &quot;bob@example.com&quot;, role: &quot;Admin&quot; },<br>  ],<br>}).as(&quot;getPage2&quot;);</pre><h3>Testing Pagination:</h3><pre>it(&quot;should display paginated user data&quot;, () =&gt; {<br>  // Wait for the first page to load<br>  cy.wait(&quot;@getPage1&quot;);</pre><pre>  // Verify the first page data<br>  cy.get(&quot;#user-table tbody tr&quot;).should(&quot;have.length&quot;, 2);<br>  cy.get(&quot;#user-table tbody tr&quot;)<br>    .eq(0)<br>    .within(() =&gt; {<br>      cy.get(&quot;td&quot;).eq(1).should(&quot;contain&quot;, &quot;John Doe&quot;);<br>    });</pre><pre>  // Click the &quot;Next&quot; button<br>  cy.get(&quot;#next-page-button&quot;).click();</pre><pre>  // Wait for the second page to load<br>  cy.wait(&quot;@getPage2&quot;);</pre><pre>  // Verify the second page data<br>  cy.get(&quot;#user-table tbody tr&quot;).should(&quot;have.length&quot;, 2);<br>  cy.get(&quot;#user-table tbody tr&quot;)<br>    .eq(0)<br>    .within(() =&gt; {<br>      cy.get(&quot;td&quot;).eq(1).should(&quot;contain&quot;, &quot;Alice Johnson&quot;);<br>    });<br>});</pre><h3>Best Practices for Testing Tables with Cypress</h3><p><strong>Use Aliases for API Requests:</strong></p><ul><li>Assign aliases to intercepted requests to make the test more readable and maintainable.</li></ul><p><strong>Verify Table Structure:</strong></p><ul><li>Check that the table headers and rows are correctly rendered.</li></ul><p><strong>Test Edge Cases:</strong></p><ul><li>Test scenarios like empty tables, loading states, and error handling.</li></ul><p><strong>Use </strong><strong>within for Row Verification:</strong></p><ul><li>Use cy.within() to scope assertions to a specific row or cell.</li></ul><p><strong>Mock Realistic Data:</strong></p><ul><li>Use realistic data in your mocks to ensure the test reflects real-world usage.</li></ul><p>This example demonstrates how to test a user table in Cypress, including mocking API responses, verifying table data, and handling pagination. By following these practices, you can ensure that your table components work as expected in your application.</p><h3>For Writing E2E Tests</h3><ul><li><strong>Keep Tests Isolated:</strong> Ensure that each test is independent and does not rely on the state of other tests.</li><li><strong>Use Descriptive Test Names:</strong> Use descriptive names for your tests to make it clear what they are testing.</li><li><strong>Avoid Hardcoding Values:</strong> Avoid hardcoding values in your tests; use variables or configuration files instead.</li><li><strong>Use Page Objects:</strong> Use page objects to encapsulate the logic for interacting with specific pages or components.</li></ul><h3>6. Conclusion</h3><p>Software testing is an essential part of the software development process. It ensures that the software meets the required quality standards, detects bugs early, and provides a smooth user experience. End-to-End testing, in particular, is crucial for testing the entire application flow and ensuring that all integrated components work together seamlessly.</p><p>Cypress is a powerful and modern end-to-end testing tool that makes it easy to write and run tests. Its unique architecture, rich set of features, and ease of use make it an excellent choice for developers looking to improve the quality of their software.</p><p>By following best practices and using tools like Cypress, developers can write reliable and maintainable tests that ensure their software works as expected in real-world scenarios. Whether you’re writing simple tests or complex user flows, Cypress provides the tools and features you need to succeed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9108b197a20c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>