[GRADLE-539] When test fork mode is set to ONCE, Gradle no longer displays which tests failed Created: 11/Jul/09  Updated: 04/Jan/13  Resolved: 24/Nov/10

Status: Resolved
Project: Gradle
Affects Version/s: 0.6.1
Fix Version/s: 0.9-rc-1

Type: Bug
Reporter: Peter Niederwieser Assignee: Tom Eyckmans
Resolution: Fixed Votes: 0


When I add the following to build.gradle...

test {  
  options.fork(forkMode: ForkMode.ONCE)    

...I no longer see which tests failed (e.g. [ant:junit] Test Foo FAILED). Adding options.showOutput = true doesn't help. For tests written in Groovy this is an even bigger problem because they default to ForkMode.ONCE.

Comment by Tom Eyckmans [ 12/Jul/09 ]

Hi Peter,

I'm unable to simulate the behavior you describe here on linux, I'll ask Hans if he is able to simulate it on his Mac.

Comment by Tom Eyckmans [ 13/Jul/09 ]

Can you try and simulate this in your Mac ?

Comment by Hans Dockter [ 17/Jul/09 ]

Hi Peter,

I have used the samples/groovy/quickstart and samples/java/quickstart projects as examples. I added the above line to the test configuration (for Groovy it is default anyway). I made the test of those projects fail. I still have the console output. [ant:junit] Test org.gradle.PersonTest FAILED.

Could you provide as test case where this is not the case. Or could you use the examples above and check on your machine.



Comment by Peter Niederwieser [ 18/Jul/09 ]

Instead of editing PersonTest, add a second test class with a failing test to the Groovy quickstart project. The output is "[ant:junit] Tests FAILED" (i.e. it's not possible to tell how many and which tests failed). Next use ForkMode.PER_TEST and observe how the output changes.

Comment by Hans Dockter [ 31/Aug/09 ]

I can reproduce this problem. If there is more than one test case and the fork mode is once, Gradle does not display any longer which test is failing. This is the case for Java and Groovy projects.

Comment by Hans Dockter [ 31/Aug/09 ]

Hi Tom, I assign this issue to you, as this is probably fixed by the native test runners anyhow.

Comment by Tom Eyckmans [ 23/Sep/09 ]

When running with fork mode once the "TEST xxx FAILED" logging gets log level INFO, because of this it is not logged anymore. When running gradle with log level INFO or even more verbose the "TEST xxx FAILED" logging is show.

I have to check why this is getting log level INFO, I suspect that the BuildEvent passed to the AntLoggingAdapter really has log level INFO, if so the only option to fix this before the native test runners are in place to check for taskname "junit", log message needs to start with "TEST" and end with "FAILED" and in this case force log level WARN.

Comment by Tom Eyckmans [ 22/Oct/09 ]

for some reason the loglevel of the event that we receive in the org.apache.tools.ant.BuildLogger.messageLogged is different when executing with fork mode once, added an dirty fix to solve this issue.

Comment by Peter Niederwieser [ 22/Oct/09 ]

Thanks Tom! Was eagerly awaiting this fix.

Generated at Wed Jun 30 11:32:41 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.