UFT Tutorial 20

UFT Class 20 (Overview on VBScript)

I) Introducing VBScript

Visual Basic Scripting Edition

> VBScript was launched in 1997

> Vendor: Microsoft

> VbScript derived from VB Programming language

> VBScript not a case sensitive language

Dim a
A = 100
Msgbox a '100

> VBScript ignores extra spaces

Dim             a

a =       100

Msgbox a

Ex 2:
Dim a 'Space is Mandatory
a = 100 'Spaces optional

> VBScript is Platform dependent

> No formalities for writing statements

> using : symbol we can join statements
Dim a : a = 100 : Msgbox a

> Using _ symbol we can split statements
Msgbox _
"Hello UFT"

II) Scripting Languages Versus Programming Languages

Scripting Languages                             Programming Languages
Ex: Shell, Perl, VBScript,                     COBOL, C, C++, Java, VB, C# etc...
JavaScript, Python, Ruby, Rexx etc...
Interpreter based                               Compiler based
(At a time compilation)                      (Step by step compilation)
> Writing the code                             > Writing code
> Executing code                              > Compiling the code
                                                       > Executing the code
Implicit Declaration of                       Explicit declaration of Data types
Data types

VbScript                Java
Dim a                    int a;
a = 100                    a =100;
----                    char b;
a ="abcd"
a = 1.23
a = #10/10/2010#
Explicit and Implicit declaration      Explicit declaration of Variables
of Variables

VbScript:                Java:
Dim a                    int a;
a = 100 'Explicit variable              a = 100;
b= 200 'Implicit variable              b = 200; \\ Error
Msgbox a + b
Limited Support for UI design        Rich support for UI design
Limited support for Application       Rich support for Application development
Limited support for Graphics design    Rich support
Can be easily integrated with        Difficult to integrate
other technologies
Reduce the code size                  Increase the code size
III) Usage of VBScript
1) Clint side scripting in the Web
    > Browser (IE) executes VBScript code
    > Web developers integrate VBScript code components into HTML tags

2) Server side scripting in the web
    > Web server (IIS) executes VBScript code
    > Web developers integrate VBScript code in ASP.

3) Network Administration on Server OS (ex: Windows 2008 server)
    > AOM (Automation Object Model) executes VBScript code

4) System Administration on Client OS (ex: Windows 7)
    > AOM executes VBScript code.

Note: AOM is an administration tool of Windows operating system and
It has VbScript engine, any file comes with .vbs extension then AOM launches
VbScript engine, it executes VbScript code.

If you want execute Perl code from Windows,

> Download and install Perl engine

> Write Perl code in note pad and save with .pl extension.

> Any file comes .pl the AOM launches Perl engine
5) Test Automation (UFT)
> VBScript engine integrated in UFT, It can execute VBScript code.


Post a Comment