Setting max Threshold for test case execution in gradle builds


I am trying to set max threshold on test cases execution in Gradle build files, i.e. lets say I have set a max threshold of 10 seconds for test cases, then build should fail the test case, if the test case takes more than 10 seconds.

Is there any configuration or plugin in Gradle to do that ?

This is something that can be done within most test frameworks I suspect.

Yeah, we can do in Test frameworks. I am looking for a option to set in gradle build file.
Is there any such configuration that can be set on test case execution.

You could build something like that based on the beforeTest and afterTest API.

I don’t believe you can fail an individual test using the test listener API. You would have to fail the whole test task.

You’re right, I misunderstood the question. You’d fail the whole build, yes.