You are on page 1of 13

FrameworkI nt

erviewQuest ions
=============================
1.WhatismeanbyPOM?
======================
*PageObjectModel .
*POM isanobj ectreposit
orydesignpatt
erninselenium webdri
ver
.
*POM createsourt esti
ngcodemai nt
ainabl
eandr eusable.
*Pagefactoryi
sanopt imizedwaytocreateobjectreposit
ory
.

2.WhatarethetypesofPOM?
============================
*Wit
hpagef actory
.
*Wit
hOutpagef actor
y.

3.WhatismeantbyAnnot ati
ons?
================================
*IntheJavacomput erprogrammi nglanguage,anannot
ati
onisafor
m ofsynt
act
icmet
adat
athatcan
beaddedt oJav asourcecode.
*Classes,methods,vari
ables,par
amet er
sandpackagesmaybeannot at
ed.
*LikeJavadoctags,Javaannot at
ionscanber eadfr
om sourcef
il
es.

4.Whatarethepagefactor
yAnnot at
ions?
========================================
*@FindBy
*@FindBys
*@FindAll
*@CacheLookUp

5.Whatismeanbypoj ocl
ass?
=============================
*POJOst andsforPlai
nOl dJav aObject
,andwouldbeusedtodescr
ibet
hesamet hingsasa"Normal
Class"whereasaJav aBeanf ol
lowsasetofrules.
*Mostcommonl yBeansuseget t
ersandsett
erstoprot
ectt
hei
rmemberv ar
iabl
es,whichar
etypi
cal
ly
settopri
v at
eandhav eano- argumentconstr
uctor.

6.Howwillyougeneratethepojocl
ass?
======================================
*Right
Cli
ck-
->Source-
->Generat
e--
>Gett
er&Sett
er-
->Sel
ect
All
.

7.Wri
tethefolderStruct
ureusedinPOM?
=========================================
*Src/
Main/j
ava-->Usedtostorethelocat
ors.
*Src/
Test/j
ava-->Usedtoexecut
et hebusinessl
ogi
c.
*Src/
Resource/java-
->Usedtostor
et her
eusablecode.

8.Whati sthedi
ff
erencebetween@Fi ndBy
sand@Fi ndAll
?
=======================================================
@Fi ndBys
--
---
---
*List<WebElement>wit
hbot hFindByWebElementwil
lcontainanyWebElementwhi
chstati
fi
esboth
cri
teria.
@Fi ndAll
--
---
---
*List<WebElement>wit
heitheranyoneoftheFindByWebEl ementwi
llcont
ainanyWebElementwhi
ch
statifi
esanyoneofthecri
teria.
9.WhatistheuseofPOM?
==========================
*Obj
ectreposit
oryisindependentoft
estcases.
*Codebecomesl essandopt i
mizedbecauseofther
eusabl
epagemet
hodsi
nthePOM classes.
*Methodsgetmor ereali
sti
cnameswhi chcanbeeasi
lymappedwi
tht
heoper
ati
onhappeninginUI
.

10.Whataretheuseof@cacheLookup?
====================================
*I
fwedon’ tdoit
,thenever
ytimewhenwet ur
ntoourel
ement
,WebDr
iverwi
llchecki
ftheel
ementi
s
presentonthepage.

11.WhatisJUni t
?
=================
*I
tisanopen- sourcetest
ingf
rameworkforjav
aprogrammer s.
*Thejavaprogrammercancr eat
etestcasesandtesthi
s/herowncode.
*I
tisoneoft heunittesti
ngfr
amework.Curr
entversi
onisjunit4.
*Theorg.j
unitpackagecontai
nsmanyinterf
acesandclasses.

12.WhatisUnitTesti
ng?
========================
*JUniti
saunittesti
ngframeworkfortheJavaprogramminglanguage.
*JUnithasbeenimportanti
nthedevelopmentoftest-
dri
vendevel
opment,andi
soneofaf
ami
lyofuni
t
test
ingframeworkswhichiscol
lect
ivelyknownasxUnitthator
igi
natedwi
thSUnit
.

13.Whatareallt
heannotati
onsavail
ableinJUnit
?
===================================================
*@BeforeCl
ass
*@Before
*@After
Class
*@After
*@Test

