Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 6

Cookie Testing

Author Ajay Sharma


Ref: SAPE/DOC/001
Version: 0.1 Prepare !y Sapient for C"ientname
#n $e!ruary #00% 0
DRAFT
Cookie Testing
Introduction
&his o'ument ta"(s a!out )hat e*a't"y 'oo(ies are an ho) they )or(. +t )ou" !e easy for you
to unerstan the test 'ases for testin, 'oo(ies )hen you ha-e '"ear unerstanin, of ho)
'oo(ies )or(. /o) 'oo(ies store on har ri-e. An ho) 'an )e eit 'oo(ie settin,s.
+n summary0 )e )ou" 'o-er the fo""o)in,:
1hat is Coo(ie.
1hy Coo(ies are use.
/o) 'oo(ies )or(.
12 Session 'oo(ies
#2 Persistent 'oo(ies
1here 'oo(ies are store.
/o) 'oo(ies are store.
App"i'ations )here 'oo(ies 'an !e use:
Dra)!a'(s of 'oo(ies.
Some 3ajor &est 'ases for )e! app"i'ation 'oo(ie testin,
Author: Ajay Sharma
Version: 0.1
0#
n
4une #011
DRAFT
Cookie Testing
What is Cookie?
Coo(ie is sma"" information store in te*t fi"e on user5s har ri-e !y )e! ser-er. &his information is "ater use !y
)e! !ro)ser to retrie-e information from that ma'hine. 6enera""y 'oo(ie 'ontains persona"i7e user ata or
information that is use to 'ommuni'ate !et)een ifferent )e! pa,es.

Why Cookies are used?
Coo(ies are nothin, !ut the user5s ientity an use to tra'( )here the user na-i,ate throu,hout the )e! site
pa,es. &he 'ommuni'ation !et)een )e! !ro)ser an )e! ser-er is state"ess.
$or e*amp"e if you are a''essin, omain http://))).e*amp"e.'om/1.htm" then )e! !ro)ser )i"" simp"y 8uery to
e*amp"e.'om )e! ser-er for the pa,e 1.htm". 9e*t time if you type pa,e as http://))).e*amp"e.'om/#.htm" then
ne) re8uest is sen to e*amp"e.'om )e! ser-er for senin, #.htm" pa,e an )e! ser-er on5t (no) anythin,
a!out to )hom the pre-ious pa,e 1.htm" ser-e.
1hat if you )ant the pre-ious history of this user 'ommuni'ation )ith the )e! ser-er. :ou nee to maintain the
user state an intera'tion !et)een )e! !ro)ser an )e! ser-er some)here. &his is )here 'oo(ie 'omes into
pi'ture. Coo(ies ser-e the purpose of maintainin, the user intera'tions )ith )e! ser-er.

How cookies work?
&he /&&P proto'o" use to e*'han,e information fi"es on the )e! is use to maintain the 'oo(ies. &here are t)o
types of /&&P proto'o". State"ess /&&P an Statefu" /&&P proto'o". State"ess /&&P proto'o" oes not (eep any
re'or of pre-ious"y a''esse )e! pa,e history. 1hi"e Statefu" /&&P proto'o" o (eep some history of pre-ious
)e! !ro)ser an )e! ser-er intera'tions an this proto'o" is use !y 'oo(ies to maintain the user intera'tions.
1hene-er user -isits the site or pa,e that is usin, 'oo(ie0 sma"" 'oe insie that /&3; pa,e <6enera""y a 'a"" to
some "an,ua,e s'ript to )rite the 'oo(ie "i(e 'oo(ies in 4AVAS'ript0 P/P0 Per"2 )rites a te*t fi"e on users
ma'hine 'a""e 'oo(ie.
/ere is one e*amp"e of the 'oe that is use to )rite 'oo(ie an 'an !e p"a'e insie any /&3; pa,e:
Set=Coo(ie: 9A3E>VA;?E@ e*pires>DA&E@ path>PA&/@ omain>DO3A+9A9A3E@
1hen user -isits the same pa,e or omain "ater time this 'oo(ie is rea from is( an use to ientify the
se'on -isit of the same user on that omain. E*piration time is set )hi"e )ritin, the 'oo(ie. &his time is e'ie
!y the app"i'ation that is ,oin, to use the 'oo(ie.
6enera""y t)o types of 'oo(ies are )ritten on user ma'hine.

1) Session cookies: &his 'oo(ie is a'ti-e ti"" the !ro)ser that in-o(e the 'oo(ie is open. 1hen )e '"ose the
!ro)ser this session 'oo(ie ,ets e"ete. Sometime session of say #0 minutes 'an !e set to e*pire the 'oo(ie.
) !ersistent cookies: &he 'oo(ies that are )ritten permanent"y on user ma'hine an "ast for months or years.

