<?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 Muralidharan Rajendran on Medium]]></title>
        <description><![CDATA[Stories by Muralidharan Rajendran on Medium]]></description>
        <link>https://medium.com/@muralidharan92?source=rss-6d2b17f595d0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Muralidharan Rajendran on Medium</title>
            <link>https://medium.com/@muralidharan92?source=rss-6d2b17f595d0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:08:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@muralidharan92/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[Overcoming Test Automation Framework Pitfalls: Understanding Failures for Success]]></title>
            <link>https://muralidharan92.medium.com/overcoming-test-automation-framework-pitfalls-understanding-failures-for-success-7e1ae312b584?source=rss-6d2b17f595d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e1ae312b584</guid>
            <dc:creator><![CDATA[Muralidharan Rajendran]]></dc:creator>
            <pubDate>Tue, 13 Feb 2024 05:26:11 GMT</pubDate>
            <atom:updated>2024-02-13T05:26:11.077Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*D7K9B5FCyu8rJv8YUf-AmA.jpeg" /></figure><h3>Introduction:</h3><p>Test automation has become an integral part of the software development lifecycle, offering the promise of faster and more reliable testing processes. However, despite their potential benefits, many test automation frameworks encounter challenges that lead to failure. In this blog, we’ll explore common reasons behind the failures of test automation frameworks and provide insights into overcoming these challenges.</p><blockquote><strong>“Automation does not solve quality problems; it only makes them more repeatable.” </strong>— <strong>Jason Huggins</strong></blockquote><h3>Lack of clear objectives and planning:</h3><p>One of the primary reasons for test automation framework failure is the absence of clear objectives and comprehensive planning. Before diving into automation, it is crucial to define the goals, scope and expected outcomes of the automated testing process. A well-defined strategy ensures that automation efforts align with the overall testing objectives.</p><blockquote><strong>“Give me six hours to chop down a tree and I will spend the first four sharpening the axe.”</strong> — <strong>Abraham Lincoln</strong></blockquote><p><strong>Solution:</strong> Start by creating a detailed automation strategy that outlines the scope of automation, identifies suitable test cases and establishes a roadmap for implementation. Regularly revisit and update the strategy to accommodate changes in the application and testing requirements.</p><h3>Inadequate test case selection:</h3><p>Selecting the wrong test cases for automation is a common pitfall. Not all test cases are suitable for automation and attempting to automate everything can lead to inefficiencies and increased maintenance overhead. Choosing test cases that are unstable or subject to frequent changes can also contribute to framework failures.</p><blockquote><strong>“Quality is more important than quantity. One home run is much better than two doubles.”</strong> — <strong>Steve Jobs</strong></blockquote><p><strong>Solution:</strong> Prioritize test cases based on their relevance, stability and repeatability. Begin with high-priority and frequently executed test cases to realise quick returns on your automation investment. Regularly reassess and update the selection as the application evolves.</p><h3>Poorly designed test scripts:</h3><p>Test automation scripts play a critical role in the success of a framework. Poorly designed scripts can result in maintenance nightmares, reduced script reusability and increased execution times. Common issues include hard-coded values, a lack of modularity and inadequate error handling.</p><blockquote><strong>“The bitterness of poor quality remains long after the sweetness of low price is forgotten.” </strong>— <strong>Benjamin Franklin</strong></blockquote><p><strong>Solution:</strong> Follow best practices for scripting, including modular design, parameterization and the use of descriptive identifiers. Implement robust error-handling mechanisms to enhance script stability. Regularly review and refactor scripts to maintain readability and ease of maintenance.</p><h3>Ineffective test data management:</h3><p>Test data is a crucial component of any testing process and inadequate management can lead to unreliable test results and increased testing time. Dynamically generated or hard-coded test data may result in false positives or negatives, hindering the effectiveness of the automation framework.</p><blockquote><strong>“Without data, you’re just another person with an opinion.” — W. Edwards Deming</strong></blockquote><p><strong>Solution:</strong> Implement a robust test data management strategy that includes the creation, maintenance and cleanup of test data. Use data-driven testing approaches and consider using external data sources or data generation tools to ensure a diverse and realistic dataset.</p><h3>Neglecting regular maintenance:</h3><p>Automation frameworks are not a one-time setup; they require ongoing maintenance to adapt to changes in the application, environment and testing requirements. Neglecting maintenance can result in outdated scripts, broken tests and decreased overall efficiency.</p><blockquote><strong>“The only thing that is constant is change.” — Heraclitus</strong></blockquote><p><strong>Solution:</strong> Establish a regular maintenance schedule to review and update test scripts, address changes in the application and adapt to evolving testing needs. Incorporate version control systems to track changes and facilitate collaboration among team members.</p><h3>Ignoring cross-browser and cross-platform testing:</h3><p>In today’s diverse technology landscape, applications must function seamlessly across various browsers and platforms. Ignoring cross-browser and cross-platform testing can lead to overlooked issues and reduced test coverage.</p><blockquote><strong>“The bitterness of poor quality remains long after the sweetness of low price is forgotten.” — Benjamin Franklin</strong></blockquote><p><strong>Solution:</strong> Integrate cross-browser and cross-platform testing into the automation framework. Leverage tools and frameworks that support parallel test execution across different browsers and platforms to ensure comprehensive test coverage.</p><h3>Conclusion:</h3><p>Test automation frameworks can significantly improve the efficiency and effectiveness of the testing process when implemented correctly. By addressing common pitfalls such as lack of planning, inappropriate test case selection, poorly designed scripts, ineffective test data management, neglecting maintenance and ignoring cross-browser/platform testing, teams can build robust and sustainable automation frameworks. Continuous evaluation, adaptation and collaboration are key to overcoming challenges and realising the full potential of test automation in the software development lifecycle.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e1ae312b584" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 Best Practices for Writing Maintainable Automated Tests]]></title>
            <link>https://muralidharan92.medium.com/10-best-practices-for-writing-maintainable-automated-tests-4e528fdda561?source=rss-6d2b17f595d0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e528fdda561</guid>
            <dc:creator><![CDATA[Muralidharan Rajendran]]></dc:creator>
            <pubDate>Fri, 24 Mar 2023 05:39:25 GMT</pubDate>
            <atom:updated>2023-03-24T06:38:12.972Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Knowledge is a treasure but practice is the key! Traditionally, what separates an average company from a great company is ‘technology’ and ‘talent’. Technical skill is the ability to perform certain specialized tasks within a specific domain and automation testing is no different.</strong></p><p>Automated testing is an essential step in the software creation process. They can detect bugs before they reach production and ensure that the application works as intended. Writing automated tests, however, can be a difficult job, particularly when it comes to maintaining them over time. In this blog, we will examine, using the pytest-playwright framework, a Python tool that offers a straightforward API for automating web browsers with Playwright. We will examine 10 best practices for creating maintainable automated tests in this article.</p><ol><li><strong>Use Descriptive Test Names:</strong></li></ol><p>When writing automated tests, use clear, detailed test names that make it clear what the test is proving. This makes it easier to identify and fix any possible issues. Instead of just “test1,” give a test a more specific moniker like “test_login_with_valid_credentials”.</p><pre>def test_login_with_valid_credentials():<br>    # Test code here</pre><p><strong>2. Keep Tests Small:</strong></p><p>It’s important to keep automated tests small and focused on a specific feature or functionality. This makes it easier to identify the root cause of any failures and makes the tests easier to maintain. If a test becomes too large or complex, consider breaking it down into smaller, more manageable tests. However, some scenarios may be too complex to fit into a single test script. In these cases, it’s best to break up the test script into smaller, more manageable parts.</p><p>So, when should you break up a test script? Here are a few guidelines:</p><ul><li>If a test script has multiple preconditions or steps, consider breaking it up into smaller, more focused tests.</li><li>If a test script is testing multiple scenarios or functionalities, consider breaking it up into smaller, more specific tests.</li><li>If a test script takes a long time to run, consider breaking it up into smaller tests to improve test execution time.</li></ul><p>By breaking up complex test scripts into smaller, more focused tests, you can improve test maintainability and reduce the risk of test failures. Additionally, breaking up test scripts can make it easier to debug failures and identify the root cause of issues in your code.</p><pre>def test_login_with_valid_credentials():<br>    # Test code here<br>    <br>def test_login_with_invalid_credentials():<br>    # Test code here</pre><p><strong>3.</strong> <strong>Use Page Objects:</strong></p><p>A design pattern for creating more maintainable automated tests is page objects. They enable you to contain the logic for dealing with a particular page or program component in a different class. By utilizing page objects, you can minimize the amount of redundant code and create more flexible, easier-to-maintain tests.</p><pre>class LoginPage:<br>    def __init__(self, browser):<br>        self.page = browser.new_page()<br><br>    def login(self, username, password):<br>        self.page.goto(&quot;https://example.com/login&quot;)<br>        self.page.fill(&quot;#username&quot;, username)<br>        self.page.fill(&quot;#password&quot;, password)<br>        self.page.click(&quot;#submit&quot;)<br><br>        return self.page.title()<br><br>def test_login_with_valid_credentials():<br>    login_page = LoginPage(browser)</pre><p><strong>4.</strong> <strong>Use Fixtures:</strong></p><p>Fixtures are a useful tool in PyTest that allows you to create reusable setup and teardown code for tests. By using fixtures, you can avoid replicating code across tests and make your tests simpler to maintain. For example, you can create a fixture to launch the browser session before each test.</p><pre>@pytest.fixture(scope=&quot;module&quot;)<br>def browser():<br>    with sync_playwright() as playwright:<br>        browser = playwright.chromium.launch()<br>        yield browser<br>        browser.close()</pre><p>In Pytest, <strong>setup()</strong> and <strong>teardown()</strong> functions are fixtures that are used to set up and tear down test resources. Fixtures are functions that are called by Pytest to provide test objects to test functions.</p><p>The <strong>setup()</strong> function is called before each test function is run and is used to set up any test resources that the test function needs. For example, if your test function needs to interact with a database, you might use the <strong>setup()</strong> function to connect to the database and initialize any necessary data.</p><p>The <strong>teardown()</strong> function is called after each test function is run and is used to tear down any test resources that were set up in the <strong>setup()</strong> function. For example, if your <strong>setup()</strong> function created temporary files or modified the database, the teardown() function can be used to clean up those resources.</p><p>Here’s an example of how you might use <strong>setup()</strong> and <strong>teardown()</strong> functions to set up and tear down a test resource:</p><pre>import pytest<br><br>@pytest.fixture<br>def my_resource():<br>    # Set up the resource<br>    resource = connect_to_resource()<br>    yield resource<br>    <br>    # Tear down the resource<br>    resource.disconnect()<br><br>def test_my_resource(my_resource):<br>    # Use the resource in the test<br>    result = my_resource.query_database()<br>    assert result == expected_result</pre><p>In this example, the <strong>my_resource</strong> fixture is defined using the <strong>@pytest.fixture</strong> decorator. The fixture function sets up the resource by calling <strong>connect_to_resource()</strong> and yields the resource object to the test function.</p><p>After the test function completes, the fixture’s <strong>teardown()</strong> function is automatically called to tear down the resource by calling <strong>resource.disconnect()</strong>.</p><p><strong>5. Use Parameterized Tests:</strong></p><p>Parameterized tests enable you to perform the same test with various sets of input data. This allows you to try a broad variety of situations with minimal code duplication. For example, you can test login with both valid and invalid login credentials in a single test.</p><pre>@pytest.mark.parametrize(<br>    &quot;username,password,expected_result&quot;,<br>    [<br>        (&quot;validuser&quot;, &quot;validpassword&quot;, &quot;Welcome&quot;),<br>        (&quot;invaliduser&quot;, &quot;invalidpassword&quot;, &quot;Invalid Credentials&quot;),<br>    ],<br>)<br>def test_login(username, password, expected_result):<br>    login(username, password)<br>    assert expected_result in browser.page.title()</pre><p><strong>6.</strong> <strong>Use Assertions:</strong></p><p>Any automated test must contain assertions. They enable you to verify that the application is acting as you would expect it to and that the test has been properly completed or failed. Make your test assertions short and to the point to make them simpler to understand and manage.</p><pre>def test_login_with_valid_credentials():<br>    username = &quot;testuser&quot;<br>    password = &quot;testpassword&quot;<br>    login(username, password)<br>    assert &quot;Welcome&quot; in browser.page.title()</pre><p><strong>7. Use Mocks:</strong></p><p>For evaluating code that relies on external services or dependencies, mocks are an effective tool. You can test your code independently while simulating the behavior of these variables by using mocks. For example, you can use a mock to mimic the behavior of an API endpoint on which your program relies.</p><pre>import requests<br>from unittest import mock<br><br>def test_get_user(mock_get):<br>    mock_get.return_value.json.return_value = {&quot;username&quot;: &quot;testuser&quot;}<br><br>    response = requests.get(&quot;https://example.com/api/user&quot;)<br>    assert response.json()[&quot;username&quot;] == &quot;testuser&quot;<br><br>@mock.patch(&quot;requests.get&quot;)<br>def test_get_user(mock_get):<br>    mock_get.return_value.json.return_value = {&quot;username&quot;: &quot;testuser&quot;}<br><br>    response = requests.get(&quot;https://example.com/api/user&quot;)<br>    assert response.json()[&quot;username&quot;] == &quot;testuser&quot;</pre><p><strong>8. Use Hooks:</strong></p><p>A feature of PyTest called hooks enables you to perform code before or after particular occurrences, like launching a browser instance or conducting a test. Common setup and teardown chores, like clearing the browser memory before each test, can be automated by using hooks.</p><pre>@pytest.fixture(scope=&quot;module&quot;)<br>def browser():<br>    with sync_playwright() as playwright:<br>        browser = playwright.chromium.launch()<br>        yield browser<br>        browser.close()<br><br>@pytest.fixture(autouse=True)<br>def clear_cache(browser):<br>    browser.context.clear_cookies()<br>    browser.context.clear_storage_state()</pre><p><strong>9. Use Code Reviews:</strong></p><p>Code reviews are an essential component of any software development process, particularly when it comes to keeping automated tests. Team members can detect errors, find areas for improvement, and ensure that the tests are maintainable over time by examining each other’s code.</p><p><strong>10. Use Continuous Integration:</strong></p><p>Every time you make a change, Continuous Integration (CI) instantly builds and tests your program. You can make sure that your tests are always current and that any changes to the application do not break established features by using a CI system. This can help to detect problems early in the development process and minimize the time and effort needed to keep the tests up to date.</p><h3><strong>Conclusion:</strong></h3><p><strong>Practice until you can’t get it wrong </strong>😃<strong> </strong>Creating maintainable automated tests is an important component of software development. By following these ten best practices, you can ensure that your tests are simple to comprehend, easy to manage, and provide reliable feedback on the quality of your application.</p><p>Demand remains strong for testing jobs but choosing a place that takes equal care of one’s career path, learning and growth are crucial too. Details matter, and it’s worth waiting to get it right! We at Kissflow believe in finding the right people, fostering their growth, and creating a powerful company culture to achieve success together. <strong>And do you want to join us? Send your resumes to </strong><a href="/service/mailto:murali@kissflow.com"><strong>muralidharan@kissflow.com</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e528fdda561" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>