14.Explai
nwhatisignoretestinJUni
t?
=========================================
*Atestmet hodannotat
edwi th@Ignor
ewi l
lnotbeexecuted.
*I
fat estclassi
sannotatedwith@Ignore,
thennoneofitstestmet
hodswi
llbeexecut
ed.

15.Explainthetestexecut
ionor
der
?
====================================
*@Bef oreClass
*@Bef ore
*@Test
*@Af t
er
*@Af t
er Cl
ass

16.Whati sthedif
ferencebetween@Bef
oreClassand@Bef ore?
===========================================================
@Bef oreClass
--
--
--
---
--
-
*Thisannot at
ionspecifi
esthatmet
hodwil
lbeinvokedonlyonce,befor
estar
ti
ngal
lthet
est
s.
@Bef ore
--
--
--
--
*Thisannot at
ionspecifi
esthatmet
hodwil
lbeinvokedbeforeeachtest.
17.Whati st
hedif
ferencebetween@AfterCl
assand@Af ter?
=========================================================
@Af terCl
ass
--
--
--
----
--
*Thisannotati
onspecifi
esthatmet
hodwi l
lbeinvokedonlyonce,afterf
ini
shi
ngal
lthet
est
s.
@Af ter
--
--
--
*Thisannotati
onspecifi
esthatmet
hodwi l
lbeinvokedaft
ereacht est.

18.Canweabletousemai nmet hodinJUnit


?
============================================
*No,wecan'tabl
etousemai nmet hodinJUnit.

19.I
sitpossi
bletogenerat
ereportusingJUnit
?
==================================================
*No,i
tisnotpossi
bletogenerat
erepor tusi
ngJUnit
.

20.Whatistheuseofannotati
ons?
==================================
*I
nSelenium WebDriv
erifyouwanttor untestscr
iptusi
ngJUni
tfr
amewor
kwehav
etoaddf
ewJUni
t
Annotat
ionsinSeleni
um WebDr i
verTestscri
pt.

21.Whatistheuseof@Testannot ati
on?
========================================
*WhenweRunt hescriptasJUnitt
henallt
hemet hodsspeci
fi
edbelow@Testar
eexecut
edusingJUnit
Test.
*As@TestJUni tannotati
onisspeci
fi
edbeforethetest
Unti
tl
ed()method,
thi
smethodwi
llbeexecut
ed
whenwer unthe“ GoogleSear
ch”cl
assusingJUnit.

22.WhatdoesAssertclass?
==========================
*Asetofasserti
onmet hodsusefulf
orwrit
ingtests.
*Onlyf
ail
edasserti
onsar er
ecorded.
*Thesemethodscanbeuseddi rectl
y:Assert
.assert
Equal
s(.
..
),t
heyr
eadbet
teri
ftheyar
eref
erenced
thr
oughstati
cimport.

23.Whatist hedifferencebet weenAsser tandv er


ify?
=====================================================
Assert
--
--
--
-
*Whenan“ assert”commandf ail
s,thetestexecut ionwi l
lbeaborted.
*Theassertcommandi susedwhent heendr esultoft hecheckvalueshouldpasst oconti
nuetot
he
nextstep.
*I
ftheasser tcondi t
ionistruet henthepr ogram cont rolwil
lexecutethenextteststepbutift
he
condit
ionisf al
se, t
heexecut ionwi l
lstopandf urt
hert eststepwillnotbeexecuted.
Veri
fy
--
--
--
*Whena“ ver i
fy”commandf ail
s,thetestwi l
lcontinueexecut i
ngandl oggi
ngt hefail
ure.
*TheVer i
fycommandi susedt ochecknon- crit
icalthings.
*Therewontbeanyhal tinthet estexecutionev ent houghthev er
ifycondi
ti
oni strueorfal
se.

24.Whatareallt
hemet hodsavai
labl
einassertclass?
======================================================
*asser
tEqual
s()
*asser
tTrue(
)
*
assert
Fal
se()
*
assert
Nul
l()
*
assert
NotNull
()
*
assert
Same()
*
assert
NotSame()
*
fai
l(
)

