I'm writing some unit tests in eclipse which expect exceptions to be thrown.
I wonder if there is an option to display the stack-trace when a test passes, it would be useful when you are writing test for the first time to check if the exception is been thrown really due to the case you are testing.
thanks!
You shouldn't need to do that.
Use the @Test
annotation with an expected
argument:
@Test(expected=MyAppException.class)
If the test does not throw the exception it's a test failure.
There should be an Eclipse view option to show test logging output, but in general, explicit logging from tests isn't valuable. You can also debug your test if you don't trust the JUnit annotations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With