Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Create a GroovyTestcase with an assertion failure (ie assertTrue(false)) and then run the test. You'll note that the stack trace is unsanitized, resulting in a long stack trace to debug:
1) testMatches(tests.SomeTest)junit.framework.AssertionFailedError at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at ...
What's needed to solve this problem is a GroovyResultPrinter, which can be passed to TestRunner, with the following method:
protected void printDefectTrace(TestFailure booBoo) { delegate.writer.print( BaseTestRunner.getFilteredTrace( StackTraceUtils.deepSanitize(booBoo.thrownException()))) }
When running only 1 test, it makes more sense to dump the test's output (logger is setup to dump it anyway which mucks up the JUnit output). A single ".F" isn't very informative. To solve that problem, simple add the following methods to ResultPrinter as well:
void addError(Test test, Throwable t) {} void addFailure(Test test, AssertionFailedError t) {} void endTest(Test test) {} void startTest(Test test) {}
Attachments
Issue Links
- is related to
-
GROOVY-4067 groovy stacktrace cleanup
- Closed