Pitfalls and Suggestions

In this lesson, we will discuss the best practices while writing automated tests.

We'll cover the following

Best practices for automation #

  • No hardcoding of test data in a test class.
  • Add logs for important steps.
  • Lots of meaningful assertions should be added.
  • No hard coding of configurations.
  • Page operations should be part of the page object class.
  • Helpers for DB, files, etc., should be part of utility class.
  • Add proper test comments.
  • Give meaningful names to the test methods and follow java naming conventions.
  • Group tests (such as sanity, regression, P0, etc.).
  • Avoid dependent tests.

Get hands-on with 1200+ tech skills courses.