SPONSORS:






User Tag List

Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    Sep 2000
    Location
    ca
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Silk and Text based Result logs

    I don't believe you can "automatically" produce text-based result logs from Silk's UI. Here's a work around I wrote:

    This function simultaneously prints to the Silk .RES file as well as to a .TXT file so that you can:

    Mail test results to people who don't have Silk. I know about the Extract command in Silks UI but that requires manually generating the text file from a .res file. For those of us who run automation overnight it is nice to have a way to automatically generate a text-based result file. Segue Should add an option in the Runtime dialog to optionally produce a .TXT result file.


    Results can be viewed while the Silk script is running.


    This function creates a text file of the same name. For example, if you have a script called MYTEST.T it will produce a MYTEST.RES file. If you replace your print() statements with PrintToTextLog() the MYTEST.T script will produce the MYTEST.RES file as well as the MYTEST.TXT file.


    //*******************************************
    //function: PrintToTextLog(string sDesc)
    //description Prints to .res as well as to // .txt file
    //file: Library3.inc
    //*******************************************
    PrintToTextLog(string sDesc)
    {
    list of string lsOutput;

    string sDir = GetProgramDir();
    string sFile = GetProgramName();
    string sTextFile = "{sDir}\{left(sFile,len(sFile) - 2)}.txt";


    /* print to Silk .res file */
    Print(sDesc);


    /* simultaneous print to text file */
    do
    {
    if SYS_FileExists(sTextFile)
    listread(lsOutput,sTextFile);

    listappend(lsOutput,sDesc);
    listwrite(lsOutput, sTextFile);
    }
    except
    LogError("FAIL - Error printing to text log: {ExceptData()}");
    }



    Please let me know if there is a better way to do this. --Tony

  2. #2
    jb
    jb is offline
    Junior Member
    Join Date
    Sep 1999
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Silk and Text based Result logs

    Or you can use the ResExportOnClose function in 4Test. Additionally, you could call the script from the command line with the -resexport option. They will generate text renditions of the results file automatically.

  3. #3
    Junior Member
    Join Date
    Sep 2000
    Location
    ca
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Silk and Text based Result logs

    I've tried ExportResOnClose() but all it dumps out is a comma-delimited text file containing only the top line of the testcase. This is a sample export I have:

    #basepath C:\automate\Haiku
    #results dailybuildreport.res
    #fields TestPlan Script TestCase TestData ErrorCount ErrorText DateTime Elapsed
    #delimiter ,
    #quote " \

    "","C:\automate\Haiku\dailybuildreport.t","","",1, "","1999-10-18 12.39.58","0:17:37"

    Correct me if I'm wrong but it does not display your print() statements contained within your testcases.

  4. #4
    Junior Member
    Join Date
    Oct 1999
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Silk and Text based Result logs

    To go a step further, how would you automatically email the results text file to a number of people? After a nightly automation run. That way we can view the overnight emailed results file, first thing in the morning.

  5. #5
    Junior Member
    Join Date
    Aug 1999
    Location
    mt view, Ca
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Silk and Text based Result logs

    Tony,
    Here is some easy code to generate results in an external file. I posted a message a couple of weeks ago due to what Segue admitted was a bug in SetBaseState(), so call this code ahead of it when you override DefaultTestCaseExit(). Good Luck!
    Len Jagelski
    Lotus cc:Mail

    [This message has been edited by Len Jagelski (edited 11-08-1999).]

    [This message has been edited by Len Jagelski (edited 11-08-1999).]
    Len Jagelski
    Automation Engineer
    Lotus, cc:Mail

  6. #6
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Silk and Text based Result logs

    I have actually replaced all of my Print statements with a Log() statement. The log function is my own creation which performs logging to one or more text files, while at the same time printing the results to the results file.

    Here is a sample output:

    If intersted, I could probly get AJ to put the files in the download section of betasoft.


    ------------------
    David Genrich
    Icarian
    333 Moffett Park Drive
    Sunnyvale, CA 94089
    davidg@icarian.com



  7. #7
    Senior Member
    Join Date
    Jul 2002
    Location
    Paris (France)
    Posts
    182
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Silk and Text based Result logs

    For those of you that have asked for it, I have posted my Log() function library in the BetaSoft download section.

    Here is a brief overview:
    ---------------------------
    Contains all functions necessary to create and manipulate log files, and logged results. The user may open any number of named logs, and access them through a handle that is returned to them. It also log all information to the Results window that is built in to Silk. Also includes functions to easily read and
    write to INI files. Plus, adds the Join/ Split functions to 4Test.

    FEATURES:
    1. Have multiple log files open
    2. Log to any of the current logs
    3. Also logs to the SilkTest Results file
    4. Append files to your log file
    5. Can handle Lists

    PLUS... The Utility File
    6. Read/ Write to INI files with ease
    7. Add a Split/ Join functions to 4Test


    HOW TO USE:
    Run the sample testcases in log_test.t

    What I have done is replaced all my Print() statements with Log() statements.
    The general format is:

    LOG ("the message you want", "header", whichLog)

    if whichLog is NULL, then it uses the last one opened.

    If the "header" is set to "ERROR", an error is logged in the result file.
    If the "header" is set to "WARN", a warning is logged in the result file.
    Any other header will just print out, but only the first 8 characters.

    Log files can be appended to or start fresh, your call when starting.
    See the log_test.t file for examples.


    Have fun!



    ------------------
    David Genrich
    Icarian
    333 Moffett Park Drive
    Sunnyvale, CA 94089
    davidg@icarian.com



  8. #8
    Junior Member
    Join Date
    Aug 1999
    Location
    Boston, MA
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Silk and Text based Result logs

    At our shop, we handle this a different way ...

    o For smoke and automated regression runs,
    we run our Silk modules and suites from
    the command line. We use the command
    line option to do a resexport.
    o We use the unix command 'strings' to dump
    the contents of the result file
    o We parse the resexport file to create the
    summary for the email message we send out
    which contains the results of running
    strings on the result file
    o We use the Cygnus windows toolkit to get
    strings (and other unix commands) on NT

    ------------------
    John McGrail
    John McGrail

  9. #9
    Junior Member
    Join Date
    Oct 2000
    Location
    Dublin, CA, USA
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Silk and Text based Result logs

    Sir,

    As paer your above discussion, I tried converting result .res file into text .txt file through above program, but It don't work, what should I assign to "sDesc" ?
    I think it should be .res file, right? Please help if you know where I'm doing mistake. shafi (ssyed@pixion.com)

    [-] main ()
    [ ] integer i
    [-] for (i=1; i<=1; i++)
    [ ] PrintTextFile ()
    [ ]
    [-] testcase PrintTextFile () appstate none
    [ ]
    [ ] string sDir = GetProgramDir()
    [ ] string sFile = GetProgramName()
    [ ]
    [ ]
    [ ] //string sDesc
    [ ] string sDesc = "{sDir}\{left(sFile,len(sFile) - 2)}.res"
    [ ] print ("step 1")
    [ ] PrintToTextLog (sDesc)
    [ ]
    [ ]
    [+] PrintToTextLog (string sDesc)
    [ ]
    [ ] list of string lsOutput
    [ ]
    [ ] string sDir = GetProgramDir()
    [ ] string sFile = GetProgramName()
    [ ] string sTextFile = "{sDir}\{left(sFile,len(sFile) - 2)}.txt"
    [ ]
    [ ] /* print to Silk .res file */
    [ ] Print("sDesc :",sDesc)
    [ ] Print ("sDir :",sDir)
    [ ] Print ("sFile :",sFile)
    [ ] Print ("sTextFile :",sTextFile)
    [ ]
    [ ]
    [ ] /* simultaneous print to text file */
    [-] do
    [ ]
    [-] if (SYS_FileExists(sTextFile))
    [ ]
    [ ] listread(lsOutput,sTextFile)
    [ ] listappend(lsOutput,sDesc)
    [ ] listwrite(lsOutput, sTextFile)
    [ ]
    [-] except
    [ ] LogError("FAIL - Error printing to text log: {ExceptData()}")
    [ ] print ("finished")
    [ ]
    [ ]
    [ ]
    [ ]


    ------------------
    HyderFatima

  10. #10
    Senior Member
    Join Date
    Jul 1999
    Location
    Bellingham, WA USA
    Posts
    1,323
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Silk and Text based Result logs

    Hyder,

    The original post was from November of '99, so you might not get a response from Tony on this.

    After looking at what he's doing, it appears to me that he is wanting sDesc to be the string of text to be output to a text file. If I were to use this, I would override the built in Print() method in Silk (which we do anyway) and pass whatever string of text I want to go to the results file into this function simultaneously. This function, then opens the txt file and appends the current string to the end and writes the file out again. A bit of overhead, but it should work if you're not concerned with performance issues.

    ------------------


    [This message has been edited by DJGray (edited 06-13-2001).]

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin 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 04:20 PM.

Copyright BetaSoft Inc.