I have a Robot Framework project with API and E2E tests. The default pipeline that execute the API tests first, and then the E2E tests stops running if the API tests got a error. I'd like to to execute all pipelines, even if some returns errors. So, each pipeline will be executed and return the respective result of its execution separately. How can I do that?
I've tried the following approaches:
1:
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "One or more API tests failed."
else echo "All API tests passed."
fi
exit $RESULT
2 using a subshell block:
if [ $RESULT -ne 0 ]; then
echo "One or more API tests failed."
fi
exit $RESULT )
- echo "API tests completed, proceeding to E2E tests."
I have a Robot Framework project with API and E2E tests. The default pipeline that executes the API tests first, and then the E2E tests stop running if the API tests got an error. I'd like to execute all pipelines, even if some return errors. So, each pipeline will be executed and return the respective result of its execution separately. How can I do that?
Hi @Bruno Vinicio Araújo do Carmo and welcome to the community!
Each pipeline is executed independently, I assume you are talking about different steps of the same pipeline?
If so, the default behavior is that a step will fail if a command of this step's script returns a non-zero exit code and then the pipeline will also fail and the rest of the steps won't run.
However, it is possible to configure the on-fail strategy for a step as ignore. If you configure this for a step and that step fails, the failure will be ignored by the overall pipeline, and the remaining steps will continue running. Please keep in mind that if the rest of the steps finish successfully the status of the pipelines will be marked as successful.
This feature is documented here:
This is an example from our documentation (I highlighted in bold the necessary options for this config):
pipelines:
default:
- step:
# The outcome of this step will be ignored
name: 'Run linting'
on-fail:
strategy: ignore
script:
- npm install
- npm run lint
- step:
# This step will always be executed regardless the outcome of the previous step.
name: 'Run tests'
script:
- npm install
- npm run test
In this example, if the first step named 'Run linting' fails, then the second step will still run.
Does this work for you?
Kind regards,
Theodora
Hi, Theodora!
It worked for me! Thank you so much!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's good to hear and you are very welcome!
Please feel free to reach out if you ever need anything else!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.