Software testing code is like programming code: it can be useful in the long term only if it is maintainable. In this article, Mehdi Khalili shares some tricks on how to build a maintainable suite of automated test cases.
His first recommendation is to avoid using a record-playback tool like the Selenium IDE. These screen recorders make it easy to create the test cases, but the code that they generate has inherent maintainability issues. His advice is to craft testing code like programs, applying the Single Responsibility Principle (SRP) and Don’t Repeat Yourself (DRY) concepts.
Object Orientation is the solution that can cure the procedural nature of the test scripts. The article introduces the Page Object as a pattern used to apply object orientation to UI tests. The Page Object pattern is discussed in details with plenty of code as examples. The article includes also a recommendation of some frameworks that can be used to implement page objects in .NET and ruby.
Read the complete article on http://net.tutsplus.com/tutorials/maintainable-automated-ui-tests/