views:

381

answers:

1

Hi,

I've been taking a quick look at QTP with one of our test team.

We've figured out some basics like recording a test, capturing text using output values, putting in check points, etc.

However, I can't figure out how to do the following...

We have a web form which a user fills in and submits. This will create an item and assign it an ID in the database. We can capture this ID.

A subsequent page then shows a list of all items, with a link available to open a specific item. This is a simple hyperlink on a web page.

How do I:

  • Check that a link exists on the page with the ID assigned from the creation step?
  • Click that link?

I'm sure that this must be possible, but I've been struggling grokking the tool so far, so this is a shameless cry for help to save me from having to study the docs.

Thanks.

+4  A: 
  1. Quickly look on Web GUI recognition principles in QTP. Get to the descriptive programming part.

  2. Find Help for Link object in QTP.

  3. Define your target Link object using descriptive programming. It should be something like

    Set objTargetLink = Browser("title:=...").Page("title:=...").Frame("title:=...").Link("id:=target_id")

  4. Use

    boolRC = objTargetLink.Exist(0)

    To check if your link exists.

  5. Use

    sURL = objTargetLink.GetTOProperty("url")

    to retrieve the actual url. You may get other properties the same way.

  6. Use objTargetLink.Click to click on the link.

PS. Functional Test Automation is something different, though. Ask your testing team to read about automation frameworks and automation requirements. I have some stuff on my blog. http://automation-beyond.com/2009/06/06/qa-test-automation-requirements-usability/

Thank you, Albert Gareev

http://automation-beyond.com/

Albert Gareev
Great answer, the only thing is I think that QTP anchors the beginning and end of properties so you may have to use `"id:=.*target_id.*"` instead of Albert's suggestion.
Motti
Thanks - we'll give this a go. The issue I think we'll have is that our testing team is looking for a tool which can be mainly point and click. This seems OK for basic stuff. But it seems we've got to drop down to code if you want to do anything trickier. Our testers aren't developers - they are pure functional testers. So I'm not sure how much mileage we'd get out of QTP. Is this a fair comment or am I doing a disservice to the tool?
A_M
A_M, test automation really needs to be treated as software development. As you have already noticed the need to "drop down to code". So you are not going to get great mileage out of any automation tool without programming skills. This may require developers to help out, or adding staff with some decent programming chops to be able to build a robust and maintainable automation suite.
Tom E
Motti, didn't get you about "QTP anchors the beginning and end of properties".. If "target_id" should be exact and not regex why make a regex from it?I've just tried a minute ago:Browser("Google").Page("Google").WebButton("name:=Google Search").ClickBrowser("Google").Page("Google").WebButton("name:=Google Se.*").ClickBOTH ways work.
Albert Gareev
A_M, any "point and click" ( = "record/playback") is always use-once. Creation cost is low but flexibility is near zero and maintenance cost is huge. That is why if you have major problems with scripts just throw them away and record from scratch... but don't expect good coverage anyway.PS. Tom E, strongly agree, voted up - they really need an automation developer in the team, and they'll have to invest in framework first.
Albert Gareev
As a new 'automation developer', I concur with @Albert Gareev - QTP is all right for this purpose, I think, although I'm not the biggest fan of VBScript.
Riddari