We have a web application we execute test cases manually we decided to automate all the testcases.Can I do it record and playback adding little code like if else,for loops and putting all the test scripts in one batch and run them adding check points for verification.One of my friend says we have to do descriptive programming using variables,functions and so on. suggest me which is the best way since both can do the same thing.Help me with that answer.
Yes you can record your test cases adding If, Then, Loops etc. You add checkpoints to the scripts either while recording or after recording but prior to execution.
You can download a utility from http://support.mercuryinteractive.com called MultiTest Manager 8.2 that allows you to batch tests for execution and also lets you schedule them to be run at a certain date/time.
There is a lot of myth surrounding Descriptive Programming, it is very useful in certain situations but there are lots of QTP users who don't need to use it and it takes nothing away from their ability to create and execute robust QTP scripts.
When you go tho the Mercury site look at the solution of the week, this addresses some of the myths regarding DP.
After recording don't forget to get rid of hard coded values by parameterizing them. Parameterizing your scripts makes actions/components more reusable. and also my advise is that don't use checkpoints instead use GetROP methods to get the values of properties and manually check them.
Now coming to descriptive programming you must use it only the properties of the test objects are dynamic and they will change during the execution of your scripts.