From Wikipedia link.
- VBSB (Visual Basic Scripting Edition)
- Can be used to write and embed function in web pages
- Besides javascript, vbscript that can be used to code client-side scripting in a web browser
- QTP tool uses VBScript
2. Get Started with Hello World Example
MsgBox "Hello World"
3. Next is Example using variables and conversions
Dim varTest
'Variable Naming Convention - starts with var
varTest = "12"
MsgBox TypeName(varTest)
'Convert Variable to Integer
varTest = CInt(varTest)
MsgBox TypeName(varTest)
4. Next is Prime Number calculation example using functions'Variable Naming Convention - starts with var
varTest = "12"
MsgBox TypeName(varTest)
'Convert Variable to Integer
varTest = CInt(varTest)
MsgBox TypeName(varTest)
'Option Explicit - explicitly declare all variables
Dim varTest
varTest = InputBox("Please Enter Number")
CheckPrime(varTest)
'Function to check for Prime Number
Function CheckPrime(varTest)
Dim i
Dim flag, reminder
flag = 0
i = 2
'Do While Condition Example
Do
flag = 0
reminder = varTest Mod i
If reminder = 0 Then
MsgBox "Not Prime"
flag = 1
End If
i=i+1
Loop While flag=0 And i<varTest-1
If flag=0 then
MsgBox "Prime Number"
End IF
End Function
5. Next Example is Reading from Excel
Link - Read from Excel
More Reads
Eric Lippert MSDN VBScript Notes
Error Handling in VBScript, Part One
Error Handling In VBScript, Part Two
Error Handling in VBScript, Part Three
VBScript User's Guide
Developing Automation Framework using QTP
Create Test Automation Framework - Introduction
Create Test Automation Framework – Part 1a
Create Test Automation Framework – Part 1b
Create Test Automation Framework – Part 1c
Happy Reading!!
No comments:
Post a Comment