Exactly once only Before/After hook? #2233
Unanswered
v-mwalk
asked this question in
Q&A Everything Else
Replies: 1 comment
-
Use your thread ID as a halting mechanism. then you have your desired logic |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This quite possibly applies only to Cucumber-JS; in which case humble apologies for posting here...
I am just about to embark on working out how to do a 'BeforeAll'/'AfterAll' activities that execute exactly ONCE per run. Irrelevant whether using parallel or not. BeforeAll and AfterAll execute every time for each parallel worker - however, I want them to execute only once.
I'm dabbling with a few ways of doing it but wanted to ask community if anyone else has done same already.
Reason I need this is that at start of testing I need to launch the AUT web server and at end tear it down again. When the site is launched I loop a ping (after axios.head...) to the site and only continue once I get a coherent response. Then tear down after testing. I could play around with lock files etc but that poses two main issues - race conditions and ensuring tear down ONLY when testing complete.
My current thought is to wrap the whole cucumber launch in a nodejs script. So;
Could be quite simple actually; but wanted to check if anyone done same ish altready...?
Beta Was this translation helpful? Give feedback.
All reactions