I've been playing around with trying to get the groovy-core and
all of its tests build using Maven2... but I keep running into
problems with surefire, where it sometimes does not show "Running
<testcase>" for anything.
I've see something like this too, where it dosen't show anything
at all:
<snip>
[INFO] [surefire:test]
[INFO] Surefire report directory: /Users/jason/ws/groovy/groovy-
core-reorg/groovy-core/target/surefire-reports
[INFO]
---------------------------------------------------------------------
---
[ERROR] BUILD FAILURE
[INFO]
---------------------------------------------------------------------
---
[INFO] There are test failures.
[INFO]
---------------------------------------------------------------------
---
</snip>
As well as partial output:
<snip>
[INFO] [surefire:test]
[INFO] Surefire report directory: /Users/jason/ws/groovy/groovy-
core-reorg/groovy-core/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running groovy.lang.ScriptTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.675 sec
Running org.codehaus.groovy.classgen.VerifierCodeVisitorTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.011 sec
Running groovy.xml.dom.DOMCategoryTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
2.487 sec
Running org.codehaus.groovy.control.CompilationUnitTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.005 sec
Running groovy.bugs.NestedClosure2Bug
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
1.227 sec
Running groovy.MethodParameterAccessWithinClosureTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.414 sec
Running groovy.BooleanOperationTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.36 sec
Running groovy.sql.SqlCompleteWithoutDataSourceTest
Tests run: 11, Failures: 0, Errors: 1, Skipped: 0, Time elapsed:
1.053 sec <<< FAILURE!
Running groovy.tree.VerboseTreeTest
[INFO]
---------------------------------------------------------------------
---
[ERROR] BUILD FAILURE
[INFO]
---------------------------------------------------------------------
---
</snip>
It doesn't even show what happened to VerboseTreeTest... just
output ends.
I can get output when forkMode is never, but that doesn't help
since I need to force, and would like to forkOnce.
It seems like some of these tests are spitting out some extra
output before the tests even run too, which may be confusing
surefire? For example a few test cases have constructor methods
that System.out.println() via the println keyword in Groovy. This
seems to throw off the output I see when running mvn.
For example 2 classes have constructors that have:
println "Hey"
And when run with forkMode never, I get output like:
<snip>
[INFO] [surefire:test]
[INFO] Surefire report directory: /Users/jason/ws/groovy/groovy-
core-reorg/groovy-core/target/surefire-reports
Hey
Hey
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running groovy.lang.ScriptTest
succeeded
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.232 sec
Running org.codehaus.groovy.classgen.VerifierCodeVisitorTest
Caught invalid exception:
org.codehaus.groovy.syntax.RuntimeParserException: Invalid
variable name. Must start with a letter but was: 1.
Node: org.codehaus.groovy.ast.ASTNode. At [-1:-1]
Caught invalid exception:
org.codehaus.groovy.syntax.RuntimeParserException: Invalid
variable name. Must start with a letter but was: 100.
Node: org.codehaus.groovy.ast.ASTNode. At [-1:-1]
Caught invalid exception:
org.codehaus.groovy.syntax.RuntimeParserException: Invalid
variable name. Must start with a letter but was: 1a.
Node: org.codehaus.groovy.ast.ASTNode. At [-1:-1]
Caught invalid exception:
org.codehaus.groovy.syntax.RuntimeParserException: Invalid
variable name. Invalid character at position: 2 of value: ! in
name: a!.
Node: org.codehaus.groovy.ast.ASTNode. At [-1:-1]
Caught invalid exception:
org.codehaus.groovy.syntax.RuntimeParserException: Invalid
variable name. Invalid character at position: 2 of value: . in
name: a..
Node: org.codehaus.groovy.ast.ASTNode. At [-1:-1]
Caught invalid exception:
org.codehaus.groovy.syntax.RuntimeParserException: Invalid
variable name. Must start with a letter but was: $.
Node: org.codehaus.groovy.ast.ASTNode. At [-1:-1]
Caught invalid exception:
org.codehaus.groovy.syntax.RuntimeParserException: Invalid
variable name. Must start with a letter but was: $foo.
Node: org.codehaus.groovy.ast.ASTNode. At [-1:-1]
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.001 sec
Running groovy.xml.dom.DOMCategoryTest
</snip>
If I change the forkMode to once, then I don't see any output past
where the report directory is. If I go and comment out those
println "Hey" lines, then output gets further, but still stops
(see the partial output that ends with "Running
groovy.tree.VerboseTreeTest" above.
This is *very* bizarre that the output of a testcase has such an
effect on the output of the surefire plugin.
This seems to happen with surefire 2.3 when
redirectTestOutputToFile is true.
It would really be nice to get redirectTestOutputToFile working
with forkMode once... and have it reliably capture the tests output.
Anyone run into this problem before?
--jason