QTP Tips – Part 2
6. Does QuickTest have any debugging capabilities?
In order to debug tests you must install the Microsoft Script Debugger. If you did not download and installed it while installing QuickTest, the debugger can be still downloaded from the Microsoft Script Technologies site. After downloading it, double-click on the self-extracting executable and follow the instructions on your screen.
Once the Script Debugger is installed, an arrow points to the current step that is being executed in the Tree View and the Expert View. You can then use the debugger to view local action variables, use the command window, view the objects properties, and more.
More information can be found in the QuickTest User’s Guide.
7. What command-line arguments can I use when launching QuickTest?
Please refer to the QuickTest Command Line utility for more information on how to run QuickTest using a command line.
8. I have a Microsoft Access database that contains data I would like to use in my test. How do I do this?
The powerful ‘Expert View’ allows you to access databases using ADO and ODBC. Below is a sample test that uses the information contained in the Authors table of a database to search for books written by the author.
Dim MyDB
Dim MyEng
Set MyEng = CreateObject(“DAO.DBEngine.35”)
Dim Td
Dim rs
‘ Specify the database to use
Set MyDB = MyEng.OpenDatabase(“BIBLIO.MDB”)
‘ Read and use the name of the first 10 authors
Set Td = MyDB.TableDefs(“Authors”)
Set rs = Td.OpenRecordset
rs.MoveFirst
For i = 1 To 10
Browser(“Book Club”).Page(“Search Books”).WebEdit(“Author Name”).Set rs(“Author”)
Browser(“Book Club”).Page(“Search Books”).WebButton(“Search”).Click
Next
9. How do I add a manual wait step to my test?
A manual wait (think time) can be added to a QuickTest test using the following command:
Call Wait(<time in seconds to wait>)
10. How do I make the test prompt the user for input while it is running?
The VBScript InputBox function allows you to display a dialog box that prompts the user for input and then continue running the test. You can use the value that was entered by the user later on in the test. See the VBScript reference manual for more information on the InputBox function.
The following example shows the InputBox function used to prompt the user for the password.
Browser(“Mercury Tours”).Page(“Mercury Tours”).WebEdit(“username”).Set “administrator”
Passwd = inputbox (“Enter password”, “User Input”)
Browser(“Mercury Tours”).Page(“Mercury Tours”).WebEdit(“password”).Set Passwd