Testowanie automatyczne-poznaj 9 kroków do stworzenia framework'a

9 Steps to Create an Optimal Test Automation Framework   

/ 05.08.2024 Quality Assurance (QA)

If you click the link to read the following article, you know that test automation is no longer a luxury but a requirement in software development. As applications become more complex and larger, repeatable, and reliable testing becomes critical. 

Why can you say that? Virtually everyone has heard about the update published by CrowdStrike on July 19, 2024, which disabled 8.5 million Windows computers. The cause was testing software incorrectly checking content updates sent to millions of computers. Lessons learned from the outage are now being applied to testing new patches in critical software.   

Konstantin Klyagin, founder of software companies Redwerk and QAwerk, said in a press statement:  

“Automated testing ensures that even small changes do not introduce new bugs. This is especially important for major updates such as CrowdStrike, where manual testing alone would not be sufficient.”  

To prevent such a situation, Tom Warren (senior editor and author of Notepad, covering everything Microsoft, PC, and technology for over twenty years) stressed that CrowdStrike promises to improve its Rapid Response Content testing. It will use local developer testing, content update testing, rollback testing, load testing, fuzzing, and fault injection. CrowdStrike will also conduct stability and content interface tests on Rapid Response Content. 

Surprisingly, many companies have yet to implement this approach in their production environment.   

So why is detailed automated software testing so important? In this article, we will focus on designing the best framework for test automation as part of adopting a QA strategy. 

But let’s start by clarifying some basic concepts. 

What is test automation?

Test automation involves configuring test tools, creating tests, collecting results, and comparing them with expected outcomes. It also encompasses designing the architecture and selecting the appropriate framework.

Automated tests can be executed at any time of day on various hardware or software platforms and in different environments, consistently producing the same results. The primary goal is to free manual testers from repetitive tasks and to ensure that critical areas of the application are checked in real-time.

Automated testing tools can:

  • Prepare data sets
  • Compare expected results with actual outcomes during testing
  • Record and store test results for future reference

Automated tests can be applied throughout the entire software development lifecycle (SDLC), from unit tests to integration tests, system tests, and acceptance tests.

The illustration below shows the “Test Pyramid,” an essential software engineering concept. It helps create an automated test structure that ensures effective and efficient software testing. The pyramid highlights the types of tests, their importance, and the balance between them.

Test automation_test pyramid

Unit tests form the base of the pyramid. They test individual components or functions in isolation, typically focusing on the smallest parts of the code, such as functions or methods. These tests are quick to execute, easy to write and maintain, and help catch bugs early in the development process.

Integration tests focus on interactions between different components or systems. Compared to unit tests, integration tests are fewer in number, more complex, and may involve external dependencies like databases or third-party services..

End-to-end Tests (E2E) located at the top of the pyramid, simulate real-world user scenarios and test the application as a whole. These tests verify that the entire system, including the user interface, backend, and databases, works as expected by the user. They are the most complex and have the longest execution time.

9 steps to create a robust test automation environment

Designing a test automation environment involves several steps, from defining the scope and selecting tools to implementing and maintaining the system. Below, we discuss the critical steps involved.

1. Define the scope and objectives.

Defining objectives: The first step in designing test automation is to decide which tests to automate. Criteria should be set to define these (e.g., faster feedback, better test coverage) depending on the organization’s requirements.

It is also necessary to note that we do not always automate tests. This is affected by many factors, such as budget, time, or environment.

Automated testing should be integrated into a comprehensive product testing strategy. This unified approach streamlines QA activities, ensuring consistency and efficiency in the development process. An automated testing strategy defines key areas such as purpose, test levels, test types, tools, scope, and the test environment.

2. Choose the right tools.

Evaluate your options: Consider factors such as project requirements, team experience, and technology stack. Determining the scope of testing also includes deciding on the test environments, platforms, and devices that will be used for automation.

Choice of frameworks: Choose the appropriate tools for each type of testing (e.g., Selenium for UI testing, Appium for mobile). The frameworks should be primarily:

  • Compatible with the technology stack
  • Easy to use and supportive of various test types
  • Considerate of community support and documentation

Here are some of the popular frameworks for test automation in various categories:

Test automation tools
Test automation tools

3. Design the architecture of the framework.

The architecture includes configuring test environments, integrating with CI/CD, and selecting test automation tools. A well-designed architecture ensures the scalability, maintainability, and performance of automated tests.

Modular design: Organize tests and components in a modular fashion to enhance reusability and maintainability.

Layers of abstraction: Implement different layers to streamline the testing process:

  • Test layer: This is where the actual test cases are located.
  • Business logic layer: Contains methods that perform actions on the application.
  • Page Object Model (POM): Represents web pages as objects, improving test structure and readability.

4. Configure the environment.

The test environment should mimic the production environment. It includes hardware, software, network, and data configurations.

  • A version control system (such as Git) is used to manage the code base.
  • Integrate with CI/CD tools (e.g., Jenkins, GitLab CI) for continuous testing.
  • Implement a test data management strategy using databases or data files.

5. Implement the test framework.

  • Create a project structure that can be transferred between projects and is convenient to use
  • Implement utility classes for common activities such as logging, configuration handling, etc.
  • Develop the basic components, such as:

