Skip to content
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

Set exit code status according to sitespeed test command errors criteria #3667

Closed
vs-odessa opened this issue May 27, 2022 · 5 comments
Closed

Comments

@vs-odessa
Copy link
Contributor

vs-odessa commented May 27, 2022

Currently, by default sitespeed test always has the successful exit status code 0 despite any errors that occurred during commands execution (navigate, click, wait by, etc.).
So, if something went wrong (for example, some web element can't be found or clicked) - eventually we get a successful test run anyway.
As I see, the exit status code can be managed by different criteria using budget configuration only:
https://www.sitespeed.io/documentation/sitespeed.io/performance-budget/
But there's no option for how to handle command errors themselves.
Am I missing anything in the documentation?

In total, I'd like to:

  • Set eventual exit status code depending on errors in test execution.

  • Stop tests execution on getting a specified number or percentage of errors.

Is it possible with existing features?

@vs-odessa vs-odessa changed the title Set exit code status according to sitespeed test command errors criteria Set exit code status according to sitespeed test command errors criteria? May 27, 2022
@vs-odessa vs-odessa changed the title Set exit code status according to sitespeed test command errors criteria? Set exit code status according to sitespeed test command errors criteria May 27, 2022
@soulgalore
Copy link
Member

Hi @vs-odessa if you create an error in your scripting https://www.sitespeed.io/documentation/sitespeed.io/scripting/#error-handling sitespeed.io will exit with an error (I need to update the documentation), is that something that works for you?

@vs-odessa
Copy link
Contributor Author

Hi @soulgalore Hmm, it works, but somehow it was suppressed by the following code and turned again to 0, will investigate it...
What is the expected behavior after setting a custom error - should it continue next steps in iteration, start a new iteration, or completely stop the test run?

@soulgalore
Copy link
Member

Aha I see. It actually continues on with the next iteration, maybe we should make that configurable.

@soulgalore
Copy link
Member

This took some time, sorry. With #4044 I've changed so that if the exit code is set within sitespeed.io it doesn't change. So in your script if you want to make the run as a failure you can set process.exitCode = 1;

That would at least help to get CI:s to fail.

@soulgalore
Copy link
Member

Since the latest release you can use https://www.sitespeed.io/documentation/sitespeed.io/scripting/Commands.html#markAsFailure and the exit code will be an error or you can choose to set the process.exitCode in your script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants