VBScript is a scripting language which is used to automate certain tasks such as Create a Local User Account and Set the Privileges. One more usage of VBScript is in Test Automation. A well-known GUI automation tool Quick Test Professional uses VBScript as the scripting language to automate user actions on Application Under Test (AUT).
Since the VBScript can be used with QTP (Quick Test Professional) for automating user actions on the application under test, it became well-known in the Tester Community.
VBScript is an interpreter hence the script is compiled runtime and executes line by line. All the traditional programming languages such as C, C++, Java, Visual Basic, etc have compilers and the program will be compiled at once and run subsequently.
VBScript can be written using vbscript editors such as “vbsedit”. If your objective is to learn vbscript for QTP then it is better to use QTP for writing the scripts.
Download QTP from HP’s download center – HP BTO Download Center
Download VBScript Editor (Either trial version or get the registered version) – VBSEdit
Download and install any editors such as Notepad++ or Editplus. Write the script using the editor and save it as “.vbs” file. Run the vbscript file just by double clicking the file.
Let us write a small vbscript which displays “Hello World”.
Dim a a="Hello World" msgbox a
Save the file as “helloworld.vbs” – we can see the vbscript icon. Double click the file it runs and output will be as follows: