In part - I, I have explained about core framework architecture and keywords design.
In this post I am planning to explain the design by taking Mercury Tours.
Test Case Generator - It is an excel file containing macros and two work sheets "KeyList" and "KeyWord".
"KeyList" sheet is the place where "KeyWords" are created.
How to design KeyWords ?
Attaching the "KeyList" screen shot.
I use following naming convention by using Camel Case format for all the Keywords to increase the readability.
Let me explain by taking a KeyWords from the above screen shot.
MtWelcomeMercuryToursPUserNamePasswordEnter
Mt - Mercury Tours (All the Keywords for mercury site will use this prefix)
WelcomeMercuryToursP - Welcome Mercury Tours Page (Page Title displayed on the browser)
UserNamePasswordEnter - To fill User name(Parameter 1) and Password(Parameter 2) fields.
MtWelcomeMercuryToursPSignInBtnSelect
Mt - Mercury Tours (All the Keywords for mercury site will use this prefix)
WelcomeMercuryToursP - Welcome Mercury Tours Page (Page Title displayed on the browser)
SignInBtnSelect - Select Sign In ButtonMtBookAFlightPPassengerDetailsEnter
Mt - Mercury Tours (All the Keywords for mercury site will use this prefix)
BookAFlightP - Book A Flight Page (Page Title displayed on the browser)
PassengerDetailsEnter - To fill First name (P1), Last Name(P2), Meal Type (P3)
Following points to be considered while designing the Key words
1. Each key word should be self explanatory. Don't not bother about the length, you are not typing it, just selecting from the drop-down.
2. Granularity of the Key word.
3. No two keywords should perform the same task or having similar methods for an object.
Major issues with Key Word Driven Framework
1. If user type incorrect key word, your test may fail as it can't resolve the Key word.
2. It would be difficult to remember the input parameters for each key word. Some have one or more and others don't have.
To overcome the above mentioned issues this excel file was created.
Each key word can have none or one or more number of parameters. Each parameter is classified as Mandate(m) or Optional(o) and its name is provided in the corresponding cell as comments (as "User name" in the above screen shot.
All these keywords are listed as drop down in the "Keyword" sheet. Attaching the screen shot.
While creating the test case, user need to select the key words as per the test steps mentioned in the manual test case. Any one can create automation test case as each key word is self-explanatory. Attaching the screen shot.
You can also create key words to capture content from the screen. Like flight conformation details in the mercury tours, attaching the screen shot.
Core framework libraries will fetch each key word from the above sheet and pass it to the "Driver Script Case Structure" function. Attaching screen shots.
(fun - All functions start with this prefix)
Each keyword is calling corresponding page functions. Page function consist of a single page objects methods which are divided into groups as per the KeyWord granularity.
As the function is calling another function to actually execute methods on the web page (In the above screen shot Function 1 calling Function2), it is named as "Dual Function Hybrid Framework"
Page function logic for processing the keyWords.
1. Check for page synchronization. (It doesn't make sense to perform any method if the page is not downloaded successfully)
2. Declare the objects using DP.
3. Execute methods based on the keyword selected by using iKeyWordMethodsSelect. Core framework libraries will automatically pass the excel sheet input parameters into this function.
It is designed in such a way that QTP engineers need to concentrate on the web page objects, methods, they need not worry about the background logic. Core framework libraries automatically fetch and update data from corresponding sheets, this complex process is completely encapsulated. This will reduce the errors and increase the automation project efficiency. This design will not through any runtime errors even if browser not loaded successfully or objects missing from the screen, this error handling process is written separately. Never complicate the QTP code by inserting multiple validations, keep in mid you are testing the application, not the QTP framework or VB code.
Attaching few page function screen shots along with the corresponding web pages.
Re-usability(100%), Maintainability, Modularity, Ability to configure, Ease of use, Stability, Flexibility, Ease of code design are the important factors considered during design.
I have explained the main design, actual framework is more complex (Implementation of Response time calculation, Register methods, Object highlighting, beep on click...)
It also calculate average page response time of all the pages and generate a report in an excel format. Attaching the screen shot of average time and page count.
Evolution of this framework took 3 years, nearly spent 3 months just for optimizing the code.
Please let me know, If I had missed any functionality that has been implemented in any of your frameworks.
I think, this can help you in designing your own framework as per your project requirements.
Good Luck !
I have received many comments regarding the function "garrBroPag((fungarrBroPagFindRowIndex(1,1,))+1,6))" . I have provided explanations below (read my comments). For more clarity, I am attaching the excel screen shot.
----