We are building a Keyword based DP framework for which we are building a repository of Keywords.
My question is specifically with respect to handling operations on complex data grids which dont have much of a common pattern in programming style (i.e. dynamic grid UI outlook is different for different UI's)
The burning question is:
1.Do we create keywords which are UI specific in such complex cases?
This obviously would increase our keyword library.
2. Do we create keywords which are generic + reusable across UIs?
Obviously resulting in some very complex code which is getting difficult to maintain.
I am in a dilemma which approach to take up and suggest to management
Our framework uses two types of keywords - high level and low level.
High level refers to anything where several actions are rolled into one function, e.g. processing a login page or validating a custom control. This would typically have several paramaters passed into it.
Low level is generic to all types of object classes. So where we label a control as an "edit box", there are several low level keywords associated to it, e.g. "Set Value", "Validate Value" etc.
This means that the user creating the script will have the option of using low level keywords and high level keywords. With this combination in place it's possible to cover a lot of functionality with your keyword framework. So in answer to your question, yes I would go with both.
As an example, I've attached a couple of screenshots including the GUI that allows this. It lets the user choose between low and high level keywords and places it onto an excel sheet. It took a couple of months of refinement to put this all together but it might help give you some ideas.
I approach it slightly differently, I try to do what ever is easiest/quickest for the person creating the test then look at the reusability.
Here's my list of keywords:
Capture Browser Bitmap
Check If Object Exists
Check Data Type
Check Obj Positions
Check Text File Value
Check Weblist Content
Check Weblist Contains
Check Webtable Content
Check Webtable Data
Click On Object
Click On Object Using X Y
Do Until Exist
Enter Data In WebEdit
Get An Object Value
Get Row Number
Get WebTable Cell Data
Low Level Type
No Data Check
Optional Step Data
Output To File
Output To Spreadsheet
Read From Excel CSV
Retrieve XML Child Values
Retrieve XML Value
Run Script If Object Exists
Scroll Into View
Select Item In Weblist
Select Extra Item In Weblist
Select Radio Group Option
Set Webcheckbox Value
System Util Run
Store App Value To Output File
Verify Page Is Displayed
Wait For Exist
Wait For Not Exist
Wait For Object Attribute
Wait For Specified Time
Wait For WebTable Data
Web Services Audit Log
Web Services Wintel Audit
Web Services DB
Web Services Procedure
Web Services DB Update
Web Services Command Line
Web Services Xquery
Web Services Compare XML Files
Manual Evidence Update
It's a bit complicated to explain without diagrams etc but I'll have a try:
We have a mapping spreadsheet setup where we map QTP Objects Names to user friendly names. The friendly name is what the users see in the test case builder (GUI screenshot from earlier post) in the framework.
e.g. Browser("A").Page("B").Frame("C").Button("D") would be mapped to "CRM System > Login Page > Login Button".
As part of this mapping process we have a screenshot snagging tool that we launch from the spreadsheet which allows us to capture the screen and automatically saves the filename for us. All this info gets written to an xml file.
When our users select an object in the test case builder, it looks up the object in the xml file and retreives the screenshot path, and then displays it in the box. It also goes away to lookup which high level keywords are associated with this friendly name path and which low level keywords are available to the object. This part is all done through Excel VBA.
If it helps I can post the screenshot snagging tool, but it's very bespoke to how we wanted to use it so if it doesn't fit in with what you want to do it probably won't be of much help.
Once things settle down for me I'll try to publish the entire framework as it's working well for us.
@Mark - I am implementing something similar on what you have mentioned. A list of keywords which corresponds to a function in one of my libraries.
One question i would be interested in knowing:
Let's say i want to click on a link inside some table on some UI and assume it is pretty complex code based on lots of hierarchies and pattern search inside the table.
I have another UI which has the same situation to click on some link within a webtable. The only thing is that the code is pretty different
What would you do in such a scenario?
I am creating separate keywords at the moment say
Is this a good move?
My SME reviewer is at loggerheads with me saying i am increasing the bunch of keywords and the same keyword should be able to do the task for you.
Please provide your inputs
Shreejit I am not at my work desktop so I am replying from memory, but my opinion is that I would create seperate keywords as once you hae written one of the functions it can become the skeleton to write the next. Main thing is users generally don't mind if it is one or two functions as long as they know which one to use in each scenario.
I would suggest to your SME that over complicting a keyword can lead to extra maintenance, and when the function is complicated the means you have to analyse it for both pageA and pageB scenarios. If you have seperate functions then if change is reqired for pageB function then you only have to think about how it will affect pageB.
Please let me know which course of action you take and whether SME understands your reasons why.