SlideShare a Scribd company logo
1 of 28
Quality Assurance /
Software Testing Training
VBScript
Page 2Classification: Restricted
Agenda
• Overview of VB Script
• Variables
• Rules for Declaring Variables
• Option Explicit
• Comments
• Arrays
• Functions
• Calling a Function
• Function Parameters and return
• Sub Procedures
• Types of Conditional Statements
• Types of Looping Statements
• Loop Control Statements
Page 3Classification: Restricted
• VBScript (Visual Basic Script) is a general-purpose, lightweight and
active scripting language developed by Microsoft that is modelled
on Visual Basic.
• As it a scripting language, it is not actually compiled but
INTERPRETED!
• VBScript, for the most part, is case insensitive. It has a very simple
syntax, easy to learn and to implement.
• It uses Component Object Model (COM) in order to access the
elements of the environment in which it is executing.
Overview of VB Script
Page 4Classification: Restricted
• UFT is using VBScript as a scripting language
• VBScript is used for Client side scripting in Microsoft Internet
Explorer.
Overview of VB Script
Page 5Classification: Restricted
• Open a text editor (Notepad)
• Enter the code:
msgbox “Hello World”
• The msgbox function displays a message box and waits for the user
to click a button and then an action is performed based on the
button clicked by the user.
• Save it as My Script.vbs
• Double click on My Script.vbs to execute the code – A popup
message with the text “Hello World” appears.
Page 6Classification: Restricted
• Variable is a named memory location used to hold a value.
• VBScript has only ONE fundamental data type - Variant.
• Because of this you can store different types of data in VB easily
unlike other languages where you need to declare the variable
type like Integer, Decimal etc.
• Variables are declared using “dim” keyword
• dim [variable_name]
• Ex: dim a
Page 7Classification: Restricted
Variables
• Variable Name must begin with an alphabet.
• Variable names cannot exceed 255 characters
• Variables Should NOT contain a period(.)
• Variable Names should be unique in the declared context.
• Eg. Dim Employee
• Dim Unit99
• Dim Student_Age
• Dim 99Unit
• Dim student.age
Page 8Classification: Restricted
• The numeric values should be declared without double quotes.
a=10
• The String values should be enclosed within double quotes(")
a=“My Script”
• Date and Time variables should be enclosed within hash symbol(#)
a=#27/6/2016#
a=#04:30:44 PM#
Rules for Declaring Variables
Page 9Classification: Restricted
• Since VB is a loosely typed language just like other scripting
languages
• Loosely typed – Using a variable just by assigning a value alone .
Declaration is not mandatory.
• Note : It is always a good practice to declare variables & use it. This
makes your code more READABLE
Rules for Assigning Values to Variables
Page 10Classification: Restricted
• Option Explicit – is enforces “Variable Declaration”.
• If the first line of your code has “Option Explicit”, then all variables
that are to be used in the code should be explicitly declared.
• After that you can assign a value to them.
Option Explicit
dim a
a=10
• Invalid:
Option Explicit
a=10
Option Explicit
Page 11Classification: Restricted
• Comments are used to mark a piece of code so that it doesn't get
executed.
• The apostrophe is the special character VBScript uses as its
comment initiator.
• VB Script supports only ‘single line comments’ & does not support
“multi line comments”
• Example:
Option Explicit
dim myText ‘Variable declaration
myText=“Good Evening” ‘Assigning value
Msgbox myText ‘printing out the message to user
Comments
Page 12Classification: Restricted
• Arrays can hold more than one value in a single variable at a time.
• Unlike most conventional languages, VBScript Arrays can store any
type of variable in an array. Hence, an array can store an integer,
string or characters in a single array variable.
Arrays
Page 13Classification: Restricted
• Method 1 : Using Dim
dim arr1() 'Without Size
• Method 2 : Mentioning the Size
dim arr2(4) 'Declared with size of 4
• Array index will be starting from 0 (ZERO)
• Array Index Cannot be Negative.
• Method 3 : using 'Array' Parameter
dim arr3
arr3 = Array("apple","Orange","Grapes")
• The values are assigned to the array by specifying array index value
against each one of the values to be assigned. It can be a string.
dim arr(3)
arr(0) = 1 'Number
arr(1) = "VBScript“ 'String
Array Declaration
Page 14Classification: Restricted
Functions
• A function is a group of reusable code which can be called
anywhere in your program.
• This will enable programmers to divide a big program into a
number of small and manageable functions..
• Apart from inbuilt Functions, VBScript allows us to write user-
defined functions as well
• Basic Syntax:
Function Functionname(--parameter-list--)
statement 1
statement 2
………
statement n
End Function
Page 15Classification: Restricted
Calling a Function
• To invoke a function somewhere later in the script, you would
simple need to write the name of that function with
the Call keyword.
• Example:
Function Greeting()
Msgbox “Hi there!”
End Function
Call Greeting()
Page 16Classification: Restricted
Function Parameters and return
• Parameters can pass to the functions, which will be an input entry
to the function
• Function also can return some value back to the calling function,
this will be output from the function
• Example:
Dim a
a=“Mark”
msgbox Greeting(a) ‘Variable a is the input parameter here
Function Greeting(name)
Greeting = “Hi ”&name
End Function
Page 17Classification: Restricted
Sub Procedures
• Sub Procedures are similar to functions but there are few
differences.
• Sub procedures DONOT Return a value while functions may or may
not return a value.
• Sub procedures are called without call keyword
• Sub procedures are always enclosed within Sub and End Sub
statements.
• Basic Syntax:
Sub Procedurename(--parameter-list--)
statement 1
statement 2
statement n
End Sub
Page 18Classification: Restricted
Calling a Sub Procedure
• To invoke a Sub Procedure somewhere later in the script, you
would simple need to write the name of that Sub Procedure
without Call keyword.
• Sub procedure can also have parameters like function
• Example:
Sub Greeting()
Msgbox “Hi there!”
End Sub
Greeting() ‘calling a sub procedure
Page 19Classification: Restricted
Types of Conditional Statements
• if statement - consists of a Boolean expression followed by one or
more statements.
Syntax:
if (condition=true) Then
[conditional Statements]
End If
• if..else statement consists of a Boolean expression followed by one
or more statements. If the condition is True, the statements under
If statements are executed. If the condition is false, Else part of the
script is Executed
Page 20Classification: Restricted
Types of Conditional Statements
Syntax:
if (condition=true) Then
[conditional Statements_1]
Else
[conditional Statements_2]
End If
• if...elseif..else statement - An if statement followed by one or
more ElseIf Statements, that consists of boolean expressions and
then followed by an optional else statement, which executes when
all the condition becomes false.
Syntax:
if (condition=true) Then
[conditional Statements_1]
Elseif (Cndition = true) then
[conditional Statements_2]
Else
[default Conditional Statement]
End If
Page 21Classification: Restricted
Types of Conditional Statements
• nested if statements - An if or elseif statement inside another if or
elseif statement(s).
• switch statement - A switch statement allows a variable to be
tested for equality against a list of values.
Syntax:
Select Case expression
Case expressionlist1
[Statements]
Case expressionlist2
[Statements]
Case Else
[Default Statements]
End Select
Page 22Classification: Restricted
Types of Looping Statements
• for loop - Executes a sequence of statements multiple times and
abbreviates the code that manages the loop variable.
Syntax:
for counter=start to end [step count]
[Statements]
Next
Page 23Classification: Restricted
Types of Looping Statements
• for ..each loop - This is executed if there is at least one element in
group and reiterated for each element in a group.
Syntax:
for each element in group
[Statements]
Next
• while..wend – loop - This tests the condition before executing the
loop body.
Syntax:
while (condition is true)
[Statements]
wend
Page 24Classification: Restricted
Types of Looping Statements
• do..while loops - The do..While statements will be executed as long
as condition is True.(i.e.,) The Loop should be repeated till the
condition is False.
Syntax:
Do while (condition is true)
[Statements]
Loop
Page 25Classification: Restricted
Types of Looping Statements
• do..until loops - The do..Until statements will be executed as long
as condition is False.(i.e.,) The Loop should be repeated till the
condition is True.
Do Until (condition is false)
[Statements]
Loop
Page 26Classification: Restricted
Loop Control Statements
• Loop control statements change execution from its normal
sequence. When execution leaves a scope, all the remaining
statements in the loop are NOT executed.
• Exit For statement - Terminates the For loop statement and
transfers execution to the statement immediately following the
loop
• Exit Do statement - Terminates the Do While statement and
transfers execution to the statement immediately following the
loop
Page 27Classification: Restricted
Question?
Page 28Classification: Restricted
Thank You

More Related Content

What's hot

Web development basics (Part-4)
Web development basics (Part-4)Web development basics (Part-4)
Web development basics (Part-4)Rajat Pratap Singh
 
7400354 vbscript-in-qtp
7400354 vbscript-in-qtp7400354 vbscript-in-qtp
7400354 vbscript-in-qtpBharath003
 
2. overview of c#
2. overview of c#2. overview of c#
2. overview of c#Rohit Rao
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]srikanthbkm
 
LLVM Backend Porting
LLVM Backend PortingLLVM Backend Porting
LLVM Backend PortingShiva Chen
 
LLVM Instruction Selection
LLVM Instruction SelectionLLVM Instruction Selection
LLVM Instruction SelectionShiva Chen
 
Server Scripting Language -PHP
Server Scripting Language -PHPServer Scripting Language -PHP
Server Scripting Language -PHPDeo Shao
 
Introduction of lambda expression and predicate builder
Introduction of lambda expression and predicate builderIntroduction of lambda expression and predicate builder
Introduction of lambda expression and predicate builderLearningTech
 
Placement and variable 03 (js)
Placement and variable 03 (js)Placement and variable 03 (js)
Placement and variable 03 (js)AbhishekMondal42
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced JavascriptDhruvin Shah
 

What's hot (19)

Qtp - Introduction to fundamentals of vbscript
Qtp - Introduction to fundamentals of vbscriptQtp - Introduction to fundamentals of vbscript
Qtp - Introduction to fundamentals of vbscript
 
Web development basics (Part-4)
Web development basics (Part-4)Web development basics (Part-4)
Web development basics (Part-4)
 
7400354 vbscript-in-qtp
7400354 vbscript-in-qtp7400354 vbscript-in-qtp
7400354 vbscript-in-qtp
 
2. overview of c#
2. overview of c#2. overview of c#
2. overview of c#
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
VB Script
VB ScriptVB Script
VB Script
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
 
LLVM Backend Porting
LLVM Backend PortingLLVM Backend Porting
LLVM Backend Porting
 
Java script
Java scriptJava script
Java script
 
Generics
GenericsGenerics
Generics
 
LLVM Instruction Selection
LLVM Instruction SelectionLLVM Instruction Selection
LLVM Instruction Selection
 
Js mod1
Js mod1Js mod1
Js mod1
 
Qtp Scripts
Qtp ScriptsQtp Scripts
Qtp Scripts
 
Server Scripting Language -PHP
Server Scripting Language -PHPServer Scripting Language -PHP
Server Scripting Language -PHP
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 
Introduction of lambda expression and predicate builder
Introduction of lambda expression and predicate builderIntroduction of lambda expression and predicate builder
Introduction of lambda expression and predicate builder
 
Placement and variable 03 (js)
Placement and variable 03 (js)Placement and variable 03 (js)
Placement and variable 03 (js)
 
Final exam
Final examFinal exam
Final exam
 
Advanced Javascript
Advanced JavascriptAdvanced Javascript
Advanced Javascript
 

Similar to VBScript Training for QA Professionals

has any rows using Count(). This way, you avoid the CS8604 error related to p...
has any rows using Count(). This way, you avoid the CS8604 error related to p...has any rows using Count(). This way, you avoid the CS8604 error related to p...
has any rows using Count(). This way, you avoid the CS8604 error related to p...Anwar Patel
 
Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp BookG.C Reddy
 
WT Unit-3 PPT.pptx
WT Unit-3 PPT.pptxWT Unit-3 PPT.pptx
WT Unit-3 PPT.pptxTusharTikia
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script TrainingsAli Imran
 
Session 03 - Elements of Java Language
Session 03 - Elements of Java LanguageSession 03 - Elements of Java Language
Session 03 - Elements of Java LanguagePawanMM
 
Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp Bookguestd9317c
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Rasan Samarasinghe
 
Learning core java
Learning core javaLearning core java
Learning core javaAbhay Bharti
 
CLEAN CODING AND DEVOPS Final.pptx
CLEAN CODING AND DEVOPS Final.pptxCLEAN CODING AND DEVOPS Final.pptx
CLEAN CODING AND DEVOPS Final.pptxJEEVANANTHAMG6
 
Java platform
Java platformJava platform
Java platformVisithan
 
9781305078444 ppt ch02
9781305078444 ppt ch029781305078444 ppt ch02
9781305078444 ppt ch02Terry Yoast
 
Best Coding Practices in Java and C++
Best Coding Practices in Java and C++Best Coding Practices in Java and C++
Best Coding Practices in Java and C++Nitin Aggarwal
 
gdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptxgdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptxsandeshshahapur
 

Similar to VBScript Training for QA Professionals (20)

has any rows using Count(). This way, you avoid the CS8604 error related to p...
has any rows using Count(). This way, you avoid the CS8604 error related to p...has any rows using Count(). This way, you avoid the CS8604 error related to p...
has any rows using Count(). This way, you avoid the CS8604 error related to p...
 
Java ce241
Java ce241Java ce241
Java ce241
 
Java script basics
Java script basicsJava script basics
Java script basics
 
Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp Book
 
Vbs
VbsVbs
Vbs
 
WT Unit-3 PPT.pptx
WT Unit-3 PPT.pptxWT Unit-3 PPT.pptx
WT Unit-3 PPT.pptx
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script Trainings
 
Session 03 - Elements of Java Language
Session 03 - Elements of Java LanguageSession 03 - Elements of Java Language
Session 03 - Elements of Java Language
 
Advanced Qtp Book
Advanced Qtp BookAdvanced Qtp Book
Advanced Qtp Book
 
C_plus_plus
C_plus_plusC_plus_plus
C_plus_plus
 
Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++Esoft Metro Campus - Programming with C++
Esoft Metro Campus - Programming with C++
 
Learning core java
Learning core javaLearning core java
Learning core java
 
CLEAN CODING AND DEVOPS Final.pptx
CLEAN CODING AND DEVOPS Final.pptxCLEAN CODING AND DEVOPS Final.pptx
CLEAN CODING AND DEVOPS Final.pptx
 
Typescript
TypescriptTypescript
Typescript
 
Java platform
Java platformJava platform
Java platform
 
9781305078444 ppt ch02
9781305078444 ppt ch029781305078444 ppt ch02
9781305078444 ppt ch02
 
Java Fx
Java FxJava Fx
Java Fx
 
Best Coding Practices in Java and C++
Best Coding Practices in Java and C++Best Coding Practices in Java and C++
Best Coding Practices in Java and C++
 
gdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptxgdscWorkShopJavascriptintroductions.pptx
gdscWorkShopJavascriptintroductions.pptx
 
Csharp
CsharpCsharp
Csharp
 

More from Fayis-QA

HP LoadRunner
HP LoadRunnerHP LoadRunner
HP LoadRunnerFayis-QA
 
Selenium WebDriver with Java
Selenium WebDriver with JavaSelenium WebDriver with Java
Selenium WebDriver with JavaFayis-QA
 
Core Java Basics
Core Java BasicsCore Java Basics
Core Java BasicsFayis-QA
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation TestingFayis-QA
 
Defect Life Cycle
Defect Life CycleDefect Life Cycle
Defect Life CycleFayis-QA
 
Testing Concepts and Manual Testing
Testing Concepts and Manual TestingTesting Concepts and Manual Testing
Testing Concepts and Manual TestingFayis-QA
 
Quality Standard
Quality StandardQuality Standard
Quality StandardFayis-QA
 
Agile in QA
Agile in QAAgile in QA
Agile in QAFayis-QA
 
Introduction to Software Testing Part- 2
Introduction to Software Testing Part- 2Introduction to Software Testing Part- 2
Introduction to Software Testing Part- 2Fayis-QA
 
Test Case Design and Technique
Test Case Design and TechniqueTest Case Design and Technique
Test Case Design and TechniqueFayis-QA
 
Test Strategies and Planning
Test Strategies and PlanningTest Strategies and Planning
Test Strategies and PlanningFayis-QA
 
Test Management
Test ManagementTest Management
Test ManagementFayis-QA
 
Types of Testing
Types of TestingTypes of Testing
Types of TestingFayis-QA
 

More from Fayis-QA (16)

HP LoadRunner
HP LoadRunnerHP LoadRunner
HP LoadRunner
 
Selenium WebDriver with Java
Selenium WebDriver with JavaSelenium WebDriver with Java
Selenium WebDriver with Java
 
Core Java Basics
Core Java BasicsCore Java Basics
Core Java Basics
 
Introduction to Automation Testing
Introduction to Automation TestingIntroduction to Automation Testing
Introduction to Automation Testing
 
HP ALM QC
HP ALM QCHP ALM QC
HP ALM QC
 
Defect Life Cycle
Defect Life CycleDefect Life Cycle
Defect Life Cycle
 
Testing Concepts and Manual Testing
Testing Concepts and Manual TestingTesting Concepts and Manual Testing
Testing Concepts and Manual Testing
 
Quality Standard
Quality StandardQuality Standard
Quality Standard
 
Agile in QA
Agile in QAAgile in QA
Agile in QA
 
SDLC
SDLCSDLC
SDLC
 
Introduction to Software Testing Part- 2
Introduction to Software Testing Part- 2Introduction to Software Testing Part- 2
Introduction to Software Testing Part- 2
 
Test Case Design and Technique
Test Case Design and TechniqueTest Case Design and Technique
Test Case Design and Technique
 
Test Strategies and Planning
Test Strategies and PlanningTest Strategies and Planning
Test Strategies and Planning
 
Agile
Agile Agile
Agile
 
Test Management
Test ManagementTest Management
Test Management
 
Types of Testing
Types of TestingTypes of Testing
Types of Testing
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

VBScript Training for QA Professionals

  • 1. Quality Assurance / Software Testing Training VBScript
  • 2. Page 2Classification: Restricted Agenda • Overview of VB Script • Variables • Rules for Declaring Variables • Option Explicit • Comments • Arrays • Functions • Calling a Function • Function Parameters and return • Sub Procedures • Types of Conditional Statements • Types of Looping Statements • Loop Control Statements
  • 3. Page 3Classification: Restricted • VBScript (Visual Basic Script) is a general-purpose, lightweight and active scripting language developed by Microsoft that is modelled on Visual Basic. • As it a scripting language, it is not actually compiled but INTERPRETED! • VBScript, for the most part, is case insensitive. It has a very simple syntax, easy to learn and to implement. • It uses Component Object Model (COM) in order to access the elements of the environment in which it is executing. Overview of VB Script
  • 4. Page 4Classification: Restricted • UFT is using VBScript as a scripting language • VBScript is used for Client side scripting in Microsoft Internet Explorer. Overview of VB Script
  • 5. Page 5Classification: Restricted • Open a text editor (Notepad) • Enter the code: msgbox “Hello World” • The msgbox function displays a message box and waits for the user to click a button and then an action is performed based on the button clicked by the user. • Save it as My Script.vbs • Double click on My Script.vbs to execute the code – A popup message with the text “Hello World” appears.
  • 6. Page 6Classification: Restricted • Variable is a named memory location used to hold a value. • VBScript has only ONE fundamental data type - Variant. • Because of this you can store different types of data in VB easily unlike other languages where you need to declare the variable type like Integer, Decimal etc. • Variables are declared using “dim” keyword • dim [variable_name] • Ex: dim a
  • 7. Page 7Classification: Restricted Variables • Variable Name must begin with an alphabet. • Variable names cannot exceed 255 characters • Variables Should NOT contain a period(.) • Variable Names should be unique in the declared context. • Eg. Dim Employee • Dim Unit99 • Dim Student_Age • Dim 99Unit • Dim student.age
  • 8. Page 8Classification: Restricted • The numeric values should be declared without double quotes. a=10 • The String values should be enclosed within double quotes(") a=“My Script” • Date and Time variables should be enclosed within hash symbol(#) a=#27/6/2016# a=#04:30:44 PM# Rules for Declaring Variables
  • 9. Page 9Classification: Restricted • Since VB is a loosely typed language just like other scripting languages • Loosely typed – Using a variable just by assigning a value alone . Declaration is not mandatory. • Note : It is always a good practice to declare variables & use it. This makes your code more READABLE Rules for Assigning Values to Variables
  • 10. Page 10Classification: Restricted • Option Explicit – is enforces “Variable Declaration”. • If the first line of your code has “Option Explicit”, then all variables that are to be used in the code should be explicitly declared. • After that you can assign a value to them. Option Explicit dim a a=10 • Invalid: Option Explicit a=10 Option Explicit
  • 11. Page 11Classification: Restricted • Comments are used to mark a piece of code so that it doesn't get executed. • The apostrophe is the special character VBScript uses as its comment initiator. • VB Script supports only ‘single line comments’ & does not support “multi line comments” • Example: Option Explicit dim myText ‘Variable declaration myText=“Good Evening” ‘Assigning value Msgbox myText ‘printing out the message to user Comments
  • 12. Page 12Classification: Restricted • Arrays can hold more than one value in a single variable at a time. • Unlike most conventional languages, VBScript Arrays can store any type of variable in an array. Hence, an array can store an integer, string or characters in a single array variable. Arrays
  • 13. Page 13Classification: Restricted • Method 1 : Using Dim dim arr1() 'Without Size • Method 2 : Mentioning the Size dim arr2(4) 'Declared with size of 4 • Array index will be starting from 0 (ZERO) • Array Index Cannot be Negative. • Method 3 : using 'Array' Parameter dim arr3 arr3 = Array("apple","Orange","Grapes") • The values are assigned to the array by specifying array index value against each one of the values to be assigned. It can be a string. dim arr(3) arr(0) = 1 'Number arr(1) = "VBScript“ 'String Array Declaration
  • 14. Page 14Classification: Restricted Functions • A function is a group of reusable code which can be called anywhere in your program. • This will enable programmers to divide a big program into a number of small and manageable functions.. • Apart from inbuilt Functions, VBScript allows us to write user- defined functions as well • Basic Syntax: Function Functionname(--parameter-list--) statement 1 statement 2 ……… statement n End Function
  • 15. Page 15Classification: Restricted Calling a Function • To invoke a function somewhere later in the script, you would simple need to write the name of that function with the Call keyword. • Example: Function Greeting() Msgbox “Hi there!” End Function Call Greeting()
  • 16. Page 16Classification: Restricted Function Parameters and return • Parameters can pass to the functions, which will be an input entry to the function • Function also can return some value back to the calling function, this will be output from the function • Example: Dim a a=“Mark” msgbox Greeting(a) ‘Variable a is the input parameter here Function Greeting(name) Greeting = “Hi ”&name End Function
  • 17. Page 17Classification: Restricted Sub Procedures • Sub Procedures are similar to functions but there are few differences. • Sub procedures DONOT Return a value while functions may or may not return a value. • Sub procedures are called without call keyword • Sub procedures are always enclosed within Sub and End Sub statements. • Basic Syntax: Sub Procedurename(--parameter-list--) statement 1 statement 2 statement n End Sub
  • 18. Page 18Classification: Restricted Calling a Sub Procedure • To invoke a Sub Procedure somewhere later in the script, you would simple need to write the name of that Sub Procedure without Call keyword. • Sub procedure can also have parameters like function • Example: Sub Greeting() Msgbox “Hi there!” End Sub Greeting() ‘calling a sub procedure
  • 19. Page 19Classification: Restricted Types of Conditional Statements • if statement - consists of a Boolean expression followed by one or more statements. Syntax: if (condition=true) Then [conditional Statements] End If • if..else statement consists of a Boolean expression followed by one or more statements. If the condition is True, the statements under If statements are executed. If the condition is false, Else part of the script is Executed
  • 20. Page 20Classification: Restricted Types of Conditional Statements Syntax: if (condition=true) Then [conditional Statements_1] Else [conditional Statements_2] End If • if...elseif..else statement - An if statement followed by one or more ElseIf Statements, that consists of boolean expressions and then followed by an optional else statement, which executes when all the condition becomes false. Syntax: if (condition=true) Then [conditional Statements_1] Elseif (Cndition = true) then [conditional Statements_2] Else [default Conditional Statement] End If
  • 21. Page 21Classification: Restricted Types of Conditional Statements • nested if statements - An if or elseif statement inside another if or elseif statement(s). • switch statement - A switch statement allows a variable to be tested for equality against a list of values. Syntax: Select Case expression Case expressionlist1 [Statements] Case expressionlist2 [Statements] Case Else [Default Statements] End Select
  • 22. Page 22Classification: Restricted Types of Looping Statements • for loop - Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. Syntax: for counter=start to end [step count] [Statements] Next
  • 23. Page 23Classification: Restricted Types of Looping Statements • for ..each loop - This is executed if there is at least one element in group and reiterated for each element in a group. Syntax: for each element in group [Statements] Next • while..wend – loop - This tests the condition before executing the loop body. Syntax: while (condition is true) [Statements] wend
  • 24. Page 24Classification: Restricted Types of Looping Statements • do..while loops - The do..While statements will be executed as long as condition is True.(i.e.,) The Loop should be repeated till the condition is False. Syntax: Do while (condition is true) [Statements] Loop
  • 25. Page 25Classification: Restricted Types of Looping Statements • do..until loops - The do..Until statements will be executed as long as condition is False.(i.e.,) The Loop should be repeated till the condition is True. Do Until (condition is false) [Statements] Loop
  • 26. Page 26Classification: Restricted Loop Control Statements • Loop control statements change execution from its normal sequence. When execution leaves a scope, all the remaining statements in the loop are NOT executed. • Exit For statement - Terminates the For loop statement and transfers execution to the statement immediately following the loop • Exit Do statement - Terminates the Do While statement and transfers execution to the statement immediately following the loop