We have to take an advantage of selenium / webdriver along with java for web application automation testing, targeting all browsers and operating systems.
Use Appium along with selenium /webdriver and java for mobile applications, targeting android and iPhone applications.
We have to follow the best practices we use for automation testing :
- Identifying test cases, and prioritizing test cases for automation. Generally, test cases that are repeated or critically used are automated first.
- Follow page object and page factory pattern, which allow us to keep all actions and locators on the same page for enhancing test maintenance and reducing code redundancy. A page object is object-oriented that serves as an interface to a page of application under test.
- Keep all inputs in a CSV file and which should be user-friendly.
- Use of Test NG / JUnit framework. It provides lots of in-build strong functionalities.
- Generated reports are user-friendly.
- Create a log file, which contains all the steps along with errors if any.
- Preferred selector order: ID > Name > CSS > Xpath.
- the element's Id.
- the element's name attribute.
- Xpath statement.
- by link text.
- a CSS statement.
- Avoid Thread.sleep and prefer Wait or FluentWait.
- Use relative paths and URLs, so that if changes are needed they can take place at a single location.
- Take and store failure test cases with screenshots and videos.
- Write clear test cases along with good comments and grammatically correct ones.
- Keep all related things in the common library.
- Use build tools (ant and maven), to run the suite in a single click.
- Applying best practices like naming conventions, and documentation.
- Integrate another tool if needed, For example, if we need to deal with OS-level dialog boxes, then integrate another tool in selenium scripts.
- Divide test cases into groups like regression testing, and smoke testing.
- A data provider for parameterization is used.
-