- UNIT-IV
l. State | state Graphs and “Wansition testing.
Ly state testing.
Ly good & bad stele graphs
Ly Testabitity, “lips
Topic — 1
“ly Stocte ¢ ; ;
A stete represents a condition o¢ stluation of} ov
| sgstern oF proqrano at a Specific Vine!
Stk shows whet the syste ts doing. oF whet
i Vemembers act that, “moment, hoes Qo
5 state may depend on inputs , past actions or
events .
| example of stotes in a Login System
— Loaged out
| > a -for password
—_ Logged In
= Locked (after failed acttempts))
|2. stecke qraphs *
* state graph ig a Visuad m d :
as stote transition dieqary ae i also called
us states of system
Les Transitions belween states
i Inputs oy events -thok cause -those cbgans tors,| pasic elements
1 stote > A etecle of box representing a Stete’,
2, Transition —y An aru showing movement
between states. 7
3. Event —s # label om -+he arrow showing whet
riggers the transition.
| _gsample + simple Tunstile '
tates 2° 2 '
Block stote Graph + |
Ly unlocked [Locked]—- (coiq) - -> [pnlocked
events: [unlocked] ~-Cpush)--> [Locked ]
Ly Coi9
2 posh t
licactions of state Graphs in —teshing.
-5 Used in’ model-based testing :
> Helps test behawisred aspects ofa system,
Ls Useful for -testing. ol systems, protocols , workF low
logic . etc .: ;
gp eles orci test cases +thed cover all transitions
Diagram >
; “4 ‘ener user| Transition ctesting- - ¥
esking. is a SotHware estin technic
esto eet designed “2 check’ Gd and ets
skate -bransttions ina Sd fee
5A black box testing. echnignse based on States
and -—bransttions
Sat is based on the idea of eels machines one
Hg Syste moves from one stote 0 another Bi
Stow “siggeting evint. or a ;
when | _to, ose it 3
> then software behaves | differently in «det ferens
Stectes ,
> when event-driven or workflow —bosed Sepstemy
| axe involved :
> Common in Ul cpletons, embedded s ystens
AT™ Login modules ; ett... |
Exainple 2 ATM Machine
. Stetes +
—> Idle
=> card Shserted
TD Pin Vertibled
oe Transaction | fal
Events 5 ey
| > Insert cord, Erte PIN, withdraw , Eject card.
Transition Test Cases ts
« Insevt catd —y Move +o card Insevted. |
+ Enley covet PIN—> move to pin verified.
° Ty to withers ere _heertin cea Jovolid
yansition, ‘tcoment, event:
state,
Biche idle tasevt card
Jk cava ate: ‘ad
os inserted ener |
pin verified withd-euo
EE on Verteied Transactien
: Trvolid
Fransackoay isle. Fath,
Benifits of Hransittien sesking .
sy petects incowrect state handling-
> Helps in -testing business voles (°°
> cmpsove& coverage of event combinations
ted sequences,
> Finds hidden bogs due + unexpec:
sted; Testing. ss
stote teshhg iS a technique where 4the systero is testeal
by exarnining- ile istactes and -the -transittons between
7 is a black-box esting’ techniewe bor yaaa’
with muttiple Ss 73e :
at checks wshether sha sollWare ‘loehaves’
in each stete.'and Hansttens properly ese! als
inputs of events. i249 / Jo. \
key cone |
\. Skate —> A specific, mode ox condition oF syste
(2. Event —9 Topot of action thec éavses ‘a -harsitien
-Ransition —> A movement From one state +o ;[ another based on an event, aN
/4. Thitial shade > where the System shorts
S- Final state —> where “the system ends.
Diagram %
username
Example +
_ Login system
” Stotes:
— start,
| 5 Username Entered
—. password Srrlered
= Logged In
—> Locked |
events 2
> Enter username enter passin, sulomitt Fail Adtempls
— when +o use td
Ly when software has mottiple' user of system stedes,
Ly hen system behavior depends en previols events .
-L> Usefol fox Ul Aesting., dewice control sqstems , workflow
‘ ¢ eal” condens
—> Finds Invalid stete -transttions, “t 2 aS
—y Helps design beHey +est cases,
Good ‘and bad state graphs :
‘Pook state: Gaaphs - ' k
; and
Feard Inserted]
| [Gord Inserted] —- (Entew PrN) -—>
| [authenticacted))
Bad stete Graphs +
= Missing stokes or -rransitions, Remove
sy Unclear of duplicate +transttions . cay
* Dead ends ,(stotes from which you can't continue)
> Loops wethoot exit (infinite cycles) .
4 unreachable stodes (never used in veal cperatiod)
example ; ,
[xdle] —- C-tosert. card) ~ —> [eavd
Inserted] ‘ i }
[cavd. anserted] —-CEnter PIN) —>
(card Inserted J
Cloop with no escape)Difference between (rood & bad state graphs
food state graph ‘Bad Stade graph
—>H is cleay and easy to 9 Tt is confusing a,
Sead. ., Clubtered.
AN stokes ave“ meanin
full and well-labeled
a Shows valid. transttions a Maty include invalid or
for all! inputs : missing. -transttions,
> xt pes unnecessary — May have: loops hee
“cycles oot an exth. ;
-—> In tao state graph
> Bad state b
all skates ave connected oe Wiich ie “=
- logical
& oye ; isolated stote.
i lps generate effective tt makes est cose
cases. design difficult. °
— Some states may be
unclear or unused’
Testability Tips .
(How +o make your software easies to test)
Cimproving. ~testabilt means making. tt easiey to
write ,xon and evoluacte tests. Good -testabi tidy
+ helps “ttad bogs faster and improves snbhrra
quahi
we tk improve deslabully *
1, write moduler code
Ly Break code into Small , independent fencchions of
classes.
UL > easier to test each past Separotel, (net test)
2. Use clear and consistent naming. ¢
é~ and modules,
> Makes the Code easier +0 understand and test
5, Avoid Hard - coded values. |
La use Constamts or config. files.
Ly €asiex “to change valves ding
Es meaningfo| names fog Vowioble’ , Functions
aests :
y, write test cases early. .
Ly cveote test cages while oY before unthing Code.
> Encousages clean , test -triendly 4esiq? (wd)
methods.
6. Limit Use of Static and priv
Ly static and private methods ove
diectly .
Bs Rea instaree methods and proper access levels,
6. feutormocte resting.
Ly Use automoted testing tools (like. Son , Pytest.
lenivrd :
p cei) taster, tepectable jand consistent teshig
hayd to testONIT—2, amp -lopies i
Fransaction flow testing _s techniques’
2: Dotor Flow testing Basics i
Svodle (eg
applicctions
Domina and path
, Nice’ und ug 4 Domains
y. Domaw and iarderface testing .
Se Domato and Aes kabillity.
3. Doming testing nh
\Traosaction flow testirg .
A shructus of testing tech nique focused ‘on.
business: Logic and uset interactions,
> Teansactien flow esting. ts a while - box -lesting
techniques +hot focuses on -the , Sequence oe
operections (Arran soctton3)) in @ system. sth is Sed
do test logico! business. flows . Such 08 banking.
sransactions , online osdervs
Sxample + online shopping checkook
t
ronsackoo sHeps *
|. Browse tems
Ds cast
3. exter address
4 Make payment
S .
-) order — confiemetien,this flow can be wepresented in a TFG Cra, .
- Sactien Graph) - |
Transactins loo testing techniqves |
Used +o test -brangaction — based systems
by anodyzing cacsto} flow and * logic.
ood Transaction Hots Graph Cra) construction |
-- Ceader o flow graph representing each bransac |
-tien step. . ; j = |
.. > Nodes = processing steps” oo Screens.
—? Edges = transiting [events bho steps
This helps Visvolige all possible +ransactlon
' pocths . 7
R pacth ‘Testing. on TRH,
"Apply path testing. techniques Clie baxig
. path slesting,) to the transaction -flevs graph
al independent paths
.—, Dectsien ports
. —> Loops and conditions 1
Design test coses +o covey all -thsve paths,
%) Data flow gesting. phe
A white - box testing technique focused op +H
thi lifecycle of vaxiables . eis ;
| Data flow esting. is a. shroctural esting,
© technique that examines —the Flow ‘oF‘Biato. (vortialles) though oo program.
ae focuses on hou variates ore defined
ysed ond killed.
77 Ft helps detect eXeVOTS veloded +o wyesrtauliy
misose. : :
strategies: ot’ DFT. vise H
All-defs 3 Atleast one vse fox every versio be.
detinition. i
PAL—vses EAI CoUSeS and p-uses foe
every vasiable definition.
Labora, p— predicate.)
6 cleftcition +>
oS
A\\ do pocths Lor Soe Form eac
Applications s every veachalo
rpriore
he - pata -Flovo testing ty am
BE ecting'h
> white- pox -testing -
> secuitty esting.
=> Maintenance and “debugging.
Val vott
a. compiler ee toe \ !
tchos oa B
plagrarn t= Hop Dake HO esting Catches o Sog-
der . ‘ > Use(x) ; NA
XL ts ‘
~ BK
Hy ts oy HK
iota used Sey! Giinthaliged “yea eetiedA black box an
— doevsed on « input
Def 3 Domain esting iS a
sthet involves
inpok valves ors domains”
technique
: b selecting
Ole inputs.
> the
poops or ~regins (domains)
from each yroop ertectvely.
Domain Testing.
TH a Black-box
testing type -
~> Tt Focwes of) input
YTonges and -theiy
boundaxr irs
> Tt & used fax Tastig
“npot Validation
deotslon tables.
2 Th doesn't vse graph
oy some -Hengs input
charts .
P
|
domain
eel niayse “used
Boombry valve, ral
hele box esting techniques
editions. :
Sof-tuoare shesting,
esting A Peogranny
good lg 4o. divide +ho input space insto
and test 3
| pect tesbing
> Tt isa white-bor
testing. type -
| i
+s th focuses on execution
| paths through the
«code.
415 rw" used For testing
loops, branches: and
program Logic.
I? Fe. uses corbyol flow
Gwoph (cre).
7 Boss pocth testing.
technique 4 used-
|we
[ete Testing inpuboge. [cit testing —else
Velves Ke 0, 50, too, 101 conditions ocnd loops io
res : : : he Codd
Nice ond ugly Demaing
ie Nice Domoein valy Dometn,
Bo Dodds Gare, F _ OG =
2 Nice Ore 2 | > veg Domain & Risky:
| well-behaved’ inpot vegion, oF enrOy—prone tpyr
| i BERION :
2° TH 8 -vsed ‘to clased 2 ge “| ;
inpdk Spates for effective > & used to clarsily
yest! cose ‘design. inpot spaces for epreclie
“pest cade design.
> Fk behaves stable. ‘
Sand correct. pxog raro —> Tt behaves likely -t°
FeSponse. + tous cause esvors OF ONEKPEK
re . -ded ‘tesvlts-
> he puspase of ostng. | | _y -the purpose of oly.
vice domain is -to | viet. u
ae emo funclion |’ pomaln is ‘shess ane.
we . 5 ’ Ffaott detection |;
cally
a- Middle valves > ert Boundary oe tavadid
Jee, soya vate C0, 0
op Dott and inbedtece estge. 2
pnare: testing: re : _
mostly. while | > Hw +ypically elack-box
& integration rtesting .
Stl ise
box 4 black -box testing
rt Focuses on volidak => TE focus or Volidadi
input voles and thety | communication b]u) maivles| ae
boundax les. 9 ' ‘ and 5 systems
“> rh & used for ieee —> Bis used for Systems
with numewe or logical with mottiple component,
» Sesvices .
inputs. APls ; Gols.
> Techniques © Equivalence) —> Techniques 3 API teste
partitioning, Boundar prvlocol esting. Service
i valve Anobysis (Bva) mocking .
> Tools used in domain |—s Tools used in interface
rtesting. axe rrianvo}, esklag, are postman , SOAP
unit test Prambwarks .
REST Assured , Sunit,
> exainp lé a | Seber. .
Testing. values od example
° o,s0 de 160,101 for in Testing. data passed fom
\ Ll +o. backend oy from
Tonge t— 100
_ APP A +o Sewice Bo
“Spornaio and ard destability. ‘
fr domain titht sebof alt pan inputs “thot
a &nction smodole, or syste can accept.
‘Sth may. inclode. valid inputs Cex! numbers ‘bom
Ie Geka ipod topots (ex? Lo, tol, stings instead
oF aum ers)
-P | 6 wo). Sle v bende Valves (ex: exact.
Testability + “eshabuily TeFers to how easil
| and effectively a system can be tesled, A syster
| with high | testabulity ¢
bo TH iS cody 40 observe Bnd Le
|!
—>, Thar cleax inpot / out pot beh
Ss ze Allows Fouts’ +0 be Bivitapevacti