Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

After unit tests fail, run a step / add a process to teardown

As the title states.

Using phpunit, with selinium, headless chrome.

During unit tests, if any test fails, a screenshot is made of the issue. These are stores in a folder, which I want to upload to S3 bucket (as per existing guides), which would allow to see browser view at the point of test fail.

The issue I have is that teardown runs, after phpunit fails, which skips any further script actions.

I also tried to set the copy part as a second step, which also does not run.


So, is there a way to run steps/script actions prior/during teardown?

1 answer

1 accepted


My mistake was to run the unittest command directly in the pipeline yml

I created a bash script, which runs the unittests, capture the result.
If the result is a fail, I create a 'flag file' (tried to set an environment variable, but that did not work)

The bash script always exits with 0 (no error)

If the 'flag file' exists (in later steps) I can do needed actions


./vendor/phpunit/phpunit/phpunit --fail-on-warning --log-junit ./test-reports/junit.xml -c tests/phpunit.xml.dist --testsuite Admin
set RESULT=$?
if [ $RESULT -ne 0 ]; then
echo $RESULT >>./testdata/testfailed.txt
exit 0


The last step in yml:


- if [ ! -f ${BITBUCKET_CLONE_DIR}/Magium/testdata/testfailed.txt ]; then /bin/true; else /bin/false; fi 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

Bitbucket Pipelines Runners is now in open beta

We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...

754 views 15 10
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you