JUNIT testSuite .. need to print all errors to file .. HELP.

C

chrono

Java newbie here. I have setup a JUNIT testSuite that runs several
test classes.
Each test class has several methods which call many other things.
There is alot of system.out debug info and exception errors that are
printing out to the console.

I need to capture all of this and print it out to a file. I know it's
probably easy but I can't seem to find an easy way to do capture this
data within my testSuite class. Any help would be appreciated ..
thanks in advance!
 
S

Scott Conway

chrono said:
Java newbie here. I have setup a JUNIT testSuite that runs several
test classes.
Each test class has several methods which call many other things.
There is alot of system.out debug info and exception errors that are
printing out to the console.

I need to capture all of this and print it out to a file. I know it's
probably easy but I can't seem to find an easy way to do capture this
data within my testSuite class. Any help would be appreciated ..
thanks in advance!

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#setOut(java.io.PrintStream)
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#setErr(java.io.PrintStream)

You can redirect System.out and System.err to any printstream.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,433
Messages
2,571,683
Members
48,796
Latest member
Greg L.

Latest Threads

Top