SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8

Thread: TOString

  1. #1
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    TOString

    Been doing some digging in QTP and its spawned a question, anyone had to use the TOString method, if so why?

    Mark Smith.

  2. #2
    Member
    Join Date
    Jan 2008
    Posts
    93
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TOString

    Reporter.ReportEvent micFail, "ERROR: Page Not Displayed", oFullPageName.ToString

  3. #3
    Senior Member
    Join Date
    Apr 2008
    Posts
    187
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TOString

    For some of our Java apps, we use it all the time to debug the object types/class.

    [Edit] I suppose I should expand on this a bit. For example, most of our Java classes are extended. QTP will recognize something like a JList or JavaList, when in all actuality, it's something like a JSearchableComboBox. The standard methods for JavaLists (in this example) will not work. So, we simply get the object, do something like Object.toString in the debug, and then we can see what object it is. Of course, you can also get this information from spying, but we also need to know programatically so we use the right methods to set (or get) the values.

  4. #4
    Member
    Join Date
    Oct 2003
    Location
    Norfolk, VA
    Posts
    360
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TOString

    I use it to extract from generated XML that, in turn, gets fed into my AUT as a parameter. It was just easier than creating my own node tags.
    A good rule of thumb is to never measure with your thumb.

  5. #5
    SQA Knight
    Join Date
    Jul 1999
    Location
    Grand Rapids, MI
    Posts
    3,727
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TOString

    It seems to be a dice roll as to what this method (or is it a Property?) returns. Or maybe its better stated that it seems to return different strings (sometimes empty), depending on the object. I also found that attempting to use it on some .NET objects caused an exception to be thrown, so you might be wise to encapsulate its use in an On Error... construct.

  6. #6
    Senior Member
    Join Date
    Apr 2008
    Posts
    187
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TOString

    [ QUOTE ]
    It seems to be a dice roll as to what this method (or is it a Property?) returns. Or maybe its better stated that it seems to return different strings (sometimes empty), depending on the object. I also found that attempting to use it on some .NET objects caused an exception to be thrown, so you might be wise to encapsulate its use in an On Error... construct.

    [/ QUOTE ]

    Good point. Sometimes I've tried it on an object that doesn't support this method (whcih is weird IMO), so I had to find another creative way to get the debug info that I needed. It's useful if it's supported.

  7. #7
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TOString

    Thanks all.

    Mark Smith.

  8. #8
    Member
    Join Date
    Jun 2007
    Posts
    80
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TOString

    The ToString method is found in every class (whups, and structs also) derived from System.Object. It should return "a String that represents the current Object", but that is up to the implementers to do, and they could let it throw an exception.

 

 

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 10.00%
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 12:11 AM.

Copyright BetaSoft Inc.