Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mark Gradle build unstable in Jenkins when JUnit tests fail

Tags:

I have a Gradle build in Jenkins with various JUnit tests that are executed as part of the build. Now when some of the tests fail the complete build is marked as failed - because Gradle says the build failed.

How can I convince Gradle to succeed the build and then Jenkins to mark the build as unstable? With ant this was no problem at all.

like image 781
Lasrik Avatar asked Dec 01 '11 15:12

Lasrik


People also ask

Why does Jenkins Mark build unstable?

In Jenkins Terminology, an unstable build is defined as: A build is unstable if it was built successfully and one or more publishers report it unstable. For example if the JUnit publisher is configured and a test fails then the build will be marked unstable.

How do I skip test cases in Gradle build?

To skip any task from the Gradle build, we can use the -x or –exclude-task option. In this case, we'll use “-x test” to skip tests from the build. As a result, the test sources aren't compiled, and therefore, aren't executed.


1 Answers

Use the ignoreFailures property in the test task.

apply plugin: 'java' test {      ignoreFailures = true } 
like image 120
lucas Avatar answered Sep 22 '22 07:09

lucas