unclebob / fitnesse

FitNesse -- The Acceptance Test Wiki
fitnesse.org
Other
2.03k stars 712 forks source link

[Question] Is there a way to detect when a user clicks on Stop Test button in wiki page #1523

Open suchita-rknair opened 6 days ago

suchita-rknair commented 6 days ago

General Description We execute our test cases in a container. When a user clicks on "Test" button in fitnesse, we start a container and execute tests within the container(in cloud)

Scenario: when a user click on Stop Test button during the execution, we need to trigger a call to stop the execution in the container and proceeed with cleanup activity. We have tried using shutdownhooks but it only works when we stop the fitnesse server. shutdownhooks never gets called when stop test button is clicked

Is there a way to know when user clicks on stop test button and based on that make a call for cleanup. Any existing listeners in fitnesse that can be used for this purpose? Tried extending the class "StopTestReponder" to create a custom implementation but it doesn't work.

Is there a way to catch the internal exception thrown when we click on stop test button.

Any help/suggestion regarding this matter will be appreciated

fhoeben commented 5 days ago

I haven't tried this myself. But I would expect a shutdown hook to work if you register it via your fixture code. Did you do that or did you add it to the FitNesse wiki process (which I expect based on that it did get run when you stopped the server)? Please note that the wiki server starts a separate process (unless you run in debug mode) to actually run the tests.

If you really need to do cleanup you probably also need to ensure that cleanup happens when the user closes their tab or browser without clicking anywhere. That will never be full-proof I suppose.