Tuesday, April 21, 2009

DynamicDOM coming soon...

Modern software techniques and continuous revelations to the browser’s web rendering engines and DOM manipulation libraries, took website development to the new era. Working draft of HML 5.0 brought many new features to legacy markup language itself.

I being a member to the Automation community, many a time I faced questions from others regarding difficulties in getting the objects to perform test operations. Well there are many reasons why automation tool’s Native functionality sometimes really can’t help. Modern UI frameworks transforms simple web elements/controls to a rich looking controls and add extra functionalities e.g. using rich UI framework (javascript and css) converting a simple html select to Ajax autocomplete dropdown.

Sometimes People claims that there are no property which can be used to identify an objects,
Others asking me QTP doesn’t works with objects depending upon it runtime object properties or, WebRadioGroup is one of the examples which doesn’t works with “html id”.
QTP does identify objects depending upon its logical Test-Object Properties

Performing actions to multiple objects stored in object array is also not possible with automation tools without looping through array length. This increases code length, development time and increases script maintenance costs. Sometime it is also very difficult to guess how QTP will be going to behave with particular objects to identify there logical name which will help users to map there objects using Descriptive Programming in advance.

On the contrary DOM reads multiple objects having the same object properties and attributes and keeps them it into the array.

E.G.
getElementsByName
getElementsByTagName
getElementsByClassName (userdefine)
getElementsByRegExp (userdefine)


Advantage of DynamicDom.

DynamicDom directly uses Dom to work with AUT, as soon as the user send command to Dom using domAction function, the framework elaborate function depending upon its parameter and create a dynamic Local method in Dom.

  • DynamicDom returns results as a string (Array v1.1, objects v1.2, object array v1.3)
  • DynamicDOM works locally to DOM so it avoid clashing AUI’s Native resources (functions/class/variables)
  • Logs actual DOM generated errors, helps users to debug there code.
  • Everything works under try-catch so it does not affect AUT’s functional structure.
  • True synchronization working with Ajax and testing ajax based application. (upcoming article on DynamicAjax with DynamicDOM)
  • DynamicDOM can do more and other things and Fastest way to work with objects comparison to OR and DP.
  • Tool independent framework (version 2.0)
Donwload is coming soon... so be connected :)



Monday, April 20, 2009

DynamicDP Gone Wild!

I am glad to publish some statistics of my blogs visits and download counts of this week...

Last 10 days Visits counts: 878
Last 10 days downloads so far: 375

Last week Activity:

• Roger Douglas contributed to the script which will be integrated after some more testing.
• DynamicDOM is almost completed and, it is under testing, will release in this week as soon as I complete its user notes.

Below images is showing all users from enterprise who have downloaded and using DynamicDP to there projects...


Tuesday, April 7, 2009

Dynamic DP


Working as a Test automation engineer from last few years using various technologies with an Open source Attitude, I have always tried to develop reusable components which will help user to reuse there efforts and can be easily maintain and optimize test running.


While working with Quick Test Professional® I found they have very good concepts of Object repository which contain physical properties collections of object to identify it easily.
QTP being following Microsoft methodology of making user friendly UI, so they have provided an interface which can be used to create objects which can be used at runtime.


“Another example of there UI holiness is “keyword view”. I myself don’t understand how does it really works, better if they would have spent some more time on providing useful features like batter auto-complete with batter IntelliSense, code region (code collapse), multiple test development interface”



Object Repository is a wonderful feature and helps while working with some static, type’s objects but while working with dynamic (run-time) objects their main identification properties are dynamically updated, which creates cumbersome in managing tests. But QTP again have wonderful Solution to that, which we all known as “Descriptive programming”.

Descriptive programming (DP), as it is named, it does the same work, while working with this, user just needs to provide attributes values of there objects, to “description” class which is having only single public method called “create”.

DP is easy to use but it increases the lines of codes, again it has comparatively slower execution then precompiled object repository. While Working with DP I also found problem of “QTP loses its web object reference” on navigation /Post back. Which also have been faced by a large QTP community while working on different applications. But for a complex and large size application DP is the best approach which can be used.



"There are many articles already present for DP saying its advantages and disadvantages, and its needs, so let’s do not to reinvent wheel."



How effectively use DP
This white paper is containing a DP approach which will identify How to solve DP related issues, it also have a batter object definition structures which helps to code fast and optimized why with easy maintainability and provide flawless execution, which is a robust system and allow users to play with the Objects on the fly.