25.I
sitpossi
bletogroupthetestcases?
===========================================
*Yes,
iti
spossibl
etogr oupthetestcasesusi
ng@RunWit
hannot
ati
on.

26.I
sitpossi
bletore-
runthefail
edtestcasesinJUnit
?ifyes,Howwi l
lyoudo?
===================================================================================
=
*No,i
tisnotpossi
bletore-
runthefail
edtestcaseinJUnit
.

27.Canwechanger et
urnt y
peofJUnittestmethodfrom voidt
osomeot hertype?
================================================================================
*No,wecan'tchangetheretur
ntypeofJUnitt
estmet hodfrom v
oidtosomeot herty
pe.

28.Howwi l
lyouhandleexcept
ioninJUnit
?
==========================================
*t
ry-cat
chidiom
*WithJUnitrul
e
*Withannotati
on

29.Howwillyouhandleexcept
ion@t estannotat
ion?
==================================================
*@Test(expected=Il
legal
ArgumentException.
class)

30.WhichI
sthelatestver
sionofJUnit?
=========================================
*4.
12

31.Howwillyousettheti
meoutintestcases?
==============================================
*ByusingTimeoutparameteron@TestAnnot ati
on(appl
iestotestmethod).
*Other
wisewecanuseTi meoutpar ameteron@TestAnnot at
ion(appl
iestotestmet
hod)
.

32.Whatar ediffer
entasser
ti
onssuppor
tedbyJUnit?
=====================================================
*assert
Equal s(
)
*assert
True()
*assert
False()
*assert
Null()
*assert
Not Null
()
*assert
Same( )
*assert
Not Same( )
*fai
l(
)

33.Howtocr eat
eandr unJUnitt
estsui
teforseleni
um WebDr i
ver
?
=================================================================
*Tocreat
et estsui
te,Ri
ghtcli
ckonjuni
tpackpackagefolderandGot o->New- >Ot
her-
>Jav
a->
Junit-
>Select'JUnitTestSui
te'
.
34.Forwhatpurpose,asser
tTrueandassert
Falseasser
ti
onsareused?
====================================================================
*I
fy ouwanttotestthebooleancondi
ti
ons(trueorfal
se),
wecanuseasser tTrueandasser
tFal
se
asserti
ons.

35.Canyougi vemeexampl eofJUnitasser


tEqual
sasser
ti
on?
===========================================================
*Stri
ngstring1="Junit";
Stri
ngstri
ng2=" Junit
";
Assert
.assertEquals(str
ing1,
str
ing2);

36.Whati scucumber?
====================
*Cucumberi satool t
hatsuppor
tsBehaviorDriv
enDev el
opment( BDD).
*Itof
fer
sawayt owr i
tetest
sthatanybodycanunder st
and,regardl
essofthei
rtechni
calknowl
edge.
*InBDD, usersfi
rstwri
tescenar
iosoracceptanceteststhatdescri
besthebehavi
orofthesyst
em fr
om
thecustomer '
sperspecti
ve,f
orrevi
ewandsi gn-of
fbythepr oductownersbef
oredeveloper
swrit
ethei
r
codes.

37.WhatlanguageisusedbyCucumber ?
=====================================
*Gherki
nlanguageisusedbycucumber .
*Gherki
nlanguageusesseveralkeywordstodescri
bet
hebehav
iorofappl
icat
ionsuchasFeat
ure,
Scenari
o,Scenari
oOutli
ne,Given,When,Thenetc.

38.Whatismeantbyaf eatur
ef i
le?
===================================
*AFeatureFil
eisanent r
ypointtotheCucumbert est
s.
*Afeatur
efil
emustpr ovideahigh-l
eveldescr
ipt
ionofanAppli
cati
onUnderTest
.
*Thefi
rstli
neofthefeaturefi
lemustst ar
twit
hthekey wor
d‘Feat
ure’
*Afeatur
efil
ecancont ai
nascenar i
oorcancont ainmanyscenar
iosi
nasinglef
eat
uref
il
ebuti
tusual
ly
contai
nsalistofscenari
os.

