SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 3 of 3
  1. #1
    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

    does QTP support the "print log" capability?

    For those of you who are WinRunner users...

    There is a non-existant [or poorly] documented feature in WinRunner, that allows you to output debug statements to a special window, titled the "WinRunner Print Log", using the print() function. This capability is especially useful when debugging WR shared TSL libraries [ah, the old world of printf() never seems to die!].

    QTP highlights the keyword "print" when it is typed, but then does not appear to accept any form of a string. Does anyone know if this statement can be used to produce a debugging log? If yes, what is valid syntax?

    -Thanks, Terry Horwath

  2. #2
    Member
    Join Date
    Aug 2001
    Location
    Cambridge, MA, USA
    Posts
    42
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: does QTP support the "print log" capability?

    I don't know of any built-in function like that. Perhaps it gets highlighted because it's generally a reserved keyword although I don't think it is one in VBScript..

    Would something like this help you log:


    Function LogText (Text)

    'Create all objects, variables and constants
    Dim fso,MyFile,filename,fa
    Const ForAppending = 8
    filename="c:\Temp\tryit.txt"
    Set fso = CreateObject("Scripting.FileSystemObject")

    'Open the file for appending, creating it if it does not exist
    If fso.FileExists(filename)=0 Then
    Set MyFile = fso.CreateTextFile(filename, true)
    MyFile.Close
    End If

    Set MyFile = fso.getFile(filename)
    Set fa = MyFile.OpenAsTextStream(ForAppending,True)

    'Write to the file
    fa.WriteLine (Text)

    'Close the File
    fa.Close

    End Function


    Admittedly, I'm new to VBScript, so any tips or advice would be appreciated.

    Hope this helps someone,

    -Alex

  3. #3
    Junior Member
    Join Date
    Oct 2002
    Location
    Fairfax, VA, USA
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: does QTP support the "print log" capability?

    For quick debugging aid use - MsgBox someVariableOfInterest.

    If you want to preserve a lot of info to inspect after a test run, write to the run-time data table and view it in the test results afterwards. Knowledge Base article 24309 gives some example code related to this.

 

 

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.54%
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:46 AM.

Copyright BetaSoft Inc.