Dave's Brain

Browse - Programming Tips - How can I make jUnit print a message when a test fails?

Date: 2014dec2
Language: Java
Product: jUnit

Q.  How can I make jUnit print a message when a test fails?

A.  There are alternate version of most assert functions that will
to just that.  eg:

fail("Test didn't work with parameter=" + parameter); assertEquals("The things are not equal for parameter=" + parameter, thing1, thing2);

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.