Skip to content

Robot script returncode could inform if execution has been stopped by signal #3325

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

Open
jamofer opened this issue Oct 3, 2019 · 4 comments · May be fixed by #3329
Open

Robot script returncode could inform if execution has been stopped by signal #3325

jamofer opened this issue Oct 3, 2019 · 4 comments · May be fixed by #3329

Comments

@jamofer
Copy link

jamofer commented Oct 3, 2019

After stop robot by signal returncode could be for example: STOPPED_BY_USER rc (253).

I think returning the number of failed test cases in this scenario is not the expected result. What do you think?

Current behavior:

(venv) jamoh@jamoh /tmp$ robot example_suite.robot 
==============================================================================
Example Suite                                                                 
==============================================================================
Test Example                                                          ^CSecond signal will force exit.
Test Example                                                          | FAIL |
Execution terminated by signal
------------------------------------------------------------------------------
Example Suite                                                         | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  /tmp/output.xml
Log:     /tmp/log.html
Report:  /tmp/report.html
(venv) jamoh@jamoh /tmp$ echo $?
1

Proposal:

(venv) jamoh@jamoh /tmp$ robot example_suite.robot 
==============================================================================
Example Suite                                                                 
==============================================================================
Test Example                                                          ^CSecond signal will force exit.
Test Example                                                          | FAIL |
Execution terminated by signal
------------------------------------------------------------------------------
Example Suite                                                         | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  /tmp/output.xml
Log:     /tmp/log.html
Report:  /tmp/report.html
(venv) jamoh@jamoh /tmp$ echo $?
253
@pekkaklarck
Copy link
Member

Sounds ok to me. Will need someone to implement, test and document it.

@jamofer jamofer linked a pull request Oct 4, 2019 that will close this issue
@jamofer
Copy link
Author

jamofer commented Nov 12, 2019

I think with current documentation it's clear about what do you expect after stop the execution in Robot Framework User Guide:

RC Explanation
0 All critical tests passed.
1-249 Returned number of critical tests failed.
250 250 or more critical failures.
251 Help or version information printed.
252 Invalid test data or command line options.
253 Test execution stopped by user.
255 Unexpected internal error.

And about the PR, I'm not confident about the changes I've made (lot of variable forwarding in order to be available at executionresult.py). I would appreciate a review about that, thanks :)

All atests and utests passes with this PR.

@HoangViet144
Copy link

HoangViet144 commented Aug 18, 2024

what is the status of this issue? I agree that it is good to have a specific rc (for example 253) when task is killed by SIGTERM/ SIGKILL

@pekkaklarck
Copy link
Member

Not sure why this was forgotten, especially when the functionality sounds useful and there's a PR. I'll add this to RF 7.4 scope.

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

Successfully merging a pull request may close this issue.

3 participants