The online community for software testing & quality assurance professionals
 
 
Calendar   Today's Topics
Sponsors:




Lost Password?

Home
BetaSoft
Blogs
Jobs
Training
News
Links
Downloads



Testing Tools >> HP Functional Testing / Mercury QuickTest Pro / QTP

Pages: 1 | 2 | >> (show all)
Jits
Advanced Member


Reged: 01/31/07
Posts: 492
Loc: Pune, India
Runtime object properties?
      #384201 - 05/27/07 02:18 AM

Hi,

Is there any way to set run time object properties?

I think there is no method like SetROProperty(), we can set test object property using SetTOProperty().

Although if we can set it then let me know or give me other approach if any?

Regards,
Jits


Post Extras: Print Post   Remind Me!   Notify Moderator  
thorwathModerator
Veteran


Reged: 07/22/99
Posts: 3840
Loc: Grand Rapids, MI
Re: Runtime object properties? [Re: Jits]
      #384205 - 05/27/07 04:45 AM

I am not sure why you would want to do that, but it is a question thatn needs to be directed to the developers of the app itself--as they would have to provide a means (probably through COM Object Automation), to change UI properties at runtime. Then your code would need to instantiate the COM object and then make appropriate method/property calls to modify UI properties.

This is highly unlikely, but if I understand your question correctly, this is not a QTP question.

-Hope this helps, Terry Horwath


Post Extras: Print Post   Remind Me!   Notify Moderator  
Yaron Assa
Member


Reged: 05/07/06
Posts: 340
Loc: Israel
Re: Runtime object properties? [Re: thorwath]
      #384207 - 05/27/07 05:39 AM

This can be done by punching through QTP's shell around the application's objects. Not all environments supports such actions, and you have to be VERY careful as to what are the exact effects of touching the inner objects of the application.

This is mostly applicable in .Net and VB environment, as they have rich and usually unsecure object structure.

Say QTPWindow is the QTP reference to a .Net window. You can do something like:

QTPWindow.Object.Enabled = Visible

The same command structure is used for controls, tabs, other environments windows etc. It's always QTPObject.Object.RunTimeProperty = Something.

Two things to ask yourself before doing these manipulations:
1. Is it OK for me to stop emulating the user-actions, and start messing with the back-stage of the AUT? (remember - once you do things behind the scenes, you may be missing out on UI and bussiness logic bugs).

2. Am I causing bugs that a user wouldn't run into? Sometimes, just touching the inner-objects can cause QTP to leave an open pointer to them, which in turn could lead to a world of chaching problems. Moreover, sometimes, the app has protective code around a property, and when you mess with it directly, you really MESS with it.

After all of that, there are certian cases in which it's better to pay the price of missing some near-0-probability UI bugs, and get a much more stable and robust script.

All the best.

--------------------
www.AdvancedQTP.com
'coz we're programmers - not users


Post Extras: Print Post   Remind Me!   Notify Moderator  
thorwathModerator
Veteran


Reged: 07/22/99
Posts: 3840
Loc: Grand Rapids, MI
Re: Runtime object properties? [Re: Yaron Assa]
      #384208 - 05/27/07 07:33 AM

Quote:

Two things to ask yourself before doing these manipulations:
'
1. Is it OK for me to stop emulating the user-actions, and start messing with the back-stage of the AUT? (remember - once you do things behind the scenes, you may be missing out on UI and bussiness logic bugs).
'
2. Am I causing bugs that a user wouldn't run into? Sometimes, just touching the inner-objects can cause QTP to leave an open pointer to them, which in turn could lead to a world of chaching problems. Moreover, sometimes, the app has protective code around a property, and when you mess with it directly, you really MESS with it.





Very interesting, but...

And the purpose of this would be, from a testing perspective?

Even if you are successful attacking/hacking the app using this unsupported approach, what type of reliable information could you glean from the app? How would the discussion with the developers go, as you discussed your "testing results" using this backdoor?

This discussion seems more appropriate for a hacker's forum.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Yaron Assa
Member


Reged: 05/07/06
Posts: 340
Loc: Israel
Re: Runtime object properties? [Re: thorwath]
      #384210 - 05/27/07 10:03 AM

The point is not TESTING the application through the back door. It's using the back door to safely get us to the where we can test it.

I'll give you an example from a project I was involved in. The main app had a custom Tab-Control which QTP didn't recognize. After many attempts to automate the tab-switching, we got down to .click X Y. This was unacceptable since the application ran on different systems, with different resolutions, fonts and layouts.

