Skip navigation
Currently Being Moderated

Receiving trace()-statements in the TestRunner

Mar 17, 2010 5:43 AM

First of all I would like to say I am totallynew to the use of unit testing in general. I am currently evaluating FlexUnit and using the TestRunner.mxml for running the tests. I am only curious how I can let the FlexUnit ant task also show my trace()-statements. Because that makes it easier to fix issues in the code. Now I need to switch the normal application and compile it to check the trace output in the console. Only for working on the implementation and/or fixing one unit test case.

 

Anyone happen to have some ideas or suggestions how to get this going?

 
Replies
  • Currently Being Moderated
    Mar 17, 2010 8:33 AM   in reply to wdeboer

    You should be able to run the FlexUnit runner in debug mode and get all your normal trace statements from the code that is involved with testing.

     

    Am I missing something about your workflow?

     

    HTH

    sim

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 17, 2010 10:15 AM   in reply to wdeboer

    Ah, see now I get it. I missed that you were using ANT in the first reply.

     

    When using the Stand Alone player you wont get trace output in the command line where the ANT task is running.  You can however configure Flash Player to output the trace statement using a trace file.  It has to do with setting up your mm.cfg file and telling it where to put the output.

     

    At least that is your best bet anyhow.  I have always felt like getting those trace files to work is a vodoo art Maybe someone else will have more input for you on that topic.

     

    HTH

    sim

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 17, 2010 10:39 AM   in reply to wdeboer

    @wdeboer - Try creating a file in your home directory named mm.cfg.  Then try putting the following into that file:

     

    PolicyFileLog=1
    PolicyFileLogAppend=1
    ErrorReportingEnable=1
    TraceOutputFileEnable=1

     

    I think all trace and error output is now directed to the flashLogs.txt file under

    C:\Windows\system32\Macromed\Flash\Logs

    since you're using Windows.

     

    Hope this helps.

     

    -Brian

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 17, 2010 11:36 AM   in reply to wdeboer

    @wdeboer - The integration between Flex/Flash Builder and the Flash movie is much tighter than the integration with the FU4 Ant task.  There is  TextListener in the core that works with the Flex logging framework that you could probably write a UI for to see tests data as it's run.  If you're working with Flex I'd suggest using it over the TraceListener or trace() statements since its more flexible.  If you have time and would like to see something custom, send us a feature request in JIRA and ask others to vote on it.  Best of luck.

     

    -Brian

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2010 7:18 AM   in reply to wdeboer

    @wdeboer - Thanks for offering to dig in, any help is always welcome.  I encourage you to give it a shot, but I'm unsure if you'll be able to get ahold of the trace output stream from the Flash Player since it's decoupled from the Ant task  It's launched indirectly so you don't have a handle to its pid to do anything with the process.  There maybe be a flag to launch the stand alone Flash Player with the trace output dumping to console, but I have yet to find it.  I know there is a way to attach a debugging session to a Flash Player instance which is probably what Flash Builder does it.  Maybe that would be a good option to try out.

     

    If you do have to roll your own thing, we could make a custom socket logger that works with the Ant task and just listens on a separate thread in the Ant task so it can dump to console.  You could probably extend TextListener to make it happend more easiliy; just having to add the socket functionality.

     

    In any case, best of luck.  Let me know if I can be of any help.

     

    -Brian

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2010 8:44 AM   in reply to legrosb

    Weyert,

     

    Could you explain what you are trying to accomplish. Generally using the trace data is not something I would try to do with Unit tests. If you gave us an idea of what you are trying to accomplish we might be able to offier an alternate approach.

     

    Mike

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 24, 2011 11:26 AM   in reply to wdeboer

    A straight forward flexunit task e.g.

    <flexunit player="air"

                      swf="${tests.swf}"

                      todir="${report.dir}"

                      verbose="true"

                      localTrusted="true"

                      workingdir="${output.dir}"

                      />

    with Dconsol ;http://code.google.com/p/doomsdayconsole/

    in your library path will output to the console if you use debug/info/warn/error/fatal() instead of trace()

    import com.furusystems.logging.slf4as.global.debug

    debug("traces!");

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points