Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Before per steps file #52

Open
ppazos opened this issue Dec 19, 2018 · 0 comments
Open

Before per steps file #52

ppazos opened this issue Dec 19, 2018 · 0 comments

Comments

@ppazos
Copy link

ppazos commented Dec 19, 2018

I have two feature files and two steps groovy files.

Defined the Before method on both steps files, the issue I'm having is the test execution calls both Before methods, before executing steps on each file.

The expected behavior would be, if Before is defined on env.groovy, to run for any steps file, but if the Before is defined on a specific steps file, that Before should run just for those steps.

The issue this generates, for instance, is when a variable should be initialized and has the same name. like this.myvar, on both Before methods, the myvar gets assigned to the value set by the steps file which Before is called last, getting the wrong value on when running the first steps file.

I know this can be easily avoided by making the names of the vars unique between steps files, but it would be better to isolate Before methods when declared on a steps file.

I think the same happens with the After methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant