Ravi S Mundhe
Ravi S Mundhe

Reputation: 13

which thing is important while creating an automation framework

Using Selenium RC I am planing for creating an automation testing framework for our Java web-application.... please share some way like how to create framework ...which things is important in framework.....

Thanks in advance -Ravi

Upvotes: 1

Views: 2067

Answers (1)

pnewhook
pnewhook

Reputation: 4078

There are a few key factors that would greatly increase the maintainability, speed, and general usability of your tests but none are more important than abstracting your element locators out of your tests and into a central repository. I've heard of many ways of doing that but the best option I've seen is using the Page Object pattern. Essentially, each page becomes a java class, with properties representing the elements you want to use. Because you only define this page once in your PageObject and not in your many tests, if you ever need to change an element locator, there's only one place to do it.

Selenium 2 has a wonderful PageObject Factory built in but you can't use that because you want to use Selenium RC. Fortunately The Automated Tester, David Burns, has an excellent article on using Page Objects in C#, it should be close enough to get you started. http://www.theautomatedtester.co.uk/tutorials/selenium/page-object-pattern.htm For more on the Selenium 2 / WebDriver page object implementation see teh Selenium Google Code Wiki http://code.google.com/p/selenium/wiki/PageObjects

Some other really important factors to consider

  • Use an external framework for Data Driven tests one of the most common questions on the Selenium Google Group is how to test run data driven tests. The answer is almost always to use the data driven features that came with your unit testing tool. TestNG has become really popular with Selemium users because of it's excellent support for Data Driven tests. There's even guidance on the TestNG site for Selenium
  • Parallelize your tests Because most tests drive a live browser (unless you're using HTMLUnit) tests will take some time. The more you can parallelize your tests across multiple machines the faster they will run. Sauce Labs has an excellent blog series on this
  • Screenshot on errors less common but also a good idea. Sometimes you need to look at your webpage when there's a problem

Upvotes: 6

Related Questions