Quantum standard practices

The following list provides some of the recommended Quantum best practices. In addition, make sure to follow all Java-based coding practices.

  • The use of Given, When, Then and And should be proper and logical. When you have several givens, whens or thens make it more readable and fluent by using ands and buts.

               

  • In the locator files, the keys of the locator values should follow a common syntax. This practice makes it easier to understand what the locator is meant for.
  • There should be no duplicates of any locator keys in platform-specific locator files.
  • All the selenium code should be written in the Page classes only.
  • The step definitions should only have the calls to the Page Class methods.
  • Operations on the screen should be kept in separate methods than the validations.
  • In the feature or BDD files, the operations on the screens should be stated as When statements and the validations should be kept as Then statements.
  • Use of static waits should be avoided. Try to kept it minimal and rely more on Wait services.
  • If you are performing any clicks on the elements, you can avoid the verification of the same elements because the click command will validate that the element was there on the screen.
  • Use of static keyword should be strictly avoided to store webelements/webdriver in variables because it will cause issues in parallel execution. This is because the static class variables will be shared across the threads in Java.