Assess your Selenium Test Automation Framework with the below checklist items to diagnose whether it is healthy –
- Atomic Tests (One Test – One Purpose)
- All tests should be highly independent and has no dependencies
- Capability to execute in headless for CI/CD purpose
- Multi-browser support
- No hard-coded test data in the scripts
- Capable enough to execute in all environments (from Dev to Pre-Prod)
- Tests should not have more than 15 Lines Of Code (nUnit, JUnit, xUnit)
- Acceptance Tests using BDD should not have more than 1 Given, When and Then and a maximum of 2 And statements
- Usage of Page Objects and not a single class or text file containing locators
- Maximum of 3 Assertions for a test
- Usage of Fixtures like setup(), tearDown() from Base Class
- Locators should be used on the priority of id, name, class, XPath and CSS Selector
- Page Classes should not exceed 100 lines of code
- Page Methods should not exceed 15 lines of code
- Strictly no use of thread.sleep()
- No NullPointerException at any cost
- WebDriver session maintenance from Base Class
- Capable to take a failed screenshot automatically
- Usage of proper reporting tools (Extent Reports, Allure Reports etc.)
All the above said conditions will improve the execution time and will reduce the risk of memory leakage while test execution. This will also improve the reduction of flaky tests which gives false-positive results.
Please comment on what apart from this is considered to be the best in designing Selenium Framework…
Image Credit :
Leave a Reply