So we did a little object drilling, and found the when the active tab is switched, the tab-control's Tabs.ActiveTab property (an int index) changed. We checked and saw that we could do this the other way around - changing the property changed the application's active tab.

After consulting with the programmers and the system's client, we came to a conclusion that this minor RO manipulation had zero impact on the stability of the system, and any UI bug we missed during the tab-switch, would fail the next step of the script.

So, decided that the tab navigation will be packed in a function that manipulated the RO property of the tab-control. The function got a tab name, ran through the .Tabs collection, found the tab's index, and switch the Tabs.ActiveTab index to it. It wasn't about testing the tab control, it was about getting to the right tab, where we could rip the application apart, good-old-fashion QTP style

This gave us:
A. A much more robust script (.Click X Y tends to break due to focus loss, low system resources, etc.)
B. A generic script (serves multiple systems with various fonts, resolutions etc.)
C. Zero-maintenance growth and change (Script handles "out of the box" New tabs, different tab ordering, different tab layout)
D. Extended functionality (Previous script had to have the tab's index, now we can use the tab's name)

We paid for it with:
A. VERY small possibility for missing tab-switching UI bugs due to not actually pressing the tab control.
B. VERY small possibility for creating new tab-switching bugs due to messing around with the RO objects.

However, the benefits outweigh the downside by far.
I don't think that manipulating the RO properties of an app. is a taboo, I just think you need to know what you're doing in order to enjoy the inherent possibilities it brings.

--------------------
www.AdvancedQTP.com
'coz we're programmers - not users


Post Extras: Print Post   Remind Me!   Notify Moderator  
thorwathModerator
Veteran


Reged: 07/22/99
Posts: 3840
Loc: Grand Rapids, MI
Re: Runtime object properties? [Re: Yaron Assa]
      #384215 - 05/27/07 04:41 PM

Quote:


(1) So we did a little object drilling, and found the when the active tab is switched, the tab-control's Tabs.ActiveTab property (an int index) changed.
.
(2) We checked and saw that we could do this the other way around - changing the property changed the application's active tab.





I was with you through #1. After #2 your reply make zero sense to me. Especially that the developers found your invasive intervention reasonable--or valuable from a testing perspective.

I guess on this issue we will have to agree to disagree. But you provide a reckless path for others to experiment with.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Yaron Assa
Member


Reged: 05/07/06
Posts: 340
Loc: Israel
Re: Runtime object properties? [Re: thorwath]
      #384231 - 05/27/07 08:21 PM

OK, then I agree (to disagree).

I'll try and buff my warnings and reservations about this method in the future.

All the best.

--------------------
www.AdvancedQTP.com
'coz we're programmers - not users


Post Extras: Print Post   Remind Me!   Notify Moderator  
Jits
Advanced Member


Reged: 01/31/07
Posts: 492
Loc: Pune, India
Re: Runtime object properties? [Re: Yaron Assa]
      #384240 - 05/27/07 10:37 PM

I would like answer in terms of either YES or NO? I mean whether its possible or not?

Post Extras: Print Post   Remind Me!   Notify Moderator  
Yaron Assa
Member


Reged: 05/07/06
Posts: 340
Loc: Israel
Re: Runtime object properties? [Re: Jits]
      #384276 - 05/28/07 02:22 AM

Yes.

--------------------
www.AdvancedQTP.com
'coz we're programmers - not users


Post Extras: Print Post   Remind Me!   Notify Moderator  
Jits
Advanced Member


Reged: 01/31/07
Posts: 492
Loc: Pune, India
Re: Runtime object properties? [Re: Yaron Assa]
      #384284 - 05/28/07 03:13 AM

Will you please show me the right way to do it..

Post Extras: Print Post   Remind Me!   Notify Moderator  
Yaron Assa
Member


Reged: 05/07/06
Posts: 340
Loc: Israel
Re: Runtime object properties? [Re: Jits]
      #384302 - 05/28/07 04:41 AM

The syntax is :
QTPObject.Object.PropertyName = NewValue

For Example : VBWindow("VB").Object.Visible = True

The point is that other than ensuring your syntax is correct, there is no "right" or "wrong" way for doing this stuff. You must be sure you're not messing the application up by doing these things, and that can only be done on a case-by-case basis.

In Terry's opinion (and I reckon many others as well), this should NEVER be done, as it doesn't test anything worth testing, it doesn't emulate user-actions, and may cause serious problems and bugs.

In my opinion (and a few others), while doing this isn't "testing" by itself, it can help us test by ensuring we'll get where we need to get in order to the test the application, more robustly than by emulating the user. This of course, only if we ensured beyond any reasonable doubt, that doing it doesn't break anything down.