– Configure configuration files for environment-specific settings.  

 -Implement initialization and removal of drivers (for Selenium/Appium).  

 – Create a base class that other test classes can extend. 

6. Create and organize test cases.

  • Write test scripts based on identified test scenarios.
  • Use POM (Page Object Model) to extract web page details from test scripts.
  • Test against multiple data sets

7. Implement reporting and logging.

  • Integrate reporting tools (e.g., Allure, Extent Reports) to generate detailed test reports.
  • Implement logging mechanisms to obtain detailed information about test runs (e.g., Log4j).

8. Perform testing and validation.

  • Run tests locally to make sure they work as expected.
  • Configure tests to run automatically as part of continuous CI/CD integration.
  • Identify and fix any problems and optimize tests for stability and performance.

9. Maintain a testing framework.

  • Update the framework and dependencies regularly.
  • Perform periodic code refactoring to maintain quality.
  • Constantly add new test cases to improve test coverage.

Benefits of using a test automation framework  

The benefits of test automation include: 

  • Saving time 

Automated tests can execute complex scenarios anytime and cover functionality that may be missed during manual testing. 

  • Improved team performance and productivity 

By automating repetitive testing tasks, developers and testers can focus on more strategic activities, such as designing new features, optimizing code, and improving user experience.  

 Moreover, automation also reduces human error and ensures consistent and reliable test results. 

  • Cost savings 

Automated testing saves costs in the long run. By catching bugs early in the development cycle, you’ll avoid rework and potential loss of revenue due to software failures.  

In addition, by running tests without manual intervention, you will get products to market faster, which helps companies be competitive in a rapidly changing digital world. 

  • Test scaling  

With test automation, teams can replicate test scenarios in different environments and configurations and get a consistent assessment of software functionality.  

This is useful for projects with complex architectures or frequent updates, allowing teams to maintain high testing standards. 

When is it a good idea to create a custom framework for automated testing?  

Testers often use testing tools, such as Selenium, Playwright, on which they write tests and use them directly to create automated test scenarios.  

At first, the incremental growth of automated tests is great, but there is a serious problem behind it. When using these tools directly, our tests will become obsolete very quickly in incremental software development.  Fixing these issues can consume a considerable amount of time for automation testers and may sometimes lead to tests being disabled and not reinstated. This, in turn, can negatively impact the test coverage of new functionality. 

Creating a framework architecture for automated testing that meets the needs of organizations and projects is often a significant challenge. This is often overlooked, leading to the creation of several frameworks or different implementations of basic functionality, which generates costs and the need for their maintenance, which requires the involvement of many people.  

  What can be done to create an automated testing framework? 

  1. Standardize the process of test development as well as the preparation of common vendors and test bases to develop tests and build reusable ones better. 
  1. Separate out portions of code that are common to multiple projects and version them to allow new projects to get off to a fast start in terms of automation. 

The automation framework is so convenient that this test base collects everything we need to run a single test. Browser initializes all those services, pages, and so on to start the test scenario immediately.

How we helped a corporate client improve its testing process? 

Let’s now move from theory to practice. In this case study, we will show how we helped one of our clients in the financial industry gradually implement a QA automation framework. 

  1. Review of the internal testing process and proposed improvements 

We conducted a workshop to examine the current state of the client’s quality management (QA) process and built a testing strategy that outlined the basic assumptions about testing.  

To check quality, we had to provide the relevant metrics, among others:  

  • We created custom data visualizations to show a clearer picture of the current state of the product,  
  • We have also offered the ability to track the implementation of requirements throughout the SDLC cycle, 
  • We have combined requirements management tools with test frameworks to make all quality information available in one place.  
  1. Preparation of PoC for the implementation of a functional automation framework using Java 

Based on this, we prepared a test plan and a model of how the tests will be carried out in each project, such as: 

  • What falls within their scope?  
  • What are the responsibilities of each role in the project? 
  • What are the QA risks, such as whether developers test their code or tools?     
  1. Defining the QA Handbook 

Working with the client, we developed a comprehensive and professional QA process documented in the QA Handbook, which provided a comprehensive guide for software testing professionals and project teams. 

 It introduced best practices, approaches, and techniques for testing various types of software, including web and desktop applications. 

  1. Implementation of the strategy   

Once the QA documentation was prepared, the next step was to implement the policy and plan. This included analyzing and validating requirements creating and executing test scenarios and test reports. 

Summary  

Choosing the right automation framework is crucial to the success of any project. It is important to consider various factors and choose a tool that meets its needs. 

In summary, the key elements in building a test framework include: 

  • Modularity and reusability: Design the framework to be modular so that components can be reused for different test cases.  
  • Scalability: Make sure the framework can scale as the project grows.  
  • Ease of maintenance: Keep the framework well-maintained with clear documentation and a structured code base. 

With the proper structure and approach, test automation can be a milestone in a project’s success. 

Please contact our engineers if you would like to learn more about this topic and receive a personalized consultation on implementing quality control automation in your company. 



Mariola Nowak Content Writer
Adam Niedzielski QA Automation Engineer

Design, Development, DevOps or Cloud – which team do you need to speed up work on your projects?
Chat with your consultation partners to see if we are a good match.

Jakub Orczyk

Member of the Management Board/ Sales Director VM.PL

Book a free consultation
kuba (2)