<p>By default Jenkins assumes whether the build is <code>SUCCESS</code> or not from build process exit code.</p>

<p>Which means that build exit with <code>code 0</code> considered as SUCCESS, rest all are considered as FAILURE.</p>

<p>If your build step/process exit with <code>code 0</code>, even during the failure case then Jenkins will report the build is <code>SUCCESS</code>.</p>

<p>So I my suggestion is to run the all build steps manually and try to get the exit code on each step (for both PASS and FAIL case).</p>

CC BY-SA 3.0
2017-04-12T09:29:26.250Z
2017-04-12T12:32:52.557Z
2017-04-12T12:32:52.557Z
HamTheAstroChimp
<p>I created a project in Jenkins and set it to run tests on every pushes. but even when one of the pushes does not pass the tests, Jenkins build returns success. How can define failure situation if tests do not pass in Jenkins?</p>

CC BY-SA 3.0
2017-04-12T09:35:07.037Z
Could you [edit] with information on your tests? There are hundreds of testing frameworks which all behave differently, so it's hard to answer definitively without more information on how you're testing your code.
Aurora0001
CC BY-SA 3.0
2017-04-13T04:06:22.787Z
@Aurora0001 ThanQ for your comment, the test framework is written by me in "jsx" for test aftereffect scripts. The problem has been solved by the exit codes.
Mohammad Rezaei
<jenkins><continuous-integration><continuous-delivery>
How to define failure situation on jenkins
Mohammad Rezaei
# How to define failure situation on jenkins

(Asked by: username_0 on 2017-04-12)

I created a project in Jenkins and set it to run tests on every pushes. but even when one of the pushes does not pass the tests, Jenkins build returns success. How can define failure situation if tests do not pass in Jenkins?

**Tags:** jenkins, continuous-integration, continuous-delivery

> **Comments:**
> **username_1**: Could you [edit] with information on your tests? There are hundreds of testing frameworks which all behave differently, so it's hard to answer definitively without more information on how you're testing your code.  
> **username_0**: @username_1 ThanQ for your comment, the test framework is written by me in "jsx" for test aftereffect scripts. The problem has been solved by the exit codes.  

---

## 1 answers

### Answer by username_2 on 2017-04-12. Score: 6 | Accepted answer

By default Jenkins assumes whether the build is `SUCCESS` or not from build process exit code.

Which means that build exit with `code 0` considered as SUCCESS, rest all are considered as FAILURE.

If your build step/process exit with `code 0`, even during the failure case then Jenkins will report the build is `SUCCESS`.

So I my suggestion is to run the all build steps manually and try to get the exit code on each step (for both PASS and FAIL case).


---