Where cookies are stored?
Author: Ajay Sharma
Version: 0.1
0#
n
4une #011
DRAFT
Cookie Testing
1hen any )e! pa,e app"i'ation )rites 'oo(ie it ,et sa-e in a te*t fi"e on user har is( ri-e. &he path )here
the 'oo(ies ,et store epens on the !ro)ser. Different !ro)sers store 'oo(ie in ifferent paths. E.,. +nternet
e*p"orer store 'oo(ies on path "C:#Docu$ents and Settings#De%au&t 'ser#Cookies(
/ere the BDefau"t ?serC 'an !e rep"a'e !y the 'urrent user you "o,,e in as. ;i(e BAministratorC0 or user name
"i(e BVijayC et'.
&he 'oo(ie path 'an !e easi"y foun !y na-i,atin, throu,h the !ro)ser options. +n 3o7i""a $irefo* !ro)ser you
'an e-en see the 'oo(ies in !ro)ser options itse"f. Open the 3o7i"a !ro)ser0 '"i'( on &oo"s=DOptions=DPri-a'y
an then BSho) 'oo(iesC !utton.

How cookies are stored?
;et5s ta(e e*amp"e of 'oo(ie )ritten !y reiff.'om on 3o7i""a $irefo* !ro)ser:
On 3o7i""a $irefo* !ro)ser )hen you open the pa,e reiff.'om or "o,in to your reiffmai" a''ount0 a 'oo(ie )i""
,et )ritten on your /ar is(. &o -ie) this 'oo(ie simp"y '"i'( on BSho) 'oo(iesC !utton mentione on a!o-e
path. C"i'( on Reiff.'om site uner this 'oo(ie "ist. :ou 'an see ifferent 'oo(ies )ritten !y reiff omain )ith
ifferent names.
Site: Reiff.'om Coo(ie name: R3+D
)a$e: R*ID <9ame of the 'oo(ie2
Content: 111'Ee'%%!f%Fe0G <En'rypte 'ontent2
Do$ain: .reiff.'om
!ath: / <Any path after the omain name2
Send For: Any type of 'onne'tion
+,-ires: &hursay0 De'em!er H10 #0#0 11:IF:IF P3

A--&ications where cookies can .e used:
1) To i$-&e$ent sho--ing cart:
Coo(ies are use for maintainin, on"ine orerin, system. Coo(ies remem!er )hat user )ants to !uy. 1hat if
user as some prou'ts in their shoppin, 'art an if ue to some reason user on5t )ant to !uy those prou'ts
this time an '"oses the !ro)ser )ino). 1hen ne*t time same user -isits the pur'hase pa,e he 'an see a"" the
prou'ts he ae in shoppin, 'art in his "ast -isit.
) !ersona&i/ed sites:
1hen user -isits 'ertain pa,es they are as(e )hi'h pa,es they on5t )ant to -isit or isp"ay. ?ser options are
,et store in 'oo(ie an ti"" the user is on"ine0 those pa,es are not sho)n to him.
0) 'ser tracking:
&o tra'( num!er of uni8ue -isitors on"ine at parti'u"ar time.
1) *arketing:
Some 'ompanies use 'oo(ies to isp"ay a-ertisements on user ma'hines. Coo(ies 'ontro" these
a-ertisements. 1hen an )hi'h a-ertisement shou" !e sho)n. 1hat is the interest of the user. 1hi'h
(ey)ors he sear'hes on the site. A"" these thin,s 'an !e maintaine usin, 'oo(ies.
2) 'ser sessions:
Coo(ies 'an tra'( user sessions to parti'u"ar omain usin, user +D an pass)or.
Draw.acks o% cookies:
1) E-en )ritin, Coo(ie is a ,reat )ay to maintain user intera'tion0 if user has set !ro)ser options to )arn !efore
)ritin, any 'oo(ie or isa!"e the 'oo(ies 'omp"ete"y then site 'ontainin, 'oo(ie )i"" !e 'omp"ete"y isa!"e an
'annot perform any operation resu"tin, in "oss of site traffi'.
Author: Ajay Sharma
Version: 0.1
0#
n
4une #011
DRAFT
Cookie Testing
) Too $any Cookies:
+f you are )ritin, too many 'oo(ies on e-ery pa,e na-i,ation an if user has turne on option to )arn !efore
)ritin, 'oo(ie0 this 'ou" turn a)ay user from your site.
0) Security issues:
Sometimes users persona" information is store in 'oo(ies an if someone ha'( the 'oo(ie then ha'(er 'an ,et
a''ess to your persona" information. E-en 'orrupte 'oo(ies 'an !e rea !y ifferent omains an "ea to
se'urity issues.
So$e *a3or Test cases %or we. a--&ication cookie testing:
&he first o!-ious test 'ase is to test if your app"i'ation is )ritin, 'oo(ies proper"y on is(. :ou 'an use the Coo(ie
&ester app"i'ation a"so if you on5t ha-e any )e! app"i'ation to test !ut you )ant to unerstan the 'oo(ie
'on'ept for testin,.

