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

Add BeforeAll hook access to tags/command line options #1174

Closed
rayk47 opened this issue Feb 7, 2019 · 2 comments
Closed

Add BeforeAll hook access to tags/command line options #1174

rayk47 opened this issue Feb 7, 2019 · 2 comments

Comments

@rayk47
Copy link

rayk47 commented Feb 7, 2019

I have a use case where I would like to have multiple world classes and set the world-class I want to use for my tests based on the tags passed in. An example of how I would like to use it is shown below

BeforeAll({ tags: "@api" }, async function() { setWorldConstructor(APIWorld); setDefaultTimeout(25000); TestConfig.setup(); });
and
BeforeAll({ tags: "@ui" }, async function() { setWorldConstructor(UiWorld); setDefaultTimeout(25000); TestConfig.setup(); });

The BeforeAll hook does not have access to the command line or tag data so it would be great to have the option of passing in the tags or command line options so that we can perform some action before entering any tests. Another option is to allow some type of setting of cucumber global variables that can be accessed from anywhere. Protract has an onPrepare function in their config file which is run before entering protractor tests and this functionality would be great to have too.

@charlierudolph
Copy link
Member

You could use profiles to load in different support files and thus have separate world / configs

Another approach would be to use a single world instance and use world parameters to switch the internals of the world instance.

@rayk47
Copy link
Author

rayk47 commented Feb 13, 2019

You could use profiles to load in different support files and thus have separate world / configs

Another approach would be to use a single world instance and use world parameters to switch the internals of the world instance.

Yep, good call out @charlierudolph I thought about both of those solutions. Having two separate support folders is an option but not ideal. As for the world parameters, I'd rather separate out the world classes rather than change them based on parameters. It's a case of wanting to separate out world class based on the testing type undertaking. Thank you for your suggestions.

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

2 participants