-
Notifications
You must be signed in to change notification settings - Fork 295
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
non-zero exit code for failures #38
Comments
ACK, what might be worth consideration is what e.g.
|
Thanks for the elaboration. This repo is no longer alive. The follow up now is at https://github.com/RaiMan/SikuliX-2014 If you ever have the chance to check the same with SikuliX version 1.1.1 and report back, I would highly appreciate that. I will try to consolidate the exit behavior with SikuliX version 2. |
Rationale:
By convention non-zero exit codes indicate failure of terminating programs (Wikipedia: Exit status). This is generally done on all systems, but especially important on UNIX systems using a lot of shell scripting. When automating tasks, instead of parsing stdout and stderr, exit codes often give sufficient information for the system administrator ("did my intent work or not?!").
Now let's consider sikuli.
Consider the following sikuli script:
click("does_not_exist.png")
Now let's run it:
So if the PNG file does not exist in the file system, it starts tesseract and somehow an assertion in C is thrown. What about the exit code? 134. So this test case is fine.
Now consider a case where the PNG file exists:
What about stdout and stderr?
What about the exit code? 0. Even though user's initial intent verify correctness of my application could not be met.
Now let a PNG file exist and make it findable on the GUI. Intentionally exit with exit code 3.
And let's see:
What about the exit code? 3. If you remove
exit(3)
from the code, it is zero and if you addexit(3)
, it is 3. Seems legit.And finally consider something like a wrong CLI parameter:
What about the exit code? It is 0.
My point of this issue: Please fix cases 2 and 4 to return non-zero exit codes in case of failure.
Design: Be aware that AFAICS exit codes of
exit(...)
are passed over to Java andSystem.Exit
is called correspondingly. Hence exit codes might collide (i.e. 1 means test case failed as well as exit(1) was called). Nevertheless, this issue should be resolved by convention. For example all sikuli scripts shall not exit with exit code 255, because it is reserved for failing testcases. You might want to consider this backwards-incompatible, but sikuli goes against conventions established by any other established test framework.Code: If think most of this fix needs to be done in SikuliScript. For cases 2 and 4
System.exit(1)
suffices in case of an exception.Btw, I think message
Can't run this Sikuli script
for a script exiting withexit(N)
whereN!=0
is very non-intuitive, because the script was actually run.The text was updated successfully, but these errors were encountered: