views:

550

answers:

5

I am working on a new project and I wanted to know which automation tool is the best to use. Should I record-play or code?

+4  A: 

Coding is by far better. With record-play systems if any aspect of the page changes you have to go rerecord the entire test suite. With coding and proper design you can then go change the functions that interact with that one area and all the tests will start to work.

Erin
+3  A: 

I would say both -- record as much as possible, then tweak the recorded code to test as you need. That assumes, of course, that your recorder emits code you can edit.

Danimal
+5  A: 

I've worked a lot with the Selenium browser automation software packages, and I find that recording re-inforces the existing application design, while coding drives the design in a flexible and maintainable direction.

Specifically, the practice I've found works best is to write the script a high level, pretending that you have no idea what the existing HTML markup says. Try very hard to keep the script readable.

open /
click "Ask a question"
type title, "What does ?SYNTAX ERROR ON 20 mean?"
type body "This is an example question, asked by an automated testing robot."
click "Ask your question"

If the script doesn't run, don't change the script -- change the HTML. Add IDs or classes or titles to elements where the script "tells you" it wants them. It takes a little longer, but it ensures that your script is maintainable and obvious, and it makes further scripts much easier.

RJHunter
A: 

See also this thread... and this one...

Patrick Cuff
+1  A: 

So far QTP is the best. But keep in mind - it's a powerful platform first. If you don't want to sink in maintenance of record/playback scripts you will need to develop your custom framework (go for keyword-driven) or buy HP BPT.

There is a range of low budget and open source tools as well.

Albert Gareev