CodeName : DynamicDP 1.0
While working with QTP from long time and being connected to community I have seen many experts are creating dynamic objects outside the QTP, to achieve this they use xml, some use CSV (bad idea) but most of them uses excel spreadsheet which is more reliable and can be queried directly using FSO cell reference or by ADO connection.

Some time back I had a talk with a quite senior community member asking how you use your objects in your framework in a forum thread. Unexpectedly after a couple of days I got an email with an attached excel sheet screenshot and found that addressed forum member shared his idea with me. He was keeping those objects properties in excel sheet and creating object dynamically.
Okye, but it wasn’t so great manually managing those big sized excel sheet and its maintenance, but somehow replacing OR for that framework didn’t impressed me more.
This initiated a thought to have something which uses even better approach to carry objects and have a strong reason to use it.

Dynamic DP is a GUI application which works on MSHTA and uses internal explorer internally, it is made on javascript, vbscript , html and external third party library like jQuery and a jQuery treeview, context menu, thickbox plugins. It has a similar front end similar to OR (more UI part needs to be added) .

By Double clicking DPTree.hta it will popup same like screen 1 without tree nodes.



Screen 1


Clicking on root node it will appear a Thickbox which has “Parent ID” = 0, normally a browser object like Screen2.



Screen2




New objects can be stand alone without parent objects and while using those object we can provide parents to it.



ones object gets saved it will appear under root node. right click will open a context menu currently three options are displayed, ADD , EDIT and REMOVE



Screen 3


Once object get saved can click (normal left click) on it to fill its description.





All done ! now we are ready to use these dynamically created object.


How do we use dyamicDP in our Test


The First Step
'this is required statement and it should come on the top of the user action
ObjCollection.BuildObjTree()

Working Set
'============== ways of Using Objects ===============
'Using objects Style 1 [MyObjID + Ctrl keyword]
myBrowserCtrl.highlight()
myPageCtrl.highlight()
myWebEditCtrl.highlight()

'Using Objects Style 2 [MyObjID as a DP object]
Browser(myBrowser).highlight()
Browser(myBrowser).page(myPage).highlight()
Browser(myBrowser).page(myPage).WebEdit(myWebEdit).highlight()

'Using Objects Style 3 [Mixed Approch]
myPageCtrl.WebEdit(myWebEdit).highlight()
'=============================================

'=================== Some Invalid ways it will produce error ===========================
myPageCtrl.myWebEditCtrl.highlight() 'Error
' myWebEditCtrl is Already a Qualified Control and its Parents is Already decidede
' but the same control can be used as A [MyObjID as a DP object] which is stated above even for the other parents.
'===================================================================================


while Creating Object we have to BE CAREFUL selecting the Object Name
if we use the same object Name for other or New object the System will overwite it




Functional Reference

'******************************************************************
'**** ObjCollection.BuildObjTree()
'**** ObjCollection.UpdateObj(ObjName, propName, propVal)
'**** ObjCollection.CopyObj(NewObjName, ObjName, ObjParentName)
'**** ObjCollection.RemoveProps(ObjName, propName, propVal)
'**** ObjCollection.AddObj(ObjParentName, ObjName, ObjType, ObjDesc)

'******************************************************************

'this is to build three.
GoogleCtrl.highlight()
GoogleCtrl.sync 'I try always try to add sync in my AUT test framework

ObjCollection.UpdateObj "Link1","innertext","About Google"
Link1Ctrl.highlight() ' it will click About google link
GoogleCtrl.sync

ObjCollection.CopyObj "Link2","Link1","GooglePage"
Link2Ctrl.highlight() 'it will create another link with name Link2 and will do the same opration which can be done by Link1


ObjCollection.RemoveProps "Link1","innertext"
ObjCollection.UpdateObj "Link1","name","Privacy"
Link1Ctrl.highlight() 'it will open "Privacy" link but using different object identification properties


SearchTextboxCtrl.set("Manish Bansal")
SearchButtonCtrl.highlight()

ObjCollection.AddObj "GooglePage","Radio1","WebRadioGroup","name=meta"
Radio1Ctrl.select "#1"

'******************************************************************

Integration
Please go through Read me file shipped along with core.

Get DynamicDP 1.0

Download Link



Happy Automation :)








StatCounter