--------------------
www.AdvancedQTP.com
'coz we're programmers - not users


Post Extras: Print Post   Remind Me!   Notify Moderator  
thorwathModerator
Veteran


Reged: 07/22/99
Posts: 3840
Loc: Grand Rapids, MI
Re: Runtime object properties? [Re: Yaron Assa]
      #384308 - 05/28/07 05:20 AM

Yaron, my apologies--I read your detailed explanation post again and agree that I would do the same thing to achieve resolution independent navigation--as my last choice (as you did, over an X,Y coordinate reference).

And you correctly caution readers about the potential for problems using this technique.

You use the terms, "punching through QTP's shell...", "unsecure object structure...", and "inner objects...", which are all correct observations, caused confusion for me on my first (not so careful) reading.

Now I see you are just accessing the object's native properties (my observation/term) via the QTP obj.Object method. While I occasionally use this method, I have never considered using this technique to change a property.

-Terry Horwath


Post Extras: Print Post   Remind Me!   Notify Moderator  
Yaron Assa
Member


Reged: 05/07/06
Posts: 340
Loc: Israel
Re: Runtime object properties? [Re: thorwath]
      #384361 - 05/28/07 08:25 PM

OK, thanks Terry, that's big of you.
Glad to hear you agree; At least this misunderstanding gave me a post in my site

All the best

--------------------
www.AdvancedQTP.com
'coz we're programmers - not users


Post Extras: Print Post   Remind Me!   Notify Moderator  
Jits
Advanced Member


Reged: 01/31/07
Posts: 492
Loc: Pune, India
Re: Runtime object properties? [Re: Yaron Assa]
      #384368 - 05/28/07 09:26 PM

You mean to say it is possible using DOM.
Ok Thanks,

Jitesh.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Yaron Assa
Member


Reged: 05/07/06
Posts: 340
Loc: Israel
Re: Runtime object properties? [Re: Jits]
      #384385 - 05/29/07 12:28 AM

If you're talking about web based applications, then yes.
But the method also works in VB, .Net and other environments which have nothing to do with DOM.

--------------------
www.AdvancedQTP.com
'coz we're programmers - not users


Post Extras: Print Post   Remind Me!   Notify Moderator  
Jits
Advanced Member


Reged: 01/31/07
Posts: 492
Loc: Pune, India
Re: Runtime object properties? [Re: Yaron Assa]
      #384413 - 05/29/07 02:38 AM

Hi Yaron,

Can you give me sample example for www.yahoo.com with any object properties?

Jitesh.


Post Extras: Print Post   Remind Me!   Notify Moderator  
TmReddy
Advanced Member


Reged: 02/01/07
Posts: 458
Loc: Pittsburgh, USA
Re: Runtime object properties? [Re: Jits]
      #384468 - 05/29/07 05:18 AM

Here is a simple example to get all the properties and values of an object.

Set Obj = Browser("Google").Page("Google").WebEdit("q").Object
For i = 0 to Obj.Attributes.Length-1
Print Obj.Attributes(i).Name&"="&Obj.Attributes(i).Value
Next

Hope this helps.

Thanks,
-Reddy


Post Extras: Print Post   Remind Me!   Notify Moderator  
Jits
Advanced Member


Reged: 01/31/07
Posts: 492
Loc: Pune, India
Re: Runtime object properties? [Re: TmReddy]
      #384473 - 05/29/07 05:36 AM

Hi Reddy,

I don't want to Get properties but i want to set runtime properties.

Is this possible?

Jits.


Post Extras: Print Post   Remind Me!   Notify Moderator  
TmReddy
Advanced Member


Reged: 02/01/07
Posts: 458
Loc: Pittsburgh, USA
Re: Runtime object properties? [Re: Jits]
      #384475 - 05/29/07 05:43 AM

Yaron already mentioned in his post.

Browser(.).Page(.).WebEdit(.).Object.RuntimePropertyNameHere="Jits"

-Reddy


Post Extras: Print Post   Remind Me!   Notify Moderator  
Jits
Advanced Member


Reged: 01/31/07
Posts: 492
Loc: Pune, India
Re: Runtime object properties? [Re: TmReddy]
      #384485 - 05/29/07 06:12 AM

Its works fine. thanks all!!

Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1 | 2 | >> (show all)



Extra information
0 registered and 69 anonymous users are browsing this forum.

Moderator:  IanFraser, Rajkumar_Rajangam, thorwath, TReddy, AJ, Tarun Lalwani, mwsrosso 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 8162

Rate this topic

Jump to

Contact Us | Privacy statement SQAForums

Powered by UBB.threads™ 6.5.5