UFT Class 30

UFT Class 30 (VBScript File System Operations Part-2, Excel Object Model Part-1) ‘Read Test Data from a Text file and perform Data Driven Testing for Login Functionality. Dim objFso, objTextstream, myLine, myField Set objFso = CreateObject(“Scripting.FileSystemObject”) Set objTextstream = objFso.OpenTextFile(“C:\Users\G C Reddy\Desktop\UFT.txt”) objTextstream.SkipLine Do Until objTextstream.AtEndOfStream = True myLine = objTextstream.ReadLine myField = Split(myLine, “, … Read more

UFT Class 29

UFT Class 29 (VBScript File System Operations) > What is Computer File System? It is a feature of Operating System, used to work with Drives, Folders and files. Computer understands things in terms of files only, Computer point of view everything is file. > Examples for File system Operations Create a folder Copy a folder … Read more

UFT Class 28

UFT Class 28 (VBScript Built in Functions part-2, Many to Many Comparisons Example) 28) CreateObject Function It creates an automation object in a specified class. Examples: Dim objFso ‘Create File System Object, It is used to work with Drives, folders and files. Set objFso = CreateObject(“Scripting.FileSystemObject”) Dim obJExcel ‘Create Excel Application object, It is used … Read more

UFT Class 27

UFT Class 27 (VBScript Built in Functions) 1) Abs Function (It returns absolute value) Dim val val = 100.75 Msgbox Abs(val) ‘100.75 val = 100.25 Msgbox Abs(val) ‘100.25 Msgbox Abs(100.60) ‘100.6 val = -100.85 Msgbox Abs(val) ‘100.85 2) Round Function Dim val val = 100.75 Msgbox Round(val) ‘101 val = 100.25 Msgbox Round(val) ‘100 Msgbox … Read more

UFT Class 26

UFT Class 26 (VBScript Loop Statements Part-2, VBScript Functions Part-1) VBScript Loop Statements Part-2 I) For…Next II) While…Wend III) Do While / Until…Loop a) Using While keyword It repeats a block of statements while condition is True Syntax: 1) Do While Condition Statements ——— ———- Increment/Decrement Loop ——————- Example: OrderNo = 1 Do While OrderNo … Read more

UFT Class 25

UFT Class 25 (VBScript Conditional Statements Part-2, VBScript Loop Statements) Usage of VBScript conditional statements 1) Execute a statement when condition is True/Simple if. 2) Execute a block of statements when condition is True. 3) Execute a block of statements when condition is True, otherwise execute another block of statements 4) Decide among several alternates … Read more

UFT Class 24

UFT Class 24 I) VBScript Operators a) Arithmetic Operators: Arithmetic Operators return value based result. ————————— 1) Exponentiation ^ 2) Multiplication * 3) Division / 4) Integer Division \ 5) Modules mod 6) Addition 7) Subtraction 8) Concatenation ———————- Example: Dim a, b, c a = 10 b = 3 c = a ^ b … Read more

UFT Class 23

UFT Class 23 (VBScript variables, Operators-1) III) VBScript Variables 1) What is Variable? A named memory location to store the data. Two types of Memory in Computer Environment: i) Primary Memory – RAM ii) Secondary Memory – HDD, DVD, USB drives etc… 2) Declaration of Variables Variables can be declared using either Public or Private … Read more

UFT Class 22

UFT Class 22 (VBScript Comments, Data Types) I) Comments in VBScript Comments are English words, we write comments for Code documentation. > Purpose of Comments: To make the code readable To make the code disable from execution > Syntax: Use Rem command before the statement followed by space. Use ‘ symbol before the statement Ex: … Read more

UFT Class 21

UFT Class 21 (VBScript Fundamentals and Features) 1) Comments To make the code readable To make the code disable from execution 2) Data Types VBScript supports implicit declaration of Data Types. In VBScript, only data type is Variant. Using VarType function we can check data sub-type Ex: Dim a a =”abcd” a = 123 a … Read more