test automation.ppt
TRANSCRIPT
-
8/10/2019 Test Automation.ppt
1/61
Test Automation
Performing the testing tasks using automationtools is known as test automation.
OR
It is a process of using the software to controlthe execution of tests and comparison of actualoutcomes with the predictable outcomes.
Note: Commonly S/W test automation isautomating the manual testing process currentlyin use.
-
8/10/2019 Test Automation.ppt
2/61
Benefits of Automation
1. Fast:-
Run faster than human users.
Eg: To execute 2500 test cases it takes 3months. In tool it will take 3-4 days cost willbe less as the time is saved.
2. Reliable:-For the same operations performed each
time, results obtained can be trusted over atime, as there is no human interface.
-
8/10/2019 Test Automation.ppt
3/61
3. Repeatable:-
Scripts written for an application or module can
be executed time and again for many times. Likefor regression and smoke testing we need toexecute test cases repeat ably in that case it isvery beneficial.
4.Reusable:-
Test script written for a module if needed inafter some time for another module same as
pervious one script can be copied and used asmany time as needed.
-
8/10/2019 Test Automation.ppt
4/61
5. Scalable or Programmable:-
It is possible to modify the script written earlier.
Eg: we get a change in requirements after release ofbuild in such case need not to write whole scriptfrom beginning, we can use pervious script and can
just add or delete programmable features as per
need.6. Comprehensive:-
No of requirements covered by test script is very
large.Eg: In manual testing for each requirement
corresponding test case is desired. Thus the volume
of test cases is very large. But single test script
-
8/10/2019 Test Automation.ppt
5/61
Test Automation process overview
1. Prepare automaton frame work
2. Evaluate the tool (Which tool we have to use)3. Create object repository
4. Generate obtain test data
5. Generating the test script as per the test suits.6. Review the script
7. Fix review comment
8. Enhance the test script9. Debug the script
10. Execute test script
11. Analyze the result
-
8/10/2019 Test Automation.ppt
6/61
Evaluation Of Tool
Factors consider to select a particular tool for
automation.1. Compatibility Issue:-
The tool support the environment or not. Like
.NET environment not for Win Runner.
2. Cost Consideration/Licensing:-
What is cost of tool and how many license arerequired.
-
8/10/2019 Test Automation.ppt
7/61
-
8/10/2019 Test Automation.ppt
8/61
-
8/10/2019 Test Automation.ppt
9/61
Cant Be Automated
This are the cases for which we cant go forautomation testing.
1. Usability2. AD-Hoc
3. One time testing
4. Human Interface5. Third party modules/Features (Like Link
Testing).
-
8/10/2019 Test Automation.ppt
10/61
Quick Test Professional
Vendor = HP
Script = VB Script
Support Site = www.mercury.comLatest Version = 10.2
Stabilize Version = 9.5 (Widely used in
companies).Studying Here = 9.2 (Similar to 9.5
Version).
http://www.mercury.com/http://www.mercury.com/ -
8/10/2019 Test Automation.ppt
11/61
QTP Licensing
1. www.mercury.comDemo License downloadQTP/Demo version for 14 days.
2. Seat License:-
Once we install in system we cant able tocopy to any other system. Its cost around 5to 6 Laces.
3. Concurrent License:-It cost around 20 Laces for 3 systems.
http://www.mercury.com/http://www.mercury.com/ -
8/10/2019 Test Automation.ppt
12/61
Visual Basics
Variable:-
It is a storage space contains theinformation.
DIM(Dimension):-
Key word used for declaring a variable.It is used to declare int, float, character, andstring.
Key word:-Keywords have fixed meaning and these
meaning cannot be changed.
-
8/10/2019 Test Automation.ppt
13/61
MsgBox:-
It used to display the contains ofvariables
And display the sum of No. , stored in
variable.
InputBox:-Popup the edit field.
-
8/10/2019 Test Automation.ppt
14/61
Example for variable,
keyword, MsgBox, InputBox
Dim a,b,c
a=34
b=12c=a+b
msgbox c
-
8/10/2019 Test Automation.ppt
15/61
Rules For Naming The
Variable1. It should begin with a letter.
2. Should not contain (.) Period.
3. It should not exceed 255character.
4. It should be unique in scope inwhich it is declared.
-
8/10/2019 Test Automation.ppt
16/61
Implicit Declaration:-
If variables are not declare in thebeginning it is called implicitdeclaration.
Option Explicit:-Its a function used to write before
writing program, it tells each variable
should be declared separately. This is
called Explicit and in VB Its optionally.
-
8/10/2019 Test Automation.ppt
17/61
Operators
An operator is a symbol that tells thecomputer to perform certain mathematical orlogical manipulations.
There are three types of operators which weare going to use in VB. They are
1. Arithmetic operators
2. Relational operators
3. Logical operators.
-
8/10/2019 Test Automation.ppt
18/61
Arithmetic Operators
Operators Meaning
+ Addition- Subtraction
* Multiplication
/ Division
-
8/10/2019 Test Automation.ppt
19/61
Relational Operators
Operators Meaning
= Is equal to< Is less than
Is greater than>= Is greater than or equal
-
8/10/2019 Test Automation.ppt
20/61
Logical Operator
Operators Meaning
AND Logical ANDOR Logical OR
NOT Logical NOT
-
8/10/2019 Test Automation.ppt
21/61
VB has one data type called Variant
Sub data types are
1. Null2. Empty
3. Int
4. Single5. Double
6. Date
7. Boolean8. Byte
-
8/10/2019 Test Automation.ppt
22/61
Type Name:-
It is used to know the data type of a variable.
Eg:-Dim aa="Hello"
msgbox typename(a)
Var Type:-It will show the number of byte cantinas the
data type.
Eg:- Dim aa="Hello"
msgbox vartype(a)
-
8/10/2019 Test Automation.ppt
23/61
Cbool:-
It is used for Boolean value either T/F.
Eg:- Dim a,b,ca=9
b=5
c=cbool(a>b)msgbox c
-
8/10/2019 Test Automation.ppt
24/61
Isnull:-
It shows the variable is null or not.
Dim a,ba=null
b=isnull(a)
msgbox bOR
Dim a,b
A=7B=isnull(a)
msgbox b
Ci t Gi th i t l f th i bl
-
8/10/2019 Test Automation.ppt
25/61
Cint:- Gives the int value of the variable.
Eg:Dim a,b,c
a=inputbox("Enter a number")
b=inputbox("Enter a number")
a=cint(a)
b=cint(b)
c=a+b
msgbox c
Eg:Dim aa=19.89
b=cint(a)
msgbox b
I b ilt f ti th t QTP
-
8/10/2019 Test Automation.ppt
26/61
Inbuilt function that QTP
supports.
1. Abs:-It returns absolute value of a number. Always
gives positive value if any negative number
entered.Eg:- Dim MyNumber
MyNumber = Abs(50.3)
msgbox mynumberMyNumber = Abs(-50.3)
msgbox mynumber
2 ASC:
-
8/10/2019 Test Automation.ppt
27/61
2. ASC:-
Returns the ANSI character code correspondingto the first letter in the string.
Eg:- Dim ResRes=inputbox("Please enter")
res = asc(Res)
MsgBox res3. Round:-
Round off the decimal number.
Eg:- Dim mynumber
mynumber=inputbox("Please enter a float")
mynumber=round(mynumber)
msgbox mynumber
S
-
8/10/2019 Test Automation.ppt
28/61
4. Sqr:-
Returns the square root of a number.
Eg:- Dim a
a=2
mysqr=sqr(a)
msgbox mysqr
5. Time:-
Returns the current system time.
Eg:- Dim systime
systime=time
msgbox time
6 Date:
-
8/10/2019 Test Automation.ppt
29/61
6. Date:-
Returns the current date system date.
Eg:- Dim mydate
mydate=datemsgbox mydate
7. Mid:-
Returns a specified number of characters from astring.
Syntax: MID( string, start[length])
Eg:- Dim MyVar
MyVar = Mid("VB Script is fun!",4,6)
msgbox myvar
-
8/10/2019 Test Automation.ppt
30/61
8. Left:-
Returns a specified number of characters from aleft side of the string.
Syntex: Left( String , length )
Eg:- Dim MyString, LeftString
MyString = "VBSCript"
LeftString = Left(MyString, 3)
MsgBox leftstring
9 Right:
-
8/10/2019 Test Automation.ppt
31/61
9. Right:-
Returns a specified number of characters fromright side of the string.
Syntax: Right( String , Length)
Eg: Dim AnyString, MyStr
AnyString = "Hello World"
MyStr = Right(AnyString, 1)
msgbox mystr
MyStr = Right(AnyString, 6)
msgbox mystr
MyStr = Right(AnyString, 100)
msgbox mystr
10 Instring:-
-
8/10/2019 Test Automation.ppt
32/61
10. Instring:Returns the position of the first occurrence of onestring within another.
Syntax: InStr([start, ]string1, string2[, compare])
Eg:-
Dim SearchString, SearchChar, MyPosSearchString ="XXpXXpXXPXXP"
SearchChar = "P"MyPos = Instr(4, SearchString, SearchChar, 1)
msgbox mypos
MyPos = Instr(1, SearchString, SearchChar, 0)
MsgBox myposMyPos = Instr(SearchString, SearchChar)MsgBox mypos
MyPos = Instr(1, SearchString, "W")
MsgBox mypos
C t l t t t /D i i
-
8/10/2019 Test Automation.ppt
33/61
Control statement /Decision
Making
The are three types of controlstatement in VB.
1. If Then ,EndIf
2. If Then , else
3. Nested If.
1 If Then EndIF:
-
8/10/2019 Test Automation.ppt
34/61
1. If Then,EndIF:-
Syntex:-
If Condition Then
Statement
EndIF
Eg:-
Dim val
val=InputBox("Please enter a number")
If val=1 Then
msgbox "One
End If
2 If Then Else:-
-
8/10/2019 Test Automation.ppt
35/61
2. If Then,Else:
Syntax:-
If Condition Then
StatementElse
Statement
End IF
Eg:-Dim val
val=InputBox("Please enter a number")
If val=1 Then
msgbox "Oneelse
MsgBox "Wrong Number
End If
3 Nested IF:
-
8/10/2019 Test Automation.ppt
36/61
3. Nested IF:-
Syntax:-
If condition Then
Statement
Elseif Condition Then
Statement
ElseIf Condition Then
Statement
Else
Statement
End IF
Eg:-
-
8/10/2019 Test Automation.ppt
37/61
Eg:-
Dim val
val=InputBox("Please enter a number")
If val=1 Then
msgbox "One"
elseif val=2 then
msgbox "Two"
elseif val=3 Then
msgbox "Three"
else
Msgbox "Wrong Number"
End If
Select case statement:-
-
8/10/2019 Test Automation.ppt
38/61
Eg:-
Dim val
val=InputBox("Please Enter a Name")
Select case valCase "Raj"
msgbox "He is a Good guy"
Case "Riya"
msgbox "She is a Good Girl"
Case "Ram"
msgbox "Funny Guy"
Case "Kumar"
msgbox "Good Person"
Case elsemsgbox "Have A Great Day"
End Select
Loops
-
8/10/2019 Test Automation.ppt
39/61
Loops
Repeats a group of statements for a specified
number of times.1. ForNext:-
Syntax:-
For Counter=Start To EndStatement
Next
Eg:-For i = 1 to 10
msgbox "We are in cycle" & i
Next
-
8/10/2019 Test Automation.ppt
40/61
Counter is a numerical variableused as loop counter.
Start is the initial value of
counter.End is a final value.
Statement is the amount , the
counter is to check each time.
2 While ..Wend:-
-
8/10/2019 Test Automation.ppt
41/61
2 While ..Wend:
Executes a series of statements as long as a givencondition is true.
Syntax:-While Condition
Statement
Wend
Eg:-
Dim counter
counter = 0
While (counter < 10)counter = counter +1
MsgBox counter
Wend
3. DoLoop While:-
-
8/10/2019 Test Automation.ppt
42/61
3. DoLoop While:
Repeats a block of statements while a condition istrue. But it should start with a statements
executing.Eg:-
Dim name,var,str
Do
name=InputBox ("enter the name")
var=ucase(name)
MsgBox("you entered" &var)
str=inputbox("Do u want to continue")
loop while ((str="Yes") or (str="YES") or (str="yes"))
msgbox ("Exit")
4 Do Until:-
-
8/10/2019 Test Automation.ppt
43/61
4. DoUntil:
Repeats a block of statement untill conditionbecomes true.
Eg:-
Do until str=vbNo
name=InputBox ("enter the name")
var=ucase(name)
MsgBox("you entered" &var)
str=msgbox("Do u want to continue",vbYesNo)
loop
-
8/10/2019 Test Automation.ppt
44/61
Arrays
An array is a structured data type consistingof a group of elements that share a commonname and each element can be of same or
different data type.
Collection of similar data type.
Arrays can be declared in two ways.
1. Fixed Array
2. Dynamic Array
Fixed Array
-
8/10/2019 Test Automation.ppt
45/61
Fixed ArrayThe array element is fixed, we have to give the
array size.
Eg:-
Dim std(03)
std(0) ="Arun"
std(1)="Venket"
std(2)="Ganesh"
std(3)="lo"best=std(3)
MsgBox best
-
8/10/2019 Test Automation.ppt
46/61
Dynamic Array
The array element is not fixed we can put asmany as value we want.
Eg:-
Dim std, best
std=array("a","b","c","d","e","f")
Best=std(4)msgbox best
-
8/10/2019 Test Automation.ppt
47/61
Re-Dimensioning Of Array
Once the size of an array isdeclared and further in future
while writing a program wants toalter the array size, For that we
use ReDim key word.
-
8/10/2019 Test Automation.ppt
48/61
Preserve
When we re-dimension the array the earlierelements will erase.
If you want to save earlier data. Then we use akey word called preserve.
This is the use of preserve.
Example for both Redim and preserve:-
-
8/10/2019 Test Automation.ppt
49/61
Example for both Redim and preserve:
ReDim std(3)
std(0)="a"
Std(1)="b"
std(2)="c"
std(3)="d"
For i = 0 to 3
Note:-Continued in next page.
-
8/10/2019 Test Automation.ppt
50/61
msgbox std(i)
NextReDim preserve std(4)
std(4)="f"
For i = 0 to 4msgbox std(i)
Next
Assignment
-
8/10/2019 Test Automation.ppt
51/61
Assignment
1. Find the position of d from the string I love my
india.2. Write a program that should ask the user to enter
his name. once the user enter his name, the name
should be displayed your name contains _character.
3. Write a program that should ask the user to enter avalue , the same should be displayed in upper case
and prompt the user whether he want to enteranother value and the user says(SURE) (sure)(Sure) program should continue. Else It should
display Good Bye.
-
8/10/2019 Test Automation.ppt
52/61
Quick Test Professional
-
8/10/2019 Test Automation.ppt
53/61
Quick Test Professional
QTP (Quick Test Professional) is Mercurys advancedKeyword driven testing solution. QTPis a GraphicalUser Interface testing tool created by the HPsubsidiary Mercury Interactive for functional test andregression test automation.
QuickTest Professional satisfies the needs of bothtechnical and non-technical users. It enables to deployhigher-quality applications faster, cheaper, and withless risk. QTP enables to test standard web objects,
Activex controls and Visual basic controls.QTPuses a scripting language built on top of VBScript
to specify the test procedure, and to manipulate theobjects and controls of the application under test.
QTP Supports Different Kind Of Applications Such
-
8/10/2019 Test Automation.ppt
54/61
pp ppAs:
Standard Windows Applications.
Web Objects.
ActiveX Controls
.Net
.Java
SAP (Applications and Products in Data Processing)
Visual Basic application.
Siebel
Oracle
People Soft
QTP testing Overview process
-
8/10/2019 Test Automation.ppt
55/61
QTP testing Overview process
The QuickTest testing process consists of 7 mainphases:
1. Preparing To Record:-
Before recording a test, confirm that the applicationand QuickTest are set to match the needs of the test.
Make sure the application displays elements on whichthe recording should be done, such as a toolbar or a
special window pane, For example, and that theapplication options are set as expected for thepurposes of the test.
-
8/10/2019 Test Automation.ppt
56/61
2. Recording A Session On The Application:-
As navigated through the application
or Web site, QuickTest graphically displays
each step performed in the form of acollapsible icon-based test tree. A step is any
user action that causes or makes a change in
the application, such as clicking a link orimage, or entering data in a form.
-
8/10/2019 Test Automation.ppt
57/61
3. Enhancing The Test:-
Inserting checkpoints into the test lets to search for a
specific value of a page, object or text string, which
helps to identify whether or not the application or site is
functioning correctly?Broadening the scope of the test, by replacing fixed
values with parameters, lets to check how the
application performs the same operations with multiple
sets of data.
Adding logic and conditional statements enables to add
sophisticated checks to the test.
-
8/10/2019 Test Automation.ppt
58/61
4. Debugging The Test:-
A test is debugged to check that it operatessmoothly and without interruption.
5. Running The Test:-
A test is executed to check the behaviorof the application or Web site. While running,QuickTest opens the application, or connects to the
Web site, and performs each step in the test.
-
8/10/2019 Test Automation.ppt
59/61
6. Analyzing The Test Results:-Examine the test results to pinpoint
defects in the application.
7. Reporting Defects:-If TestDirector is installed, the defects
discovered can be reported to a database.TestDirector is Mercury Interactive softwaretest management tool.
What is Add-in?
-
8/10/2019 Test Automation.ppt
60/61
Add in provides set of classes, methods andproperties to QTP, So that QTP can understand the
application and perform the operation.By default QTP comes with 3 Add-ins:
1. Web
2. ActiveX3. Visual Basics
QTP does not require any Add-in to work on Standard
windows applicationAdd-ins can only be loaded when starting QTP
Once the selected Add-ins are loaded, QTP window
will show up
-
8/10/2019 Test Automation.ppt
61/61
Some of the Add-ins available for QTP 9.2 are
.NET
Java
SAP
Siebel
Stingray
VisualAge
Web Services