Introduction
A Framework defines a set of guidelines for all phases of test automation: Requirement Analysis, Script Design, Execution, Reporting and maintenance. A framework can be a wrapper around some complex internal architecture which makes it easy to use for the end user. It also enforces a set of standards for implementation
Problem Statement
There is no standard set of guidelines available on developing a framework and what all considerations need to be taken during the development of the same. There are different white papers which go over types of framework and how they work. But none of them defines what all factors go in to the design of the same Design guidelines This post covers different aspect of a framework and key features it needs to have based on the requirements.
The Automation Framework Design Challenge:
Automation should be considered as a development project and not just record and playback of events. Starting automated testing with a good framework ensures low maintenance. Guidelines discussed in this post can be used as input for developing requirements for a framework. The benefits of test automation are improved time to market through efficiency, better software quality, and reduced cost. However, careful planning and sound design are required to reap these benefits. A framework is like a blueprint – it provides direction during the automation efforts and helps achieve the value of the automation investment.
A Framework defines a set of guidelines for all phases of test automation: Requirement Analysis, Script Design, Execution, Reporting and maintenance. A framework can be a wrapper around some complex internal architecture which makes it easy to use for the end user. It also enforces a set of standards for implementation
Problem Statement
There is no standard set of guidelines available on developing a framework and what all considerations need to be taken during the development of the same. There are different white papers which go over types of framework and how they work. But none of them defines what all factors go in to the design of the same Design guidelines This post covers different aspect of a framework and key features it needs to have based on the requirements.
The Automation Framework Design Challenge:
- Balance Quality
- Time
- Resources
The challenge is to build a fit-for-purpose automation framework that is capable of keeping up with quickly changing automation testing technologies and changes in the system under test. The challenge is accentuated by the various combinations that are possible using the wide gamut of available automation tools. Making the right choices in the preliminary design stage is the most critical step of the process, since this can be the differentiator between a successful framework and failed investment.
As if this were not tough enough, add to this the even more formidable challenge of balancing the quality of the framework against the desired utility and the need to develop the framework within a stipulated timeframe using available resources to ensure the economic viability of the solution. Therefore, it is very important to benchmark the framework, the associated development time, and the required resources to ensure the framework's quality justifies the use of the framework.
As if this were not tough enough, add to this the even more formidable challenge of balancing the quality of the framework against the desired utility and the need to develop the framework within a stipulated timeframe using available resources to ensure the economic viability of the solution. Therefore, it is very important to benchmark the framework, the associated development time, and the required resources to ensure the framework's quality justifies the use of the framework.
- Selection of a framework –
Different types of frameworks that exist are:- Data Driven framework – Used when flow of the application remains constant, only the data changes. The data is provided by external medium e.g. – excel sheet, XML etc…
- Keyword driven framework – This framework provides generic keywords that can be used with any type of application. It also provides abstraction from the type of automation tool used and type of being application tested, e.g. – it can test a similar Web and Windows application with the same test case
- Hybrid framework – A hybrid framework is the one which takes advantages from both Data Driven and keyword driven frameworks. These frameworks do not implement generic keywords but implement business logic keywords based on the application being tested. For ex – Login, Logout could be application specific keyword that can be used.
- Don’t reinvent the wheel – A framework should try
and use the power of the automation tool rather than re-defining the
whole language by implementing new keywords. Developing a keyword driven
framework is time consuming and costly. A Hybrid framework can be
developed in a shorter time period and with less cost.
- Re-usability -The framework should allow highest
possible reusability. Combining individual actions into business logic
provides re-usability. E.g. – Combing actions like “Enter username”,
“Enter password” and “Click Login” into one re-usable component “Login”
- Support of different application versions -A
framework should allow re-use of baselines scripts in case different
versions/flavors of an applications are to be tested. There are two
different ways to support different applications
- Copy and Modify – This method involves creating copies of the baseline scripts and modifying them for a specific application version
- Re-use and Upgrade – This method involves re-using baseline script
and providing a upgrade code for specific version of application. This
ensures maximum re-usability and should be preferred.
- Support of script versioning – Scripts should be stored in a version control system like GIT, Bit Keeper, ClearCase etc…This ensures recovery from any disaster.
- Different environment for development and production
– Automation should be considered as any other development project.
Test scripts should be created and debugged in Test environment. Once
tested then only should be deployed to the production environment. This
holds true for any emergency releases also
- Externally Configurable – Configurable items of a
script should be kept in an external file. This would contain
configuration like Application URL, version, path etc…This allows
running the same script against different environment. Ensure that
location of the configuration file is not hard coded. Hard coded files
would allow running on any environment but only one at a time. Keeping
the configuration relative to current test path allows overcoming this
limitation
- Self configurable – Ideally a framework should be
self configurable. Once deployed to a system, no manual configuration
changes should be required and scripts should automatically configure
the required settings
- Minimal changes required for any object changes
-Most common issues faced during automation are object identification
changes. Framework should be able to patch such changes easily. This can
be achieved by storing all object identification settings at a shared
location. This could be an external XML file, excel file, database or
automation proprietary format. There are two possible way to load this
object identification configuration
- Static – In this all the object definitions are loaded into the memory at the start of the test. Any changes made to object definition can only be loaded by stopping and re-running the test
- Dynamic –Object definition is pulled as per request. This
approach is a bit slow as compared to the static one. But in case of
huge scripts where the fix needs to be made at run-time this is
suitable.
- Execution – Framework might need to cater to below requirements (on need bases)
- Execution of a individual test case
- Execution of a test batch (combination of tests)
- Re-execution of only failed test cases
- Execution of a test case/test batch based on result of another test case/test batch
- Status monitoring – A framework should allow
monitoring the execution status in real time and should be capable of
sending alerts in case of failure. This ensures quick turnaround time in
event of a failure
- Reporting – Different applications have different
reporting needs. Some require combined results for a test batch and some
require individual level test report for each test case in test batch.
The framework should be flexible enough to generate required reports
- Minimum dependency on Automation tool for changes –
Some fixes can only be made by opening the script in the automation
tool and then saving it. Scripts should be developed in such a way that
modification is possible even without the unavailability of the
automation tool. This deflates company cost by reducing the number of
licenses required. It also allows anyone to make changes to the script
without having the need to setup the tool
- Easy debugging -Debugging takes a lot of time
during automation and hence special care needs to be taken for this
part. Keyword driven frameworks which use external data source (like a
excel spread sheet) to read scripts keywords and process the same are
difficult to debug.
- Logging – Log generation is important part of
execution. It is very important to generate debug information at various
points in a test case. This information can help find problem area
quickly and reduce the time to make a fix at the same time
- Easy to Use – The framework should be easy to learn
and use. It is time consuming and costly to train a resource on a
framework. A well documented framework is easier to understand and
implement
- Flexible – Framework should be flexible enough to accommodate any enhancements without impacting existing test cases
- Performance impacts – A framework should also
consider the performance impacts of the implementation. A complex
framework which increases the load time or execution time of scripts is
never desirable. Techniques like caching, compiling all code into single
library while execution etc… should be used to improve performance
whenever possible
- Framework Support Tools – External Tools can be developed to perform tasks that help in framework design. Some example tasks would be
- Uploading scripts from local folder to HP Quality Center
- Associating library files to currently open scripts
- Synchronizing local files with HP Quality Center.
- Coding Standards – Coding standards ensures
scripts that are consistent, readable and easily maintainable. Coding
standard should define all the below listed things
- Naming convention for variables, subs, functions, file names, script names etc… Ex – iVarName for interger, prFuncName/meFuncName for function returning interger
- Library, subs, functions comment header. This should include information like version history, created by, last modified by, last modified date, description, parameters, example
- Object naming conventions. Ex – txt_FieldName for a text box
- Portability - The framework must be easily deployable in any environment and technology stack for regression testing and certification testing of the product suite.
- Scalability - When expansion is required, the framework must allow the addition of multiple scripts and assets, per the testing requirements, through the organized structuring of resources. This need is inevitable in the case of ERP products, which undergo multiple releases for new builds or require different scripts for parallel testing or testing on multiple technology stacks.
- Reliability - The framework must ensure that the test results are an accurate depiction of system conditions at the time of testing. It also must ensure that automated testing is carried out by efficiently utilizing system resources.
- Retestability - This feature ensures that regression tests can be submitted multiple times without any change to the data or any other component associated with the tests. It also ensures that the functionality being tested is thoroughly verified.
- Rerunability - The framework must provide the ability to resubmit the core setup to the same environment, and each time this happens, the framework must ensure that a new setup is created that is used for subsequent testing. All this should happen without any manual change of data in individual scripts.
- Remote execution - Provision must be made to create and submit automation jobs, which then must be scheduled automatically according to available resources and preset parameters.
- Load balancing - All scheduled jobs must be executed on the first-available machine, thereby making optimum use of the system. The executions should be based on business rules.
- Parallel execution in the same environment - Automated scripts conforming to the framework must be able to run simultaneously even though they form part of multiple test cycles in the same environment.
- Parallel execution in different environments - Automated scripts conforming to the framework must be able to run simultaneously in different environments.
- Script development efficiency - The development time for scripts conforming to the automation framework should not be more than eight man-hours per script for scripts of high complexity.
- Addition of functionality - Flexibility should be provided-without limitations posed by the framework-for adding new functionality as requirements evolve.
There could be many other needs based on
the project requirement. A framework might not implement all of them,
but should be flexible enough to accommodate such requirements in future
Automation should be considered as a development project and not just record and playback of events. Starting automated testing with a good framework ensures low maintenance. Guidelines discussed in this post can be used as input for developing requirements for a framework. The benefits of test automation are improved time to market through efficiency, better software quality, and reduced cost. However, careful planning and sound design are required to reap these benefits. A framework is like a blueprint – it provides direction during the automation efforts and helps achieve the value of the automation investment.
No comments:
Post a Comment