Jrawr
Jrawr

Reputation: 199

Selenium Cucumber force terminate run

I'm currently running some Cuke test with Selenium that hinge on preconditions in the system. A given run can include 1 or more Features. Features check for certain preconditions at the start of the run, for instance whether or not it can find the proper driver.exe file. If some of those preconditions fail, I would like to kill the run completely inside of a catch block an prevent any other scenario or Feature from being checked as they will all fail anyway. Is there a function or set of functions to accomplish this?

try {
//Gonna check for things here
} catch(Exception e) {
//Something went wrong, kill this thread. 
}

Upvotes: 0

Views: 753

Answers (1)

Thomas Sundberg
Thomas Sundberg

Reputation: 4343

I would consider a before step in Cucumber. It will be executed before each scenario in that particular feature file. This would result in the check being performed before each scenario. If you need, set a static flag that you can examine and fail fast if needed.

Upvotes: 1

Related Questions