This framework is an application independent way to design testcases. The testcases are supported via data table. Mostly a database supports the vocabulary of keywords.A core library is required to read all these lines from Excel or data source and convert them into equvalent QTP /Selenium/other tool command.
The keywords are simple and clear [like open_bowser,Close_browser,setValue].Each keyword will be mapped to a known action.There can be multiple inputs for the action. Like -Locator,Text. Even an action can be an input to another action.Now this framework is combination of tables[Cycle table,test table]. Below are the sections where I have shown how is the structure of a keyword driven framework…
In keyword driven testing there exists five different parts..
- Control file
- Testcase file
- Startup Script
- Driver Script
- Utility Script
What is Control File?
Well, this file contains all testcases. Based on some parameters or conditions some of the testcases will be executed.
What is Testcase File?
Detailed design test cases.Mainly written column like-Keyword ,Object Name , Parameters.It is an excel file in most of the cases.This will also include the start up and tear down methods.
What is Startup Script?
This is the initialization script. It creates the environment to run the testcases.Assembles the testcases those are marked to be runable in control file.
What is Driver Script?
It drives the test flow,gets input from stratup script [Which scripts to run]. It reads the testcase file for the corresponding steps. And It takes the input passes that to script engine to generate the code according to the test tool and corresponding script gets executed.
A good framework should allow any combination of features to be tested. Initial days we used Excel to select testcases.As technology progressed,we use web interfaces with simple UI where check box can be checked to select testcases.User friendly,self explanatory web interface ensures good productivity as it reduces the technical barriers.Jenkins,QC are very good example. This feature will support mini regression to full regression.
What is Script Engine or Utility Script?
Script engine is responsible for tool specific code generator. Kind of tool understandable code generator. The code will be executed on the tool.
Utility script: Utility Scripts are the low level test steps to perform some operation.Some common utility methods are-
- ReportLog- It is also known for debug logger. It gives more clarity on real bug and noice.
Sometimes all supported libraries we put in Utility Script.like-
- File Handling,
- String handling
- Database access
Execute -Execute and Execute should be main aim for this approach. This is keep the maintenance low and scripts updated. This will give great ROI.
There may or may not be any object repository present. There is further reusable concept hence all functions, keywords etc will be generic in nature.
Advantages of keyword driven framework:
- Change management is easier
- Does not dependent on the UAT
- Much easier to extend.
- Similar to functional test script so easy for non technical or non tool experts in terms of understanding.It is easy for them to develop scripts.
- When developed block by block it becomes highly user friendly.Real power of functional decomposition can be seen.
- This will also cut down the test engineers tedious and lengthy testcase creation time. Manual testers will have bugs.
- Easy to modify so maintenance cost is low with compared to other framework.So greater ROI could be achieved.
- Advanced keyword driven framework is having two layers…one is pure code layer and other is pure English or non code elite language.Functional people can prepare the test cases very easily.
- If the infrastructure is separated from logical layer then any test cases can be automated.
- After a couple of months When the basic building blocks(unique components) are ready to design a functional flow, the development cost will down.
- So this will provide better ROI.
- If application is getting changed, it can determine the changes on run time .It can change only that component.No need to debug the entire script. Hence it is very easy to maintain.
Due to simple English interface, it is best for manual test engineers,functional analysts and business analysts.
Disadvantages of keyword driven framework
- Naming convention is tough for large projects.
- Very tough to remember the keywords.
- Initial investment for framework design is high.
- High skilled labor is must for initial days of the project.
- Not very to understand for new comers.
So to conclude, it is one of the finest flavor of data driven testing but having most time consuming process.But the keyword preparation is one time effort. Once completed,it can handle any size of project.This approach will uncover the code issues in an automation at earliest. Automation code is also a software code that needs to be tested.By this approach,we can test automation code as well.As a result it is more likely to uncover more bugs.
Modular Automation Framework
In this approach,The whole scenario is divided into small business flows-called module.Those modules are written in a library file as a functions.
In the script level the high level business functions are called.They are linked with small module functions.more over this is a very simple approach over record and play back.Objective to make it modular is nothing but to make the script reusable.There are driver in the main script and modular functions are stubs.We create shared object repository for Modular Automation testing.When Application is huge, Initial development may go high but later the development cost just go down. Maintenance is easy and straight forward.
What is Modular Framework in UFT/QTP?
As the name suggests, this is driven by Module. Now what is a module—well it is small independent scripts that performs a specific set of tasks.It creates an layer in front of the component and hide the components from a non technical user as well as application.
The small components are added up to build a large test set.
|What is Component?|
Say I need to log in to an application. So I will select the module –login.
This login module will internally call generic functions.
How …lets see,,
Login component will contain ..
1. open the url ….so login module will take input1- url
2. It will open a browser and navigate the url
3. Now it will write user name ….so the second input is user id
4. similarly password and 3rd input will be password
5. click on a button whose name is Submit.(This is bit tricky..instead of clicking on submit button directly..we can make a common function which will accept a title name and click)…so this will be my 4th input.
|What is Modular Framework?|
Here the flow is controlled by the login module but originally done by individual functions. So it is a functional decomposition method aiming to do unit set of tasks. Each task has only one calling point and will have only one exit point with finite and definite outcome.
Modular way of dividing requirements will reduce the test building cost in the long run with higher re usability.
Modular Framework will have 3 to 4 layers.
2.Higher level components
3.Lower level components