39.WhatisthepurposeofScenar i
oOutl
inei
nCucumber ?
=======================================================
*Scenari
ooutli
neisawayofpar amet
eri
zati
onofscenar i
os.
*Wecanpassbot hScenarioleveldat
aaswel lasstepleveldat
a.
*I
tusest hekeywordExample
*Thisscenari
ooutli
nedoesiter
at i
oni
ntheDat atable.

40.WhatisthepurposeofStepDefinit
ionfi
lei
nCucumber ?
===========================================================
*St
epsdef i
nit
ionfil
estorest
hemappi ngbetweeneachst epoft
hescenariodefi
nedinthefeatur
efi
le
wit
hacodeoff uncti
ontobeexecuted.
*whenCucumberexecut esastepoft hescenar
iomentionedinthefeat
urefi
le,
itscansthestep
defi
nit
ionfi
leandf i
guresoutwhi
chf uncti
onistobecall
ed.

41.Whatarethemaj oradv antagesofCucumberframework?


=======================================================
*Thecli
entcaneasi l
yunder standbecauseofgherki
nlanguages.
*Wecaneasi l
yf oundthest epwhichwillbef
ail
ed.
*Sty
leofwr i
ti
ngt estsall
owf oreasi
erreuseofcodeinthetests.
*Quickandeasysetupandexecut i
on.
*Eff
ici
enttoolfortesti
ng.
42.Whatistheli
mitforthemaximum numberofscenar i
osthatcanbeincludedinthefeat
urefi
le?
===================================================================================
===============
*Afeatur
efilecancontainamaximum of10scenarios,butt
henumbercanv ar
yfrom proj
ecttoproj
ect
andfrom oneorgani
zationtoanot
her.

43.Whatsymbolisusedforparameteri
zati
oninCucumber ?
=========================================================
*Pi
pesy mbol(|
)isusedtospecifyoneormor eparameterval
uesinafeat
uref
il
e.

44.WhatisthepurposeofExampleskeywordinCucumber ?
========================================================
*Exampleskeywordisusedtospecifyval
uesforeachparameterusedint
hescenar
io.
*Scenar
ioOutli
nekey wor
dmustal waysbefoll
owedbyt hekeywordExamples.

45.WhatisthepurposeofCucumberOpt i
onstag?
===============================================
*CucumberOpt i
onstagisusedtoprovideali
nkbet weent hefeat
urefil
esandstepdefi
nit
ionfil
es.
*Eachstepofthefeaturef
ilei
smappedt oacorr espondingmethodont hestepdef
ini
ti
onf i
le.
*Example:
@Cucumber Opt
ions(
feat
ures="
Features",
glue={"
StepDefi
nit
ion"
})

46.WhatisthemeaningofTestRunnerclassinCucumber?
=======================================================
*Test
Runnerclassisusedtoprovidetheli
nkbetweenfeaturef
il
eandst epdef
ini
ti
onf
il
e.
*ATestRunnerclassi
sgenerall
yanempt yclasswithnoclassdefi
nit
ion.

47.Whatisthestar
ti
ngpointofexecuti
onforfeatur
efil
es?
=============================================================
*Wheni ntegr
atedwit
hSelenium,thestar
ti
ngpointofexecuti
onmustbef rom Test
Runnercl
ass.

48.Whatistheuseofgluepropert
yunderCucumberOpt ionstag?
===============================================================
*Gl
uepr opert
yisusedtoletCucumberframeworkidenti
fythelocat
ionofstepdef
ini
ti
onf
il
es.

49.Whatisthemaximum numberofst epsthataretobewrit


tenwithi
nascenar i
o?
================================================================================
*Themaximum numberofst epstobewr i
tteninascenari
ois3-4steps.

50.Whatarethedif
ferencebetweenJbehaveandCucumber ?
========================================================
*Alt
houghCucumberandJbehav earemeantforthesamepur pose,accept
ancet
est
sar
ecompl
etel
y
dif
ferentf
rameworks
*JbehaveisJavabasedandCucumberi sRubybased
*Jbehavearebasedonst or
ieswhil
eCucumberi sbasedonf eat
ures

