On Fri, Sep 20, 2013 at 6:20 AM, shivi malviya <
malviy...@gmail.com> wrote:
> Hi All,
>
> I am facing issue while running my Cucumber tests in Java. I have created
> multiple step definition files for feature files and each step definition
> has @Before and @After defined for browser initialization.
> So when I am running my test with command :
> mvn test -Dcucumber.options="classpath:LanguageCookie.feature"
>
> Then @Before and @After is running for all the step definition files, i.e.
> it is running multiple times though I want to execute it only once.
Hi Shivi,
This is the intended behaviour of the @Before and @After hooks: they
are not related to each step definition. Every hook is run on each
scenario (unless it's filtered out by tags). Take a look at the
java-webbit-websockets-selenium example in cucumber-jvm sources to
find out how to deal with browser initialization.
Paolo