-
Notifications
You must be signed in to change notification settings - Fork 202
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
Add a way to stop a runner gracefully #150
Comments
@vincentparrett Do you have any ideas on where the best place to tie into this would be? Now that I you added the UI updating in real-time, and now that I have like over 1000 tests in some projects, I am increasingly finding myself wishing I could cancel an accidental "run all". I have not worked in the test engine itself hardly at all, so I was just curious if you could point me in a spot where you think this should go and I was going to look into getting it in there. I would assume we start with some sort simple "stop run" flag somewhere that is checked before starting the next test (this is the spot I would need your opinion on), rather than a full up "abort running test" style thing for a rouge infinite loop or similar situation. For now, task manager works just fine for the latter :) |
I was thinking a simple Aborted property on the runner would deal with not running the next test, but the tests themselves do not have access to the runner or any sort of context. So for a running test to check for abort it would need to be a flag somewhere in the TestFramework unit, so perhaps a class property on TDUnitX that the runner checks and test implementers can check if doing long running loops etc. In console applications, adding a Ctrl+C handler would be needed (simple for windows using SetConsoleCtrlHandler, I have no idea how that would be done for other platforms), so would need to be added to the wizard generated code. Also, what should the exit code be if someone stops the tests? For the gui runner, you would just have to remember to reset it once the tests have stopped. We should probably ping @sglienke on this as I'm not sure if TestInsight has the ability to abort tests with DUnitX. I tried to test this, but my tests run too fast! |
TestInsight is able to terminate the tests via TerminateProcess on Windows (the stop button in its toolbar that enables when the tests are running) which works quite fine as it can also kill a test process that is not responding anymore. Helped me quite a few times when something went badly wrong somewhere. |
There is no way currently to interrupt the runner, it's in a tight loop and runs to completion.
The text was updated successfully, but these errors were encountered: