Test Automation Frameworks

What is Framework?
A framework is considered to be a combination of set protocols, rules, standards and guidelines that can be incorporated or followed as a whole to get better results.

Test Automation Framework
Automated testing frameworks provide test environment structure that offers some protocols, rules, standard and guidelines for testing which will help in creation, organization and execution of test efficiently.

Linear automation Framework:
Linear framework is the simplest  of all frameworks, based on Record and Play. Tester first execute the test manually and record every steps of it. Then he plays the recorded scripts in his subsequent test. This framework is basically used for very small projects.

Structured automation Framework:
In Structured framework ,   test cases are written in more structured way using loops, if else statements, Switch statement and conditional statement, but  it does not have any functions or modularity to make the framework more flexible.

Modular automation Framework:
It is based on OOPs concept – Abstraction. The framework divides the entire “Application Under Test” into number of logical and isolated modules. There is one independent function for each module. A single test case is combinations of one or more module/functions. These modules are separated by an abstraction layer in such a way that the changes made in the one module doesn’t affect to other modules. These modules/functions are reusable and getting called whenever needed.

Data Driven Frameworks:
When some test needs to repeat for different data set , Data driven framework gets used. In this case the test data set should be stored in some external data source such as databsae, excel, csv, text files outside the scripts.
Data Driven Frameworks separates the test scripts from the actual test data. Parameters in the test script get linked to these data source during execution of the script.

Keyword Driven Frameworks
As Name suggest, Keyword nothing but a code which represent some action, say login. In this framework, the set of code which perform certain action is mapped with a keyword (called Action Keyword) and that keyword will be used in the test script to perform the action. Keywords are self-guiding as to what actions needs to be performed on the application. Here both keywords and test data are isolated from the actual script and stored in some external source.

Hybrid Frameworks (Data Driven+Keyword Driven)
It is nothing but mix of any frameworks together. Most popular hybrid automation frameworks are Modular- Data driven and Keyword- data driven.

Test Driven Development:
TDD is an iterative development process. Each iteration starts with a set of tests written for a new piece of functionality. These tests are supposed to fail during the start of iteration as there will be no code corresponding to the tests. The corresponding code is written in the next phase of the iteration with an intention to pass all the tests written earlier in the iteration.

Any failures in the test run are marked and  code is written/re-factored to make these tests pass. Once code is added/re-factored  the tests are run again. This cycle keeps on happening till all the tests pass.

The following sequence of steps are followed in TDD
1. Add a test
2. Run all the test and note if the new one fails.
3. Add code for the failed test case.
4. Run all the tests again.
5. Refactor the code if something wrong.
6. Repeat step 4 and 5 until all test cases pass.
6. Repeat all steps until all functionality/test has been added.

Behavioral Driven Development (BDD) Framework
Behavior Driven Development is focused on more a development process than a test management. It allows automation of application functionality in easily readable and understandable format to Business stakeholders, Business Analysts, Developers, Testers, etc. This framework doesn't require any programming experience. Test cases are written using natural language constructs (Ex: English like sentence).

BDD framework is most popularly used for Unit level testing and UI level testing. Tools like RSpec (for Ruby) or in .NET something like MSpec or SpecUnit is popular for Unit Testing following BDD approach.

For UI automation you need a browser automation library i.e Selenium, and one of the frameworks Cucumber (for Ruby) or SpecFlow (for .NET).

Page Object Model (POM) Framework

A web based project consists of a number of web pages like Home page, Login page, Create Account and Forgot password page etc and each web page consists of a number a web elements. In Page Object Model all web pages are implemented in a separate class and the corresponding elements in a page are implemented as functions in the class. In this approach functions/elements of page/class cab be reused which supports reusability of code. Apart from this, if the UI for any page changes in future, it doesn’t require to change any tests, we just need to change  the code within the corresponding page class (Only at one place).

No comments:

Post a Comment