51.Whatisthedi ff
erencebetweenBDDandTDD?
=============================================
BDD
--
-
*Behaviorcentereddev el
opmentpr ocess.
*BDDt estsarewr i
tteninreadableformatusi
ngGi
ven-
When-
Thenst
eps.
*BDDt estsarereadabl ebynon-programmers.
TDD
--
-
*Testcentereddev elopmentprocess.
*
TDDt
est
sar
ewri
tt
enusingprogr
amminglanguagesli
keRuby
,JAVAet
c.
*
TDDt
est
sar
edi
ff
icul
ttoreadbynon-
progr
ammer s.

52.Whatarethetwofil
esrequir
edtorunacucumbert est?
===========================================================
The2f i
lesrequi
redtoexecut
eaCucumbert estscenari
oare
*Featur
es
*StepDefi
niti
on

53.Whatisthetwomai npurposeofusingGherki
n?
==================================================
*Thetestiswrit
teninplai
nEngli
shwhichiscommont oallt
hedomainsofyourprojectt
eam.
*Thist
estisstructur
edthatmakesitcapabl
eofbeingr eadi
nanautomatedway .Therebycr
eat
ing
automati
ont estsatthesametimewhiledescr
ibi
ngthescenari
o.

54.WhatarethekeywordsusedinFeaturefi
le?
==============================================
*Featur
e
*Background
*Scenari
o
*Scenari
oOutli
ne
*Given
*When
*Then
*And
*But

55.Whatist hedif
fer
encebetweenGiven,When,Thenstepsinfeat
urefi
le?
==========================================================================
*Givendefi
nest hecontextoft
hescenari
o.
*Whendef inestheacti
onsofthescenari
o.
*Thendefinestheoutcomeoft hescenar
io.

56.Explai
nbackgroundinfeat
urefil
e?
=======================================
*St
epswr i
tt
enundertheBackgroundkeywordareexecutedbefor
eever
yscenari
o.
*I
fy ouwantt oexecut
ethesamest epsforever
yscenari
olikel
ogint
othewebsite,
youj ustwr
it
ethose
commonst epsunderthebackgroundkeyword.
*Whi l
eexecutingever
yscenari
o,stepswri
tt
enunderbackgroundwil
lbeexecut
edfirst
.

57.WhatIsCucumbert ag,plugin,
glue,monochrome, st
rict
,f
eature,DryRun?
=======================================================================
*Featur
e–pat ht ofeat uref i
le.
*Glue–patht ostepdef i
nition.
*dryRun–bool eanv alue–checkf ormi ssi
ngst epdefini
ti
on.
*tags–usedt ogr oupcucumberscenar iosi
nt hefeaturefi
le.
*stri
ct–booleanv alue–f ailtheexecut i
onifthereisami ssingstep.
*monochrome–bool eanv alue–di splayconsoleoutputinar eadableway.

