Ask coding questions

← Back to all posts
How do I hide Stack Trace from console output for unit tests in Teams for Education?
CatherineWalker (0)

When students run the tests they get my custom message, one useful line stating the expected versus actual, then a whole bunch of stuff that they don't need. The stack trace report makes the console output cluttered and is confusing my students. Specifically in my Team for Education with the built-in test feature, how do I hide the stack trace?

Bookie0 (6261)

According to this StackOverflow page, you can't.


It is not possible to disable all stacktraces. You can disable stracktraces for exception classes that you define yourself, by overriding Throwable.fillInStackTrace() to do nothing. But that won't work for classes that you cannot change.

Check it out for more detail.

Good luck! :D