TestCentric / testcentric-gui

TestCentric GUI Runner for NUnit
Other
66 stars 31 forks source link

2.0.0-beta6 force stop endless loop test - cleanup #1144

Open MartinZec opened 1 day ago

MartinZec commented 1 day ago

Hello,

I forced to stop a endless loop in a test. After it is sopped, I can execute the test again but I cannot stop it anymore because the stop button is grayed out. In case I close the GUI, it tells me that a test is currently running.

The endless while loop is also preventing logs. In case endless loop is removed logs are shown at text output: "=> name1.name2.name3_1.name3_1.test1 test1test2test3"

Start and end time are wrong displayed in case of a forced stop.

Can be reproduced with attached example project. Solution1.zip

Best regards, Martin

rowo360 commented 3 hours ago

Thank you for reporting this issue and providing a sample project. So I was able to reproduce this problem easily! And of course this is not the desired behavior.

After starting the first test run, the toolbar looks like this - all the 'Run' buttons are disabled and the 'Stop' button is the only activated one.

So, I first clicked 'Stop' and afterwards it changed to 'Kill' which I clicked also.

After starting the second test run, the toolbar looks like this - indeed the 'Stop' button is disabled, but also all the 'Run' buttons are still enabled.

So I have the impression that we fail to start the second test run at all, but still struggeling to stop the first test run properly. May I just ask you to confirm that the toolbar looks identically to the 2nd screenshot on your side? Thanks!

Here are some additional observations which might be helpful for further analyzing this issue:

CharliePoole commented 2 hours ago

Normal stop (Stop button) is passed to the agent and it's actual test runner. It gets the message and stops staging any more tests. Then it waits for all running tests to finish. A test in an infinite loop, of course, never finishes. After waiting a while, it gives up.

The GUI, not receiving a notification that the run has stopped, displays the kill button. Clicking it causes a forced stop, which is also passed to the agent. The agent then exits the process, never sending a notification.

So there are several problems here...

  1. No notification is sent.
  2. The GUI doesn't wait for a notification but just assumes the Kill button worked and the run terminated.
  3. More subtly, the agent is making no attempt to kill the thread on which the test is running. That would be possible for a .NET Framework agent but not for .NET Core.
  4. We have tests of an infinite loop in the GUI, but they are not pointing out this problem to us.

@rowo360 This is probably multiple issues. So far you have only worked in the GUI (item 2) but I'm happy to support you if you want to explore these new areas. I'm also happy to take on any pieces of this.

Items 1 and 3 probably reside in TestCentric.Agent.Core, the common code for all agents. Item 2 and 4 are in the GUI but the tests should probably be in the engine and/or the the common agent code as well.

CharliePoole commented 1 hour ago

@MartinZec Was this a problem in the beta5 release?

@rowo360 It would also be useful if we could identify an easy temporary fix for the GUI, while waiting for anything to be done in the other projects, However, I wouldn't be opposed to doing it all and making a new beta release.