Reputation: 506
I have multiple test cases and I have multiple class files one for login, one for user creation and etc. Would it be possible to do like this - I wish to initialise the WebDriver once say in login test case and then wish to execute other test cases by maintaing the session and without re-initialising the WebDriver in further test cases. Is is possible?
Upvotes: 0
Views: 112
Reputation: 1481
This is not good practice.
Try to avoid this at all cost. Every test should be modular and independent as possible.
Good thing is that You divided them logicaly, but don't go to re-use driver and session, this is just bad practice, and doesn't bring You nothing.
Good Practice:
Thread.sleep
prefer Wait
@murali provided example in his link, but as I mentioned this is not good practice.
Hope that this helps,
Upvotes: 1