Test cases:
12 As a Coo(ie pri-a'y po"i'y ma(e sure from your esi,n o'uments that no persona" or sensiti-e ata is store
in the 'oo(ie.
#2 +f you ha-e no option than sa-in, sensiti-e ata in 'oo(ie ma(e sure ata store in 'oo(ie is store in
en'rypte format.
H2 3a(e sure that there is no o-eruse of 'oo(ies on your site uner test. O-eruse of 'oo(ies )i"" annoy users if
!ro)ser is promptin, for 'oo(ies more often an this 'ou" resu"t in "oss of site traffi' an e-entua""y "oss of
!usiness.
%2 Disa!"e the 'oo(ies from your !ro)ser settin,s: +f you are usin, 'oo(ies on your site0 your sites major
fun'tiona"ity )i"" not )or( !y isa!"in, the 'oo(ies. &hen try to a''ess the )e! site uner test. 9a-i,ate throu,h
the site. See if appropriate messa,es are isp"aye to user "i(e B$or smooth fun'tionin, of this site ma(e sure
that 'oo(ies are ena!"e on your !ro)serC. &here shou" not !e any pa,e 'rash ue to isa!"in, the 'oo(ies.
<P"ease ma(e sure that you '"ose a"" !ro)sers0 e"ete a"" pre-ious"y )ritten 'oo(ies !efore performin, this test2
I2 A''epts/Reje't some 'oo(ies: &he !est )ay to 'he'( )e! site fun'tiona"ity is0 not to a''ept a"" 'oo(ies. +f you
are )ritin, 10 'oo(ies in your )e! app"i'ation then ranom"y a''ept some 'oo(ies say a''ept I an reje't I
'oo(ies. $or e*e'utin, this test 'ase you 'an set !ro)ser options to prompt )hene-er 'oo(ie is !ein, )ritten to
is(. On this prompt )ino) you 'an either a''ept or reje't 'oo(ie. &ry to a''ess major fun'tiona"ity of )e! site.
See if pa,es are ,ettin, 'rashe or ata is ,ettin, 'orrupte.
J2 De"ete 'oo(ie: A""o) site to )rite the 'oo(ies an then '"ose a"" !ro)sers an manua""y e"ete a"" 'oo(ies for
)e! site uner test. A''ess the )e! pa,es an 'he'( the !eha-ior of the pa,es.
K2 Corrupt the 'oo(ies: Corruptin, 'oo(ie is easy. :ou (no) )here 'oo(ies are store. 3anua""y eit the 'oo(ie
in notepa an 'han,e the parameters to some -a,ue -a"ues. ;i(e a"ter the 'oo(ie 'ontent0 9ame of the 'oo(ie
or e*piry ate of the 'oo(ie an see the site fun'tiona"ity. +n some 'ases 'orrupte 'oo(ies a""o) to rea the ata
insie it for any other omain. &his shou" not happen in 'ase of your )e! site 'oo(ies. 9ote that the 'oo(ies
Author: Ajay Sharma
Version: 0.1
0#
n
4une #011
DRAFT
Cookie Testing
)ritten !y one omain say reiff.'om 'an5t !e a''esse !y other omain say yahoo.'om un"ess an unti" the
'oo(ies are 'orrupte an someone tryin, to ha'( the 'oo(ie ata.
E2 Che'(in, the e"etion of 'oo(ies from your )e! app"i'ation pa,e: Sometimes 'oo(ie )ritten !y omain say
reiff.'om may !e e"ete !y same omain !ut !y ifferent pa,e uner that omain. &his is the ,enera" 'ase if
you are testin, some La'tion tra'(in,5 )e! porta". A'tion tra'(in, or pur'hase tra'(in, pi*e" is p"a'e on the
a'tion )e! pa,e an )hen any a'tion or pur'hase o''urs !y user the 'oo(ie )ritten on is( ,et e"ete to a-oi
mu"tip"e a'tion "o,,in, from same 'oo(ie. Che'( if rea'hin, to your a'tion or pur'hase pa,e e"etes the 'oo(ie
proper"y an no more in-a"i a'tions or pur'hase ,et "o,,e from same user.
F2 Coo(ie &estin, on 3u"tip"e !ro)sers: &his is the important 'ase to 'he'( if your )e! app"i'ation pa,e is )ritin,
the 'oo(ies proper"y on ifferent !ro)sers as intene an site )or(s proper"y usin, these 'oo(ies. :ou 'an test
your )e! app"i'ation on 3ajor use !ro)sers "i(e +nternet e*p"orer <Various -ersions20 3o7i""a $irefo*0 9ets'ape0
Opera et'.
102 +f your )e! app"i'ation is usin, 'oo(ies to maintain the "o,,in, state of any user then "o, in to your )e!
app"i'ation usin, some username an pass)or. +n many 'ases you 'an see the "o,,e in user +D parameter
ire't"y in !ro)ser aress !ar. Chan,e this parameter to ifferent -a"ue says if pre-ious user +D is 100 then
ma(e it 101 an press enter. &he proper a''ess messa,e shou" !e isp"aye to user an user shou" not !e
a!"e to see other users a''ount.
&hese are some 3ajor test 'ases to !e 'onsiere )hi"e testin, )e!site 'oo(ies. :ou 'an )rite mu"tip"e test
'ases from these test 'ases !y performin, -arious 'om!inations. +f you ha-e some ifferent app"i'ation s'enario0
you 'an mention your test 'ases in 'omments !e"o).
Author: Ajay Sharma
Version: 0.1
0#
n
4une #011
DRAFT

You might also like