Jun 05 2008 03:48:52 AM Posted By : rajasankar
Comments (0)

I've discussed overcoming the user interface/ web interface changes here. Script maintenance and related issues are discussed here. Take a look at the Script maintenance guide here. The examples used in those articles are simple ones. However, in real world testing, we'll encounter complex web interfaces to deal with.

We know we can use Dynamic Functions of QEngine to handle any element that is added dynamically in the web application. How about using those functions for a static element which might change in future.
Let me explain using an example. When I am automating OpManager, I've encountered a situation to check the device snapshot pages.



A,B,C are device names in the network. I need, QEngine to click on these links. Discovery of the devices will run on everyday to check the daily build performance of OpManager. If any device is down at the time of the discovery, it wont make into this list. Sometimes, the name of device may be changed or may be removed from network. When I record this page using QEngine, I've got this,

Code:
clickLink("A",1)
setWindow( "OpManager",1)
clickLink("Server",1)
setWindow( "OpManager",4)
clickLink("B",5)
setWindow( "OpManager",7)
clickLink("Server",1)
setWindow( "OpManager",4)
clickLink("C",5)


I can't run the same script if the devices names are changed like this,


Using the following functions may resolve issues like this,
fireEventOnCellElement
To invoke or fire the specified event for the given HTML Table Cell element

fireEventOnElement
Using this function, desired action can be initiated over the certain HTML element identified through the arguments to the function. The element details need not present in the GUI map file.

fireEventOnChildElement
Using this function, desired action can be initiated over the certain child HTML element of the given parent HTML element identified through the arguments to the function. The element details need not present in the GUI map file.


Instead of the above script we can use like this,

Code:
setWindow( "OpManager",1)
fireEventOnCellElement("main",1,2,"click","NONE","NONE","NONE","NONE",1)
fireEventOnCellElement("main",1,3,"click","NONE","NONE","NONE","NONE",1)
fireEventOnCellElement("main",1,4,"click","NONE","NONE","NONE","NONE",1)

This will play in every situation. Even if the device name changes, it will play.

I am using the newly introduced fireEventOnChildElement in OpManager.
Using that function reduces the 10-15 days of manual effort in the
every testing cycle.

Script reusing has one basic requirement, no hardcoding. Here Hardcoding means, using constants where it can be replaced using variables.
I'll discuss another aspect of this in the next post.

Send your feedback/comments to rajasankar at adventnet dot com

No one has commented yet! Be the first one to comment!

Post Comment

38.107.179.229 (38.107.179.229)