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

Cancel test does not terminate process #337

Open
appls opened this issue Feb 15, 2022 · 3 comments
Open

Cancel test does not terminate process #337

appls opened this issue Feb 15, 2022 · 3 comments

Comments

@appls
Copy link

appls commented Feb 15, 2022

Hi Christian,

I use GoogleTestAdapter 0.18.0. I set "Terminate process on cancel" to "True".
When I do a Debug-Run of my test I can terminate the test execution and this results in termination of the running process as expected.
However when I do a "normal" Run of my test and I terminate the test execution the process is not terminated and continues to run in the background while the Test Explorer already shows that the test has been canceled. Is my configuration somehow wrong or do I have the wrong assumption that the process should also terminate on cancel?
I took a quick look into the code (GoogleTestAdapter/GoogleTestAdapter/Core/Runners/SequentialTestRunner.cs, l. 75 ff.) but did not find anything suspicious.

Any suggestions are appreciated. Hope to hear from you.
Cheers,
Tobias

@csoltenborn
Copy link
Owner

csoltenborn commented Feb 17, 2022

Hi Tobias,

as far as I understand, the process should indeed be killed immediately by invoking Process.Kill(). Couple of things to check:

  • do you get debug out saying that the process has been killed? GTA logs this (or logs an error if it fails), but only in debug mode
  • reading the above docs, I notice that killing is done asynchronously, and GTA does not wait for it to succeed. So even if you get a success message, it might take a bit until the process is indeed killed.
  • Which debugger engine do you use? If I remember correctly, running tests (in contrast to debugging them) should always be done with the .NET process stuff, so this should (if at all) have the opposite effect, but in case you do not get log output at all after canceling your tests, this might be the reason

Summarizing, I have no idea why this would work when debugging, but not running (and would expect it to be the other way, if at all)...

@csoltenborn
Copy link
Owner

I've quickly put together some code to improve logging, and to also wait for the actual termination of the process - please give it a try and let me know what you see when enabling Debug mode... Download the VSIX from here, see code changes here.

@appls
Copy link
Author

appls commented Feb 21, 2022

Hi Christian,

I installed your provided VSIX Version 0.18.0.1475. Please find the attached Test log output.
DebugRunAbortLog.txt
RunAbortLog.txt

I still observe that the process does not terminate when I start the test as a "normal" run. When I abort a test run in "debug" mode it terminates.
Can you please double check my RunSettings to verify that there is no error.

Thank you for your support.
Cheers,
Tobias

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