Introduction to VBScript

Introduction to VBScript

Introduction to VBScript, What is VBScript?, Scripting Languages vs. Programming Languages, and VBScript Programming Fundamentals. Introduction to VBScript 1. What is VBScript? 2. Scripting Languages versus Programming Languages 3. Usage of VBScript 4. VBScript Fundamentals and Features 1. What is VBScript? Visual Basic Script (VBScript) is a component-based scripting language developed by Microsoft. It is … Read more

VBScript Syntax Rules and Guidelines

VBScript Tutorial

VBScript Syntax Rules and Guidelines, Introduction to Visual Basic Scripting Edition, VBScript Syntax, and VBScript coding standards. VBScript Syntax Rules and Guidelines 1. Case-sensitivity: By default, VBScript is not case sensitive and does not differentiate between upper-case and lower-case spelling of words, for example, in variables, object and method names, or constants. For example, the … Read more

VBScript FileSystemObject Part-2

VBScript FileSystemObject Part-2 1) Write data Continuously in a Text file. Dim objFso, objTextstream, num1, num2, Res num1=10 : num2 =20: Res=num1 + num2 Res2=num1*num2 Set objFso = CreateObject(“Scripting.FileSystemObject”) Set objTextstream = objFso.OpenTextFile(“C:\Users\G C REDDY\Desktop\abc.txt”, 2) objTextstream.Write “Addition of num1, num2 is: “&Res objTextstream.Write “Multiplication of num1, num2 is: “&Res2 objTextstream.Close Set objTextstream = Nothing … Read more

VBScript Excel Object Model Part-2

VBScript Excel Object Model Part-2 1) Read Test data from Excel file and perform Data driven testing for Login Functionality. And write/export Test Result and Error Message to the same file. Dim objExcel, objWorkbook, objWorksheet, RowsCount, i Set objExcel = CreateObject(“Excel.Application”) Set objWorkbook = objExcel.Workbooks.Open(“C:\Users\G C REDDY\Desktop\January.xlsx”) Set objWorksheet = objWorkbook.Worksheets(1) RowsCount = objWorksheet.UsedRange.Rows.Count objWorksheet.Cells(1, … Read more

VBScript Database Objects

  VBScript Database Objects 1) Database Connection Object It is used to connect to Databases. (* Database Connection String only varies from One Database to another) Create Database Connection Object Set variable = CreateObject(“Adodb.Connection”) 2) Database Recordset Object It is used to perform operations on Database tables (records) Create Database Recordset Object Set variable = … Read more

Error Handling and Debugging Tests in UFT

Error Handling and Debugging Tests in UFT 1) Error Handling using VBScript: Handling expected and unexpected errors. Expected Errors Whenever we use invalid input then we expect errors. Note: We use invalid input for negative testing. Unexpected Errors i) Resource Missing ii) Resource Response iii) Insufficient Resource. How to handle Errors i) Using Conditional statements … Read more

 User Defined Functions in VBScript

 User Defined Functions in VBScript  VBScript Functions > In Structured Programming (Ex: C Language) we use Functions (Built-in and user defined). > In Object Oriented Programming (ex: Java) we use Methods (Built-in and user defined). > In VBScript we use Functions and Methods (Object based language). What is Function? A reusable code. When we choose … Read more

VBScript Built in Functions

VBScript Built in Functions 1) Asc Function It returns ANSI character code for first letter of a string or number. ‘A to z (65 to 90) ‘a to z (97 to 122) ‘0 to 9 (48 to 57) Example: Dim a a =”ABCD” Msgbox Asc(a) ’65 Msgbox Asc(“A”) ’65 Msgbox Asc(“Z”) ’90 Msgbox Asc(“a”) ’97 … Read more

VBScript FileSystemObject

VBScript FileSystemObject File System Operations i) What is Computer File System? It is a feature of Operating system used to work with Drives, Folders and Files. ii) Examples for File System Operations Create a Folder Copy a Folder Delete a Folder Create a Text file Delete a Text file Read data Write data Comparisons Search … Read more

VBScript Tutorial 10

VBScript Tutorial 10 (Error Handling, Debugging Scripts) Error Handling using VBScript: Handling expected and unexpected Errors > Expected Errors: Whenever we use Invalid input then we can expect Errors. Note: We use Invalid input for Negative Testing. > Unexpected Errors i) Resource missing ii) Insufficient Resource iii) Resource Response How to Handle Errors: i) Using … Read more