How do I configure timeout for tests run using the Test task?

How can I specify a test timeout (equivalent functionality to “timeout” in an ant junit task http://ant.apache.org/manual/Tasks/junit.html) when running Junit tests with the Gradle test task?

I’m not aware of an equivalent. You could use JUnit’s @Timeout or time out the build on the CI server.

This seems like a glaring omission.

Setting @Timeout on each test is not practical.

If tests timeout, I don’t want to be sitting there for half an hour waiting for the test suite to complete so I can view the report.

Are there any plans for a better solution?

I saw this: http://issues.gradle.org/browse/GRADLE-1020?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel

Is it related?

From what I understand from the Ant docs, it does not time out individual tests, at least not when forking is used. GRADLE-1020 sounds related but doesn’t provide any details. Feel free to file a detailed feature request.