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

Your Points Tracker
Challenges
Leaderboard
  • 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
Recognition
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?
Kudos
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

Bitbucket Pipelines marked as success even if one test failed

I have a test project that runs tSQLt tests on a separate service running the MSSQL 2017 server image.

The tests run correctly, and the output is in a correct XML format.

But even though one test failed:
test_detected_and_failed.png

The pipeline is still marked successful:
pipelines_success.png

What am I missing here?

Thanks in advance for the help!

1 answer

1 accepted

1 vote
Answer accepted

Hi,

A Pipeline is marked as success or failed based on the exit code of all the commands set. So if your command has the exit code 0, we will still mark that as successful. Most tools will return a non-zero exit code when a test fails. Perhaps you can configure your tool to have a different exit code.

The test output shown is read straight from the xUnit XML output. It doesn't influence the final result of the pipeline.

Thanks,

Phil

Hi Phil,

Thanks for the answer! I am now able to have the Pipeline fail when a test fail. And if you do not mind, I have a follow-up question.

Currently my (simplified for the example) steps are:

# Run all tests
sqlcmd -b -Q "EXEC tSQLt.RunAll"
# Generate XML reports
sqlcmd -Q "EXEC tSQLt.XmlResultFormatter" -o test-reports/tsqlt.xml

Because I use the sqlcmd utility with the "-b" option, the first line returns an exit code different than 0.

But then I cannot execute the next steps (generate the reports). Do you have any idea how to solve this?

Regards

Andreas

As a workaround, I am using the following steps:

# Run all tests without the "_b" option, to not stop on errors
sqlcmd -Q "EXEC tSQLt.RunAll"

# Generate XML reports
sqlcmd -Q "EXEC tSQLt.XmlResultFormatter" -o test-reports/tsqlt.xml

# And finally, run all tests again, this time with the "-b" option, to make Pipelines fail if there is any error
sqlcmd -b -Q "EXEC tSQLt.RunAll

Suggest an answer

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

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

366 views 2 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