58.HowToGener ateCucumberExecut i
onReports?
===============================================
*f
ormat={ "
prett
y","
html:
tar
get/Desti
nati
on"}
*f
ormat={"
json:
target
/Desti
nati
on/cucumber.j
son"}
59.HowToRunAPar ti
cularScenar
ioFrom AFeatureFil
e?
==========================================================
*@tagbeforethescenari
obutwhi l
einTestRunnerfil
ewhengi v
enthistagi
tisr
unni
ngent
ir
efeat
ure
fi
le.
*t
ags={"@Isl
amic_User_
check"}

60.Whatare@before,@afterhooks?
===========================================================
*CucumberHooksal l
owsust obettermanagethecodewor kfl
owandhelpsust oreducethecode
redundancy
.
*@beforehookgetsexecutedwellbefor
eanyot hert
estscenari
o,and@afterhookgetsexecutedaf
ter
executi
ngthescenari
o.

61.HowtoRunCucumbert estsinparal
lel
?
=========================================
*Acommonappr oachforrunningCucumberfeatur
esinparall
eli
stocr
eat
easui
teofCucumber
runner
s,oneforeachsuiteoftestsyouwishtoruninparal
lel.
*Formaximum parall
eli
sm, t
hereshouldbearunnerperfeaturef
il
e.
*Thisi
sapaintomai ntai
nandnotv eryDRY.

62.WhatisTestNG?
==================
*Test
NGi satesti
ngframewor
kdesi
gnedt
osi
mpl
if
yabr
oadr
angeoft
est
ingneeds,
from uni
ttest
ing
toint
egrati
ontest
ing.

63.Whati sthediffer
encebet weenJUni tandTest NG?
===================================================
JUnit:
--
--
--
-
*@Bef oreClassand@Af ter
Classmet hodshav etobedeclaredasstati
c.TestNGdoesnothavethi
s
const r
aint.
*Groupt estisnotpossi ble.
*Dependenci estestisnotpossi ble.
*Paramaet eri
zedobj ectwecan' tpass.
TestNG:
--
--
--
--
*I
thaspr ovi
dedf ouraddi ti
onalsetup/tear
downpai rsfort
hesuit
e,testandgroups,
i.
e.@Befor
eSuit
e,
@Af terSuit
e,@Bef oreTest ,@AfterTest,@BeforeGroupsand@Af t
erGroups,@Befor
eMethod,
@Bef oreClass,@Af t
er Classand@Af terMethod.
*Groupt estispossible.
*Dependenci estestispossi ble.
*Paramaet eri
zedobj ectwecanpass.

64.Whatisthedi
ffer
encebet weenJbehaveandCucumber ?
========================================================
Jbehave
--
--
--
--
*JBehaveisapureJavaf r
amewor k.
*Onlysupport
sstori
es,notfeatur
es.
Cucumber
--
--
--
--
*CucumberisbasedonRuby .
*Support
sfeatur
es.

65.
Whatar
eal
ltheannot
ati
onsav
ail
abl
einTest
NG?
=====================================================
*@BeforeTest
*@After
Test
*@BeforeClass
*@After
Class
*@BeforeMet hod
*@After
Met hod
*@BeforeSuite
*@After
Suite
*@BeforeGroups
*@After
Groups
*@Test

66.Explai
nt heExecut
ionor
deri
nTestNG?
==========================================
@Bef oreSuite
@Bef oreTest
@Bef oreClass
@Bef oreMet hod
@Testcase1
@Af ter
Met hod
@Bef oreMet hod
@Testcase2
@Af ter
Met hod
@Af ter
Class
@Af ter
Test
@Af ter
Suite

67.Howwillyoupri
orit
izet
het estcase?
=========================================
*Weusepr i
orit
yatt
ributet
ot he@Testannotati
ons.
*I
ncasepr i
orit
yisnotsetthenthetestscr
ipt
sexecutei
nal
phabet
icalor
der
.

68.I
fy ousett
womet hodssamepr ior
it
ymeans, whichmethodexecutefir
st?
==========================================================================
*Testngconsi
dersthealphabet
icalor
derofthemet hodnameswhosepr iori
tyi
ssame.

69.Whatisthedefaul
tmethodpriori
ty?
=======================================
*I
fyoudon'tmentionthepri
ori
ty,i
twillt
akeallt
het
estcasesas"
pri
ori
ty=0"andexecut
e.

70.Whatisthel
atestTestNGversi
on?
=====================================
*6.
14.3

71.WhatisTestNGsui t
e?
===========================
*Atestsuiteisacoll
ecti
onoftestcasesint
endedtotestabehav
iororasetofbehav
ior
sofsoftware
program.
*I
nTest NG,wecannotdef i
neasui t
eintest
ingsour
cecode,buti
tisrepr
esent
edbyoneXMLf i
le,as
suit
ei st
hef eat
ureofexecuti
on.
*I
talsoallowsflexi
bleconf
igurat
ionoft
het est
stoberun.

72.Whywear eusingTestNG.xmlfi
le?
=======================================
*
Testng.
xmlfi
leall
owst oincludeorexcl udetheexecuti
onoft
estmet
hodsandt
estgr
oups.
*
Itall
owstopassparamet erstothet estcases.
*
Allowst
oaddgr oupdependenci es.
*
Allowst
oaddpr i
orit
iestothet estcases.
*
Allowst
oconfigureparal
lelexecutionoft estcases.
*
Allowst
oparamet er
izethetestcases.

73.Howwillyougroupt hetestcasesintestngsuit
e?
======================================================
*Groupsarespecif
iediny ourtest
ng.xmlfi
leusingthe<groups>t
ag.
*I
tcanbef oundeitherunderthe<test>or<suit
e>t ag.
*Groupsspecif
iedinthe<suite>tagapplytoallthe<test
>tagsunder
neat
h.

74.Howwillyoupasst heval
ueusi ngparameter?
================================================
*Nameat t
ribut
er epresentsthepar amet
ername
*val
uerepresentsthev alueofthatparameter.
*Example:
<paramet ername=" browser"val
ue="f
ir
efox"
/>

75.Whatis@opt i
onalannot
ati
on?
=================================
*I
fdefi
nedpar ameteri
snotfoundiny ourt
est
ng.xmlf
il
e,Thet
estmet
hodwi
llr
ecei
vet
hedef
aul
tval
ue
whichisspeci
f i
edinsi
dethe@Opt i
onalannot
ati
on.

76.Whatistheuseof@dependsOnMet hodannot at
ion?
==================================================
*I
fone@Testmet hodfai
lsorskippedfr
om executi
onthenIt'
sdependent@Testmet
hodmustnotbe
execut
ed.

77.Whatistheuseof@dependsOnGr oupannot at
ion?
=================================================
*I
fone@Testgr oupfail
sorskippedfrom executi
onthenIt
'sdependent@Testgr
oupsmustnotbe
execut
ed.

78.Whati sTest NGAsser tandlistoutcommonTest NGAssertions?


===============================================================
*TestNGAsser tshelpust overi
fytheconditi
onoft het
estinthemi ddleofthetestr
un.
*Basedont heTest NGAsser ti
ons,wewi l
lconsiderasuccessfultestonl
yifiti
scomplet
edt
het
estr
un
withoutthrowi nganyexcept i
on.
Someoft hecommonasser ti
onssuppor t
edbyTest NGar e:
--
--
---
--
--
--
---
---
----
--
--
--
---
--
--
--
--
---
--
--
--
---
--
--
--
-
*assert
Equal (Stri
ngactual,
Stri
ngexpected)
*assert
Equal (Stri
ngactual,
Stri
ngexpected,Stri
ngmessage)
*assert
Equal s(booleanactual,
booleanexpected)
*assert
True( conditi
on)
*assert
True( conditi
on,message)
*assert
False( condit
ion)
*assert
False( condit
ion,message)

79.WhatisHardAssertinTestNG?
==================================
*HardAssertt
hrowsanAsser tExcept
ioni
mmedi
atel
ywhenanasser
tst
atementf
ail
sandt
estsui
te
conti
nueswithnext@Test.

80.
Whati
sSof
tAsser
tinTest
NG?
==================================
*SoftAsser
tcoll
ectserr
orsduri
ng@Test .
*SoftAsser
tdoesnotthrowanexcept i
onwhenanasser
tfai
lsandwoul
dcont
inuewi
tht
henextst
ep
aft
ertheassertst
atement.

81.Howtorunt estcasesinparallelusi
ngTestNG?
===================================================
*wecanuse“ parall
el”at
tri
buteint est
ng.xmlt
oaccompl
ishpar
allelt
estexecut
ioni
nTest
NG.
*Al
lthetestcasesinside<test
>t agoft est
ng.
xmlfi
lewi
llr
unparall
el.

82.Howt oexcl
udeapar ti
cul
artestmethodfr
om atestcaseexecut
ion?
=======================================================================
*Byaddi ngtheexcludet aginthetest
ng.xml
<classes>
<classname=" TestCaseName" >
<met hods>
<excludename=" TestMethodNameToExclude"
/>
</ methods>
</class>
</classes>

83.Howt odisabl
eat estcasei
nTestNG?
===========================================
*Todisablethetestcaseweusetheparameterenabl
ed=f
alset
othe@Testannot
ati
on.
*Example::
@Test (
enabled=fal
se)

84.Whatarethediff
erentway st
oproducecustomizerepor
tsforTestNGresult
s?
=================================================================================
Therecanbet woway swecancust omizeTestNGreport
*UsingI
TestList
enerInterf
ace:
*UsingI
ReporterInt
erface:

85.Whatistheuseof@Li stenerannot ationinTest NG?


======================================================
*Test
NGl i
stener
sareusedt oconf i
gurer eportsandl ogging.
*Oneofthemostwi delyusedl ist
enersi ntestNGi sITestList
enerint
erface.
*I
thasmet hodsli
keonTest Start,onTestSuccess, onTestFailur
e,onTestSki
ppedet
c.
*Weshouldi mpl
ementt hi
si nterf
acecr eati
ngal istenerclassofourown.
*Nextweshouldaddt helistenersannot ati
on( @Listeners)intheClasswhichwascreat
ed.

86.Whatistheuseof@Test (
inv
ocati
onCount=x)?
=================================================
*Theinvocati
oncountatt
ribut
etell
showmanyt i
mesTestNGshoul
drunat
estmet
hod
*Example:@Test(
invocat
ionCount=10)

87.Whatist heuseof@Test(threadPoolSi
ze=x)
?
===============================================
*ThethreadPoolSi
zeat t
ri
butetell
stoform athr
eadpooltor
unt
het
estmet
hodt
hroughmul
ti
ple
thr
eads.
*Thisat
tributei
signoredifi
nvocationCounti
snotspeci
fi
ed.
*Example:@Test(t
hreadPoolSi
ze=3)

88.Whatare@Factoryand@Dat aProvi
derannotati
on?
===================================================
@Factory:
--
---
---
--
*Af actorywillexecuteallthetestmethodspr esentinsideatestcl
assusingaseparateinstanceofthe
respectiveclasswi thdiff
erentsetofdata.
@Dat aPr ovi
der:
--
---
---
--
---
--
*At estmet hodt hatusesDat aProv
iderwillbeexecutedt hespeci
fi
cmet hodsmult
iplenumberoft imes
basedont hedat aprov i
dedbyt heDataProvider.
*Thet estmet hodwi llbeexecutedusingthesamei nstanceofthetestcl
asstowhichthet estmethod
belongs.

89.Howt ore-runthefai
ledtestcases?
========================================
*Aftert
hef i
rstrunofanautomat edtestrun.Ri
ghtcli
ckonPr oj
ect–Cli
ckonRefresh.
*Afolderwillbegeneratednamed“ test
-output
”fol
der.I
nside“t
est-
out
put”f
older
,youcoul
dfi
nd“
test
ng
-f
ail
ed.xml”
*Run“ t
estng-fai
led.
xml”toexecutethefail
edtestcasesagain.

90.WhatismeanbyDat aDri
ven?
==============================
*I
tisusedtoread/writ
ethedat ai
nexcelsheet
.

91.Whataretheformatavai
labl
einExceltoread?
===================================================
*POI
*j
xl

92.WhatismeanbyWor kbook?Whet
herWorkbookisanInter
faceorclass?
=======================================================================
*TheWhol eExcelsheetiscalledaswor
kbook.
*WorkbookisanInterface.

93.WhatisthepurposeofgetCell
Type()
?
=========================================
*I
tisusedtogettheparti
cularcel
ltypeandshowWhet
heri
tisai
ntegerornumer
ical
.

94.Whatarethepossibl
eoutputgivenbygetCel
lType(
)?
========================================================
*0
*1

95.Whatmethodisusedt orepl
acethecellval
ue?
==================================================
*set
Cell
Type()

96. Whatisthedi f
fer
encebetween.
xlsand.
xlsx?
==================================================
.
Xl s
--
---
*Itisusedbef ore2007.
*Itwillsupportonly512(2^
9)rowsand65536( 2^
16)col
umn.
*Itwillnotsupportmacros.
*colorsarelimited.
*Itwillsupportonluxl
sformat.
.
xl sx
--
----
-
*
Iti
susedr ecentl
y
*
Itwil
lsupportupto2^ 14rowsand2^20col
umn.
*
Itwil
lsuppor tmacros.
*
color
sareunl imi
ted.
*
Itwil
lsupportonluxlsandxlsxf
ormat.

97.Whatisthedi
ffer
encebetweenjxlandapachePOIj arfi
le?
==================================================================
j
xl:
--
--
*I
tsupportonly.
xlsfi
le.
POI:
--
--
*I
tsupportboth.Xl
sand. Xl
sx

98.Howwillyouwrit
edatainWor kbook?
========================================
*writ
e()methodisavai
labl
e.

You might also like