Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Pipeline fails even if PHPUnit tests pass

Miroslav Kodet February 20, 2025

PHPUnit tests pass (with warnings) and pipeline fails:

Searching for test report files in directories named [test-results, failsafe-reports, test-reports, TestResults, surefire-reports] down to a depth of 4
Found matching test report file /opt/atlassian/pipelines/agent/build/test-reports/junit.xml
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 5 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 3 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 3 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 12 tests, with 0 failures and 0 errors.
Located test suite containing 4 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 3 tests, with 0 failures and 0 errors.
Located test suite containing 4 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 3 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 4 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 7 tests, with 0 failures and 0 errors.
Located test suite containing 5 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 3 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 1 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 2 tests, with 0 failures and 0 errors.
Located test suite containing 3 tests, with 0 failures and 0 errors.
Finished scanning for test reports. Found 1 test report files.
Merged test suites, total number tests is 98, with 0 failures and 0 errors.
Uploading test results
Finished uploading test results.

 

OK, but there were issues!
Tests: 98, Assertions: 339, Warnings: 2.

 

what could be the problem? Retun code? 

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 21, 2025

Hi Miroslav and welcome to the community!

Is there any error on the build's page, in the column right next to the build log, like in the screenshot below?

671a0464-5813-4504-82d3-0eb193a253a9.png

If not, and if all the commands of that step run, then I believe the most likely reason is that the last command returns a non-zero exit code.

If you have Docker installed on your computer, you can troubleshoot the failed step locally with Docker as per the following guide:

While on Step 5, after you run all the commands of your step, you can use the command echo $? to check what exit code the last command returns.

Kind regards,
Theodora

Miroslav Kodet April 1, 2025

Hi @Theodora Boudale 

Thanks a lot for your reply. I had to mute the unit test script completely to not receive any return code at all.

 

Miroslav Kodet April 1, 2025

Even after muting the output the steps fails 

Screenshot_3.png

Miroslav Kodet April 5, 2025

After some debugging the reason was found in depraction warning which return non-zero result also.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 14, 2025

Thank you for the update, Miroslav. A non-zero exit code would indeed cause the step to fail.

We have a feature that allows a pipeline to continue with the next steps if a certain step fails. If you'd be interested in that, you can check the feature's documentation here:

Otherwise, you'd need to adjust the test script so that it doesn't return a non-zero exit code in case of warnings (if this is how you'd like the script to behave).

Kind regards,
Theodora

Miroslav Kodet April 14, 2025

that's excellent, didn't knew about it. thanks a lot.

Like Theodora Boudale likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events