user1809943
user1809943

Reputation: 141

How to share data between SpecFlow beforetestrun and aftertestrun hooks?

We have scenariocontext and featurecontext to share data between scenarios and features but is there a way to share data between the beforetestrun and aftertestrun?

I am trying to kill the open browser processes at the end of the test run as described in this question.

I have browser.quit() in my afterscenario and afterfeature but still some processes remain running which I am hoping to kill in the aftertestrun hook.

Upvotes: 2

Views: 941

Answers (1)

Ben Smith
Ben Smith

Reputation: 20240

There is no way to share data between the BeforeTestRun and AfterTestRun hooks.

However regarding:

I have browser.quit() in my afterscenario and afterfeature but still some processes remain running which I am hoping to kill in the aftertestrun hook.

You can use the code in the question you referred to, to kill the lingering processes; if you know what processes need to be killed then you can iterate through these known process to verify that they have been killed, and if they haven't you can then proceed to kill them.

Upvotes: 1

Related Questions