Hannah
Hannah

Reputation: 23

Using Hooks in Cucumber with Lambda Expression

I have a feature file with the following scenario

Given I launch the browser

Now I have the step def for the same as

Given("I launch the browser", () -> {
        vu.launchBrowser();

        });

Now I want to execute this scenario with before hook such that I runs before every other scenario

I tried doing this

Before("I launch the browser",() -> {
        });

but there is a compile error Can someone help how we can implement this before hook using lambda expression and what are the changes that need to be done in stepdefs and feature file to achieve the same

Upvotes: 0

Views: 444

Answers (1)

Aslak Hellesøy
Aslak Hellesøy

Reputation: 1191

Remove "I launch the browser" from your Before hook. Hooks don't accept an expression argument.

Upvotes: 2

Related Questions