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

Move initDriver() to SeleniumBaseTest constructor #182

Open
ishumov opened this issue Aug 10, 2018 · 3 comments
Open

Move initDriver() to SeleniumBaseTest constructor #182

ishumov opened this issue Aug 10, 2018 · 3 comments

Comments

@ishumov
Copy link

ishumov commented Aug 10, 2018

Now it's not clear that you have to call get() method to init web driver by call WebDriverFactory.initDriver();

@ishumov
Copy link
Author

ishumov commented Aug 13, 2018

It's not correct to add this call to constructor.
But below statement looks good:
@BeforeMethod public void init() { initDriver(); }
@vefimofff , What do you think about it?

@vefimofff
Copy link
Contributor

@BlackEnf0rcer we need to remember that a test class might contain more than 1 test method. So @beforeMethod will most likely cause problems. Please note that BaseTest is to be expected by ANY test of a project (including those who has annotations beforeGroups, beforeSuite, etc. So by the implicit creation of a driver - we might introduce a lot of confusion for the users.

I agree that naming of a "get" and the fact that driver is actually created in it is not very clear. But I would like the creation of a driver to be controllable by the user. I.e. we just need to add a single line in documentation saying "to start driver, use "open" method". That's it. The users will then be able to build any logic up to their needs and taste. e.g. add a beforeMethod, or anything.

So, what do you say if we just find a clearer name for the method?

@ishumov
Copy link
Author

ishumov commented Aug 16, 2018

@vefimofff After some reflections, I think it's a good idea to have a control of driver creation on test developer side. But what worries me, that there are two metods: static PageProvider.get that not loading driver and non-static method SeleniumBaseTest.get that loading driver. So I have to worry about driver when i need static method, so I suggest to rename method get to openPage and make it static.

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