I've read several 100 posts and their replies over the last few weeks as I'm beginning work on a test automation framework and I wanted to get as much information as possible as I work on this process. I've also had a few issues with QT Pro recently and was looking for some specific answers to those issues. In both cases, I've found excellent information in the forum and excellent links to outside information in the forum. I believe the moderators and others who help out with answers do an excellent job short of writing code for everyone who asks.
One thing I've noticed however is many members who post a question, stating that they are new to both QT Pro and VB script, but yet are asking an advanced question about VB scripting and or the many API's available for automation, object repository, or Quality Center integration. My one word of advice for anyone who is new to QTP is to spend some time recording some scripts using the record feature of QTP. When doing this try to do the following:
1. Record steps using as many different types of objects as possible, i.e. Links, Images, WebButtons, WebEdits, WebCheckBox, WebRadioGroup, WebLists, WebElements, etc. and/or their Windows counterparts.
2. Check out the "Expert" view after recording your script(s) and check out the basic syntax for the different types of objects and what it takes to exercise those objects.
3. Check out the Object Repository after recording to see what objects are added to the OR. What are the characteristics captured.
4. Use the Object Spy to look at some of those same objects. Check out the basic properties and the run time properties.
5. Learn how to parameterize values in a script using the QTP GUI Interface adding the parameters to the Global data sheet. Notice how the columns are added to the Global data sheet and how the step is changed in the "Expert" view. Replay your script and notice how the script flows when you have more then one column in the Global sheet.
6. Do the same thing to another script but add the parameters to the Action1 data sheet. Notice how the "Expert" view is changed. Replay your script and notice how the script flows when you have more then one column in the Action1 sheet.
7. If you have Quality Center integration, create a test lab and add one of your tests to the test lab. Try running the test from Quality Center and updating the QC Log and try running the test from Quality Center directly. (Ensure that you have all the necessary Add-ins loaded.) Run the test multiple times and then check out the stored logs in Quality Center.
While there are many other things you can do to have a better understanding of how QTP does some basic things, the ones mentioned above, using the dreaded recording functionality, should be enough to give you a basic understanding of how QTP works and some of the basic syntax you will need to know to do more advanced scripting.
I've seen so many questions on the forum recently that have some simple basic syntax incorrect. You can't usually play basketball, baseball, soccer, or cricket without understanding the basics and fundamentals of that sport. Likewise, you can't create a robust, reusable automation framework with QT PRO without understanding the basics and fundamentals of how QT PRO and VB Script work.
I hope that others find this process useful and while I'm sure some (or many) may disagree, I believe newbies who spend at least 8 hours trying the things I've mentioned above (if not more time) will find the exercise useful.
<font color="green">"We need a QT Pro guru to spend extra time learning everything possible about QT Pro. So who has cracked open the User Guide?"</font>
<font color="blue">"I have"</font>
<font color="green">"Good! You are now the QT Pro guru. Go forth and automate."</font>