Blog

Best Practices for Guaranteed Test Automation Success with Selenium and Qualitia

Posted by Aarti Sharma on Aug 3, 2016 10:49:24 AM

simplifiedWe have already admitted our love for Selenium – so no more arguments there. Now that this is an accepted relationship, we thought of taking up the next step. Here we provide you with some best practices to follow for ensuring guaranteed success with your test automation projects where you are using the combination of Selenium and Qualitia.

Qualitia relies on Selenium for object identification and execution. Therefore, users need to develop the test cases outside underlying automation tools using Qualitia’s development screen. Then Qualitia should be integrated with Selenium. It uses configurable file that includes basic inputs required to start the selenium server.

Best Practices during Object Management

Selenium does not have its own dedicated object repository. On the other hand, Qualitia has an inbuilt utility for better object management in Selenium. The utility works in totality wherein; it generates dependable identifiers for the objects having id or name as attributes.

Best Practices:

  • Robust Ids and names are best options for an object. If xpath is the option then try to do away with absolute xpath and use relative xpath.
  • For the objects inside the table container, even though the objects can be accessed individually, it’s recommended that the automation is done on the container level to access the object
  • Write xpaths by referring to the attributes of the object rather than referring its hierarchy.
  • While adding objects from Object Spy, make sure that you add all the respective frame/iframes where the object lies in. However if the object addition is done manually, then the frames hierarchy of the object also needs to be added along with the object,
  • In situations where you need to refer to parent in a cornered situation, take extra care while using index to point to any object. Avoid using indexes as far as possible
  • In case you plan to have multi-lingual executions, create xpaths that are independent of the language change – especially any text attribute in the locator value.
  • Once the objects are identified, provide a proper logical name. Think from the perspective of the QA developer who is going to see the application and then going to search for the object.
  • While adding objects manually do not add objects in one single hierarchy as it tends to become un-maintainable eventually. Try to have a page hierarchy and add object under respective page object.

Best Practices during Development

Best Practices:

  • Avoid using sleep unless it’s really needed – instead, you can use WaitForObject.
  • Use correct error handling flags to bring optimum execution time.
  • Do not use extreme sync times. Try to study the application latency and then accordingly set the sync time.
  • Use intuitive nomenclature for naming tasks, test cases, parameterized data column names and variables.
  • Since Selenium does not always open the browser in maximized mode, ensure that you use “Maximize browser” action immediately after open URL. This way, you can prevent an impact in snapshot of the application that appears in execution report generated by Qualitia.
  • When the application has any child windows or popups, make sure that you shift the focus appropriately to the concerned child or parent window.
  • Apart from using window title to focus on a window, Qualitia offers an action that uses the sequence of the windows that need to be focused on without depending on the titles of the window. This is ideal to use when the window title is dynamic and it is difficult to locate the JavaScript variable for the window.

Hope these tips are useful for you?

Topics: Selenium, Best Practices, Blog