Automation Best Practice, Design Consideration - sonnettest/TestAutomation GitHub Wiki
- There should not be any static sleep i.e. thread.sleep();.
- Build Test Scripts that can be reused for TDD and BDD approaches.
- Test case steps including verifications are built modular (functions / methods) and maintained in a separate class.
- Test data maintained externally should be accessible to all functions / methods.
- Driver script will have tests that invokes methods maintained in another class
- Driver script should follow unit testing framework standards / annotation.
Design Consideration
Unit Testing framework like JUnit, TestNG will be used to achieve the following benefits.
- Each @test will be mapped to a test-case. It should do one thing at a time.
- Categorize, group the test based on the requirement and reuse across testing stages like Smoke, Functional, Regression etc.
- Each test case can have duplicated steps (methods maintained in a different class) that runs with different sets of data.
- Each test should start with navigating from home page and ends with navigating back to home page.
- In case a test fails, browser should be closed and reopen automatically to run subsequent tests from home page.
- Ensure test is readable and easy to understand