Re: why don't many test frameworks support file-output?

Discussion in 'Python' started by kanchy kang, Feb 24, 2006.

  1. kanchy kang

    kanchy kang Guest

    I don't think redirecting stdout to a file is a good resolution.
    How to organize the output file is very important.
    in my imagination, there should be one directory "log", where log files are
    saved.
    and, log files should be separated according to some method(for example, one
    test file one log file).

    also, from my point of view, there is one confusion between "log files" and
    normal stdout stream.

    stdout stream is used to display some imediate information, for example,
    "print" statement, or exception also can be outputed to the screen...

    but, stdout stream can't satisfy many requirements...
    for example, in one "big" project, there are many test cases, in which we
    need record many useful data, whether correct or not. how to do this? print
    statement is not a good idea.

    there should be another "stream" to do this. it can record infomation, same
    to stdout or not.
    so, a good log frame will satisfy:
    1) "log" is not the stdout stream.
    2) log files are oganized systematically, not only one big log file.
    3) log information should be written to file imediately, not be delayed
    until one case is finished. why?
    test script writter may not know the test framework. if he/she write one
    test case with many output data(maybe it is necesary), this will consume the
    system memory greatly, ...
    4) also, log directory should be one limited cyclic...for example, from 1 to
    10.
    this will avoid imediate overwriting...sometimes the previous log
    information would be useful.

    ....hehe...

    best regards.


    >From: Benji York <>
    >To: kanchy kang <>
    >CC:
    >Subject: Re: why don't many test frameworks support file-output?
    >Date: Thu, 23 Feb 2006 14:55:07 -0500
    >
    >kanchy kang wrote:
    >>i browsed the following frameworks briefly: nose, OOBTest,
    >>testosterone, py.test, Sancho ... and found out they do support imediate
    >>screen-output only.

    >
    >You can redirect stdout to a file.
    >--
    >Benji York


    _________________________________________________________________
    Express yourself instantly with MSN Messenger! Download today - it's FREE!
    http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
     
    kanchy kang, Feb 24, 2006
    #1
    1. Advertising

  2. kanchy kang wrote:
    >
    > I don't think redirecting stdout to a file is a good resolution.

    Nobody is suggesting:
    python program.py >output
    or
    program.py >output

    What is being suggested is:
    import sys
    import module
    original, sys.stdout = sys.stdout, open('output', 'w')
    try:
    module.main()
    finally:
    result, sys.stdout = sys.stdout, original
    size = result.tell()
    result.close()
    print size, 'bytes written to file "output"'

    If, however, you want everyone else to conform to your personal idea
    of "best practices," then hire them and tell them to do it your way.

    --Scott David Daniels
     
    Scott David Daniels, Feb 24, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. krby_xtrm
    Replies:
    1
    Views:
    475
    Mike Treseler
    Nov 22, 2005
  2. Nick Zdunic
    Replies:
    0
    Views:
    948
    Nick Zdunic
    Nov 5, 2003
  3. kanchy kang
    Replies:
    2
    Views:
    396
    Magnus Lycka
    Feb 24, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,212
    Smokey Grindel
    Dec 2, 2006
  5. gavino
    Replies:
    26
    Views:
    639
    Daniel Dyer
    Oct 30, 2006
Loading...

Share This Page