New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Is there an option to make the newman execution fail if it did not run any tests? #3164
Comments
Hey @sudhirbits, So, after Newman execution we can use a script to check the number of executed tests from the report. If zero tests were run, set a non-zero exit code for the script, indicating failure. Something like this: # Run Newman and save the result in a variable
NEWMAN_RESULT=$(newman run your_collection.json -e your_environment.json)
# Check if there are any test failures in the Newman result
if echo "$NEWMAN_RESULT" | grep -q "failures="; then
echo "Tests failed."
exit 1 # Exit with a non-zero status to indicate failure
else
echo "Tests passed."
fi Another option could be:While using a CI/CD tool, configure it to fail the build based on the Newman exit code or specific keywords in the output (e.g., "0 tests executed"). hope it helps :) |
Is there an option to make the newman execution fail if it did not run any tests?
The text was updated successfully, but these errors were encountered: