QTP -Testcomplete-Testing-Loadrunner-Selenium-Blog

Descriptive or Object repository whats the expert Advice of programming GUI Objects!!!!!!

Posted in QTP by Sandy runner on May 16, 2009

All testers at some point in carrier would have been in  dilemma is my codded stuff is best script or  just  mere satisfying functionality part of the test cases .

We like our script not just alone to be good in Functionality ,Modularity ,Generic .Well is our scripts fast enough ?

Well we can write scripts in these  8 Forms :-

So lets Find Which Wins the battle.Lets do  “SET” Operation on a Edit box .We Would Execute same process for 50 times .

A. Regular use of the object repository.

iTimer = Timer

For i = 0 to 50

Browser(“Google”).Page(“Google”).WebEdit(“q”).Set i

Next

Print “Regular OR =” & Timer-iTimer

B. Straightforward descriptive programming.

iTimer = Timer

For i = 0 to 50

Browser(“index:=0”).Page(“index:=0”).WebEdit(“name:=q”).Set i

Next

Print “Descriptive Programming = ” & Timer-iTimer

C. OR via fixed reference variable

iTimer = Timer

Set oEdit = Browser(“Google”).Page(“Google”).WebEdit(“q”)

For i = 0 to 50

oEdit.Set i

Next

Print “OR via fixed reference = ” & Timer-iTimer

D. Descriptive Programming via fixed reference

iTimer = Timer

Set oEdit = Browser(“index:=0”).Page(“index:=”).WebEdit(“name:=q”)

For i = 0 to 50

oEdit.Set i

Next

Print “Descriptive programming via fixed reference = ” & Timer-iTimer

E. Runtime through Object-Repository

iTimer = Timer

For i = 0 to 50

Browser(“Google”).Page(“Google”).WebEdit(“q”).Object.value = i

Next

Print “Runtime through OR = ” & Timer-iTimer

F. Runtime through Descriptive programming .

iTimer = Timer

For i = 0 to 50

Browser(“index:=0”).Page(“index:=0”).WebEdit(“name:=q”).Object.Value = i

Next

Print “Runtime through Descriptive Programming = ” & Timer-iTimer

G. Runtime through fixed object-repository reference

iTimer = Timer

Set oEdit = Browser(“Google”).Page(“Google”).WebEdit(“q”).Object

For i = 0 to 50

oEdit.value = i

Next

Print “Runtime through OR fixed reference = ” & Timer-iTimer

H. Runtime through fixed descriptive-programming reference

iTimer = Timer

Set oEdit = Browser(“index:=0”).Page(“index:=0”).WebEdit(“name:=q”).Object

For i = 0 to 50

oEdit.value = i

Next

Print “Runtime through DP fixed reference = ” & Timer-iTimer

I Would Suggest same Operation of “H” Can be done through GETELEMENT By ID or NAME

iTimer = Timer

Set we = Browser(“B”).Page(“P”).Object.getElementById( “id” )

For I = 0 To 50

We.Value = i

Next

Print “runtime through the OR and GetElementByID = ” & Timer-iTImer

GETELEMENT By NAME

iTImer = Timer

Set we = Browser(“B”).Page(“P”).Object.getElementByName( “name” )

For I = 0 To 50

We.Value = i

Next

Print “runtime through the OR and GetElementByName = ” & Timer-iTImer

The Results

And here are the averaged results:

Regular OR = 5.59375

Descriptive Programming = 6.375

OR via fixed reference = 3.31253

Descriptive programming via fixed reference = 3.25122

Runtime through OR = 2.90625

Runtime through Descriptive Programming = 3.921875

Runtime through OR fixed reference = 0.203125

Runtime through DP fixed reference = 0.265625

Runtime through GetElementById = 0.20122;

Runtime through GetElementByName = 0.21019

SUMMARY :=

From the results i was really Shocked to see by a Second Difference Object Repository Programming out Performed Descriptive Programming

But the difference between Regular OR and Descriptive was wiped washed out While using Fixed Reference .

Using Runtime Programming (OR or DESCRIPTIVE) also Provided  a similar effect

But the  real Hero is Runtime through Fixed reference  which finished the task with a fraction of .265 seconds

Conclusion’s

Miracle :-

Runtime programming through a Fixed Variable Performed the fastest out off all Scripting GUI OBJECTS .The reason is It avoids QTP’s  GUI Mapping Mechanism.

Advertisements

One Response

Subscribe to comments with RSS.

  1. Nagabhushan said, on August 3, 2010 at 10:03 am

    Good experiment Satosh. Many times it was felt that Descriptive programming was faster than the OR way. I think some more iterations with more complications need to be done to figure out the average speed.

    By the way, how come the descriptive script is slower than of the OR script any technical points? as DP script should reduce the execution time as it saves the search within OR and puts forward only the essential properties of the object.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: