tags:

views:

108

answers:

2

hello I've write a junit test with eclipse , to check the Gui component status ,I use assert : textfield.assert("expected message") i'm searching how to get the error message printed by assert the message saying that the expected text doesn't match th typed text is printed in the eclipse console I like to get this message to generate a report is there an easy mean, my be a junit method ?

A: 
int a = 0;
int b = 1;
AssertEquals("The value of A is not equal to the value of B", a, b);

The error message should be printed to the console when you run the above.

If AssertEquals does not meet your needs, you can use AssertTrue, or any of the other methods in the JUnit API.

Vladislav
thanks, but my aim is to get the message printed in the console and print it in a created file
Do you only want your JUnit output printed to a file, or all your console output?Because if what you're looking for is the former, you can just redirect your foo.class output, by running "javac foo > foo.log" from the command prompt.
Vladislav
A: 

It sounds like you want to add your own JUnit RunListener.

ShiDoiSi