User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Oct 2008
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)
    Total Downloaded

    Handling variations in identifiers ...

    I'm new to QTP and am having trouble working out this problem.
    I have searched the docs and message board but haven't found a solution.

    I am putting together a script that will have 200 or so iterations with different input parameters.

    This is a model of the script I'd use

    01 Browser("Browser").Navigate "http://test.test.com/"
    02 Browser("Browser").Page("Search Page").WebEdit("ctl00$cplhMainContainer$ctl00$")." Set DataTable("ColorList", dtGlobalSheet)
    03 Browser("Browser").Page("Search Page").WebButton("Search").Click
    04 Browser("Browser").Page("Blue Results").Link("Blue1").Click
    05 Browser("Browser").Page("Blue Details").WebElement("Blue2").Check CheckPoint("Blue3")

    With this data:


    My problem is that with each subsequent iteration, the Page, Link, WebElement and CheckPoint itentifiers on lines 4 and 5 will change based on the input from line 2.
    E.g. "Red" will display Page("Red Results"), Page("Red Details"), WebElement("Red2"), CheckPoint("Red3") and so on.

    Is it possible to set up the script to accommodate the variation in the identifier names , etc?
    I hope it isn't necessary to explicitly list the page names on lines 4 and 5

    Thanks in advance.

  2. #2
    Advanced Member
    Join Date
    Mar 2007
    Salt Lake City, UT, USA
    Post Thanks / Like
    1 Post(s)
    0 Thread(s)
    Total Downloaded

    Re: Handling variations in identifiers ...

    This is a big question, and the answer is pretty much the entire "Advanced QTP" course. Or most of it.

    First, get rid of that checkpoint. Don't use checkpoints at all if you can avoid it. They're a pain in the backside to maintain if your application ever undergoes major changes.

    Replace it with GetROProperty to get the property of whatever object you want to check. Evaluate that property using If..Then..Else and comparing against your expected results (which should probably be another column in your DataTable). Use Reporter.ReportEvent to send Pass/Fail and appropriate text to your test results. This takes a bit more time to implement than simply clicking through the checkpoint wizard, but once you're used to it, it's quick and easy and future maintenance is just a column in the DataTable.

    Now it's time for a class in Descriptive Programming. Your QTP documentation has some good info, and there's lots of info on this webiste, too. Especially look at the stickied topics at the top of the QTP forum.

    Line 4 would become something like this:
    Browser("Browser").Page("title:=" & DataTable("ColorList", dtGlobalSheet) & " Results").Link("text:=" & DataTable("ColorList", dtGlobalSheet) & "1").Click

    Line 5 went away when you stopped using checkpoints and becomes something similar to line 4, but using GetROProperty on your webelement and using descripting programming similar to what I did in line 4 to identify the right webelement.

    That's a lot to digest for your first post, but hopefully this will get you started off on the right foot.

    I leave you with a suggestion that QTP is a wondrous tool indeed, but you almost have to throw away everything the HP salesman told you about QTP in order to use it to its full potential. In other words, the bells and whistles and fanfare about QTP all sing the praises of the stuff that (for the most part) gets in the way of the real power of QTP. Use the bells and whistles when they're appropriate, but also learn how to script without them. Things like keywords, object repositories, and checkpoints can only go so far. And with your explanation of what you're trying to accomplish, you'll be much better off without them - and this forum will teach you how.
    "The last 10% of any software project will take 90% of the budgeted time. The first 90% will take the other 90%"



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.11%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:55 PM.

Copyright BetaSoft Inc.