I am writing some BDD automation test using Cucumber in combination with Serenity framework. And I need some timeout mechanism in my BDD test so that if a Cucumber scenario or a Step in Serenity is taking too long, it will time out and test will fail.
I found some information in the link below: https://groups.google.com/forum/#!topic/cukes/QaPvVMnqDvE
So for Cucumber, it seems the following setup in Step Definition should do the work:
@When(value="^I request web authentication$", timeout=1000)
public myfunc(){
}
For Serenity, I did not found any setting for timeout, but I guess it's just that I have not found it yet.
However, when I tried the timeout=xxx for Cucumber, it does not seem to work. Even though myfunc() hangs for a long time in my test, the test is not stopped, just hanging.
Anyone knows if there are additional setups for this timeout=xxx to work?
Also is Serenity having any similar timeout mechanism of its own to be used?
Finally I am using maven clean install to drive the test, maybe I am missing some maven setup for this to work?
Any hint will be very appreciated.
Timeout for Serenity can be handled by the following properties:
webdriver.timeouts.implicitlywait
webdriver.wait.for.timeout
serenity.timeout
You can also get more information about Serenity timeouts in
http://thucydides.info/docs/serenity-staging/#_working_with_timeouts https://github.com/serenity-bdd/serenity-documentation/blob/master/src/asciidoc/system-props.adoc