Authoring automated tests is quite easy but authoring easily human-readable and maintainable tests is much tougher. Especially, when your project grows in size and complexity. There are many approaches that can help you build your tests in a Selenium framework like correct handling of your Base Class well.
The Base class should have these things:
- the setup() and teardown() test methods.
- the WebDriver object.
- load your configuration/properties file here (can be a part of its constructor)
- common aspects of all tests like handling sync issues, ScreenshotOnFailure, etc.
- have a method to visit the site that returns the Index page object.
- and All test classes should inherit it.
P.S. My view on this topic is purely subjective. And in many cases, you may not be able to apply this type of approach to your framework.
Comments
Post a Comment