One of the most important languages Automation Engineers need to know is VbScript, because VbScript is the primary language used in QTP/UFT. You cannot just do Record & Playback at the job, you need to customize the script to fit the test that you are running. Many times Record & Playback does not accurately copy a step that needs to be done in the test, resulting in an error that prevent the continuation of the rest of the test.
Table of Contents
Dialog Box
MsgBox("Hello World")
Code that opens up a message in a dialog box. MsgBox refers to the dialog box, () refers to what goes in the dialog box, “Hello World” is the message that goes in the Dialog Box.
Open Internet Explorer
SystemUtil.Run "iexplore.exe"
Code for opening Internet explorer. Useful because Record and Run usually can’t copy this step & fails. Breaking it down, SystemUtil refers to basic system utilities/software, run means to “run” it. In combination with the dot “.”, it means to mean run a system software. But you want to specify which software; it is Internet Explorer. You add a space first, then inside quotation type iexplore.exe, which refers to the Internet Explorer executable.
Set
... .Set
Use set at the end of a line of code to input a string (String = letters & numbers, or any character) for a field. For inputting sensitive data that needs to be protected use:
... .SetSecure
SetSecure puts an encryption on the string of data you are inputting for a field. Good for protecting passwords or sensitive data while testing.
Click
... .Click
Used to click a button or any other interactive element of an application.
Get/Set-RO/TO-Property/Properties
Click the above link for more information on GetROProperty, GetTOProperty, GetTOProperties, SetTOProperty