"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

January 22, 2011

Selenium Automation Best Practices

[Next Post in Series - Automation Assignment - Automation of Cleartrip.com Homepage]
[You may also like - Selenium Automation Tricks From Selenium Wiki]

I am reading Selenium beginner's Guide. In Best practices section author refers to Page Object Pattern.
  • Moving Selenium methods into private methods to make it maintainable
  • Seperate classes for each page, This example is clearly illustrated - Homepage.java, Chapter1.java, Chapter2.java. This is very good.
  • I am going to try it out with different set of example with coding standards suggested for Java
Summarizing Coding Standards based on - Java Coding Standards Document
  • Comment your methods and add enough information for other team members to understand
  • Naming methods with full description and first letter not captitalized. Ex- openHomePage( ), openFirstPage( )
  • Assigning member function visibility private, public, protected based on usage
  • Declaring variables - searchKeyword, brandName, firstName (Hungarian Notation - hWindow, hMenuItems), Usage of _
  • Last Important thing is naming constants, static variables in CAPS - MAX_LIMIT, CHECK_VALUE
  • Always initialize static fields
  • Declare local variables immediately before their use
  • Prefix letter I for Interface  names
I would prefer online code formatter :). There might be some free tools available need to check.

Continuous Integration Server is something I need to learn :).....

Good Reads

Selenium Maven Plugin

No comments: