Have you ever wondered the meaning of the word “Automation Framework” we keep hearing. Once we start learning automation testing, we come across this word so many times, I just decided to dig deeper in this well.
Imagine when you’re driving in your place; there are no traffic rules, everyone is driving the way they want. There will be so much chaos and confusion. To avoid the same there are a set of rules and regulations which need to be followed by everyone. The same applies when it comes to automation framework. Automation Framework is not a single tool or process, but it is a collection of tools and processes working together to support automated testing of any application. It integrates various functions like libraries, test data, and various reusable modules. A framework is a structured approach that provides guidelines and tools for creating, execute and managing automated tests. It makes sure that the automation testing is functional and resourceful.
Major Components of framework.
A standard framework consists of test tools, equipment, test scripts, procedures, and people needed to make test automation resourceful and effectual. I have listed the major one’s below:
1.Test Scripting Language: Examples
Java: TestNG, JUnit, Selenium WebDriver with Java
Python: PyTest, unittest, Selenium WebDriver with Python
JavaScript: Mocha, Jasmine, WebDriverIO
2. Test Library:
TestNG: A popular Java-based testing framework with built-in test execution capabilities.
pytest: A flexible and extensible test runner for Python.
Mocha: A feature-rich JavaScript test runner.
3. Test Execution Engine:
Selenium Web driver: Automation tool for web applications, allowing interaction with web elements and browser actions.
Appium: Automating mobile applications on Android and iOS platforms.
TestCafe: A cross-browser automation tool specifically designed for web applications, eliminating the need for browser plugins.
4. Test Configuration Management:
Configuration files: Files containing settings and parameters to configure test environments and behavior.
Properties files: Configuration files in key-value format.
Environment variables: System-level variables that hold configuration information.
5. Test Reporting and Logging
Allure reports: It generates attractive and interactive test execution reports.
Extent Reports: Customizable and interactive test reports
Report Portal: allows real-time reporting, analysis, and collaboration for test results.
6. Test Data Management
CSV or Excel files: Commonly used file formats to store and manage test data in tabular form.
Databases: MySQL, PostgreSQL, or NoSQL databases.
Data generation libraries: Tools or libraries that generate synthetic test data.
Different types of Frameworks 1. Linear Automation Framework. It’s also known as Record-and-Playback framework, is one of the simplest types of test automation frameworks. In this approach, test cases are created by recording user actions (e.g., mouse clicks, keyboard input) while manually interacting with the application under test. The recorded actions are then played back as automated test scripts.
Pros
Simple
Fast
Flexible
Cons
Single use
High Maintenance
Redundant
2. Modular Based Testing Framework.
The framework divides the entire “Application Under Test” into several logical and isolated modules. For each module, we create a separate and independent test script. Thus, when these test scripts are taken together builds a larger test script representing more than one module.
Moreover, once a tester is done writing a function library, you can also store a script in it. Since you can easily make changes in a single script, adjusting the entire application is not necessary. Thus, testing requires less time and efforts.
Pros
Reusable
Modular approach
Efficient
Scalable
Cons
Less flexible
Requires technical knowledge.
Complex
Frameworks using Selenium Web driver. There are three types of frameworks which the Selenium Web Driver is the tool. Which are covered below:
3.Data-Driven Framework. It’s the framework where the data used for the testing is taken from the external files like MS-excel, CSV or Json etc. In simple words, we use the Data Driven Framework when we need to execute the same script with multiple sets of test data, whose storage is at a different place and not present inside the test script. Any changes made to the data will not impact the code of the test.
Pros
Scalable
Faster testing
Fewer scripts required
Flexible
Cons
High setup time
Excellent technical knowledge required
Troubleshooting is difficult
4.Keyword-Driven Framework. In this type of testing, we define the main functions as Keywords such as “open Browser: Opens the web browser and navigates to the application URL. “. It separates test development from your test design. It is a collection of executable keywords that simulate a user's actions, such as logging in, clicking a mouse, typing a name, etc.
A keyword-driven test consists of high and low-level keywords, including the keyword arguments, which is composed to describe the action of a test case. It is also called table-driven testing or action word based testing. In Keyword Driven Testing, you first identify a set of keywords and then associate an action (or function) related to these keywords. Here, every testing action like opening or closing of browser, mouse click, keystrokes, etc. is described by a keyword such as openbrowser, click, Typtext and so on. Pros
Reusable
Scalable
Less Maintenance
Cons
High development time
Complexity increase over time
High automation knowledge required
5.Hybrid Testing Framework.
A hybrid framework is a technique wherein we can use of any of combination of two or more automation frameworks. As this is a hybrid framework, it has been based on the combination of many types of end-to-end testing approaches.
A hybrid test framework mitigates the weaknesses of different test frameworks. It provides flexibility by combining parts of different frameworks to harness the advantages. Hence, the efficiency of testing also improves.
PROS
Flexibility and Reusability
Easy Maintenance
Support for Multiple Test Types
CONS
Complexity in Implementation
Learning Curve for New Testers
Maintenance Overhead for Customization
6.Behaviour Data Driven Framework.
Behavior Driven Development (BDD) Framework enables software testers to complete test scripting in plain English. BDD mainly focuses on the behavior of the product and user acceptance criteria. In a BDD framework, test scenarios are written in a natural language format, such as Gherkin (Given-When-Then), which is easy for both technical and non-technical stakeholders to understand. Several BDD Tools are in use for different platforms and programming languages, some of them are:
· Cucumber (Ruby framework)
· SpecFlow (.NET framework)
· Behave (Python framework)
· JBehave (Java framework)
· JBehave Web (Java framework with Selenium integration)
· Lettuce (Python framework)
· Cucumber -js(Java Script framework)
PROS
Readable and Understandable Test Cases
Improved Collaboration
Focus on Business Value
CONS
Initial Overhead
Complexity in Test Maintenance
Additional Tooling
留言