scieee Science in your language
[en] (orig)

System test cases from use cases

Abstract

Use cases have become a widely used technique to define the functionality of a software system. This paper describes a new, formal and systematic approach for generating system test cases from use cases. This process has been designed specially for testing the system from the point of view of the actors, through it graphical user interfaces.

Read accessible full text

System test cases from use cases

Author: Gutiérrez Rodríguez, Javier Jesús; Escalona Cuaresma, María José; Mejías Risoto, Manuel; Torres Valderrama, Jesús
Publisher: SciTePress
Year: 2006
DOI: 10.5220/0001309302830286
Source: https://idus.us.es/bitstreams/fced2eb6-4ee1-4c83-8776-8a2f03a8d9ec/download
SYSTEM TEST CASES FROM USE CASES
Ja ie J. Gu ié ez, Ma ía J. Escalona, Manuel Mejías, Jesús To es
Uni e si y o Se illa, A d. Reina Me cedes sn. Se illa, Spain
{ja ie j, escalona, iso o, j o es}@lsi.us.es
Keywo ds: Sys em es ing, use cases, gene a ion o es cases.
Abs ac : Use cases ha e become a widely used echnique o de ine he unc ionali y o a so wa e sys em. This pape
desc ibes a new, o mal and sys ema ic app oach o gene a ing sys em es cases om use cases. This
p ocess has been designed specially o es ing he sys em om he poin o iew o he ac o s, h ough i
g aphical use in e aces.
1 INTRODUCTION
Sys em es ing is a black-box echnique which
e i ies he sa is ac ion o he equi emen s o he
sys em unde es (SUT) (Bu ns ein, 2003). Ea ly
es ing is he gene a ion o es cases in ea ly
de elopmen phases. This is no a new idea. Two
su eys (Denge , 2003) and (Gu ié ez, 2004) (22
di e en app oaches in o al) expose ha he e a e
many lacks in he exi ing app oaches. One lack is
he absence o a o mal p ocess and he absence o
ee a ailable ools. Ano he lack is ha app oaches
a e no comple e; his means ha hey desc ibe how
o gene a e pa ial es cases, mainly es ac ions,
wi hou desc ibing o he impo an elemen s such as
es da a, expec ed esul , execu able es sc ip s, o
es co e age.
In a p e ious wo k i was desc ibed how o
gene a e es cases om use cases o web
applica ion using exis ing app oaches (Gu ié ez,
2005). This pape ies o esol e bo h lacks o e ing
a o mal app oach o ob ain execu able es sc ip s
om use cases. I has been specially designed o be
used in ea ly de elopmen phases. I also uses UML
and UML Tes ing P o ile (OMG, 2002) (called
UMLTP om now). Rela ed wo ks may be ound in
(Denge , 2003) and (Gu ié ez, 2004).
2 A PROCESS TO GENERATE
TEST CASES FROM USE
CASES
This es p ocess is ocused on es ing use cases
whose p incipal ac o is human. A es case is
composed o h ee elemen s: es ac ion, es alues
and expec ed esul s. Tes ac ions a e he ac ions
de eloped by he es case o e he sys em unde es
(SUT). Tes alues a e he in o ma ion needed by
he es case. Expec ed esul s a e he esponses o
he sys em ha allows e alua ing whe he he es is
sa is ied o ailed. The esul s o his p ocess a e:
es objec i es, a se o es cases o e i y each
objec i e and es sc ip s. Tes cases a e exp essed
using models and g aphical no a ion de ined in
UMLTP when possible.
2.1 Tes ing Models
The models used o s o e he in o ma ion abou es
cases a e: es objec i e model, es da a model,
in e ace model and e en model.
1. Tes objec i e models.
A es objec i e is an elemen named acco ding o
he desc ip ion o wha should be es ed. The
UMLTP does no de ine any no a ion o ep esen
es objec i es. Thus, we use ac i i y diag ams.
A es objec i e is a pa h h ough he ac i i y
diag am. Tes objec i es migh be au oma ically
ex ac ed om he ac i i y diag am applying a
co e age c i e ion, like all-edges and all- ansi ions.
E e y es objec i e will ha e a leas one es case
o e i y i . An example is shown in able 4.
2. Tes da a model.
Tes da a model desc ibes he s uc u e and alues o
he es da a. The i s ask is o iden i y ope a ional
a iables (o simply a iables) o a use case. An
ope a ional a iable is an explici inpu o ou pu , an
en i onmen al condi ion o a ep esen a ion o he
283
SUT (Binde , 1999). The domain o e e y a iable
is di ided in o da a pa i ions. UMLTP uses class
diag ams and s e eo ypes o desc ibe he hie a chy
o da a pa i ions. A e ha , es alues a e
gene a ed o e e y da a pa i ion. Case s udy shows
an example o da a s uc u es, pa i ions and es
alues in igu e 4.
3. In e ace model.
Ou aim is o es he unc ionali y h oughou a
g aphical in e ace, no o es he g aphical in e ace
i sel . The objec i e o his model is o desc ibe he
in e ace used o he es case o in e ac wi h he
sys em. Since his p ocess has been designed o be
applied in ea ly de elopmen phases, his model
ep esen s a high abs ac desc ip ion o he GUI.
UML Tes ing P o ile, and UML in gene al, does no
include any speci ic no a ion o GUI, so i will be
used class and objec diag ams o ep esen he
componen s and s a es o a GUI.
Figu e 1: Example o componen s o in e ace models.
Figu e 1 shows a class diag am wi h some
elemen s om an in e ace model.
4. E en model.
F equen ly, ac o ac i i ies om a es objec i e a e
oo abs ac o be di ec ly ansla ed in o a es sc ip .
I is p oposed o build up an e en model o add ess
o his complexi y. A se o e en s desc ibes how o
pe o m ac o ac i i ies iden i ied in he es
objec i e model. I an ac i i y needs o supply
in o ma ion o he sys em, his in o ma ion should
ha e been de ined in he es da a model. This pape
in oduces a simple se o messages o exp ess
e en s. These messages a e lis ed in able 1. Due o
hei simplici y, he messages migh be easily
ex ended. E en model also includes an asse
message ( able 1). This message is sen by he es
case o i sel o e i y an a ibu e o he GUI. This
message allows codi ying he expec ed esul s in o a
es sc ip , an example is shown in case s udy.
Table 1: Messages o e en model.
Message Meaning
ClickOn(componen ) Pe o m a one-click e en o e
he indica ed GUI componen .
Sc een(sc een) Sea ch o he indica e GUI
sc een and se he ocus o e
i .
Se Field( ield, alue) Se he indica ed alue in o he
ield objec .
Asse (componen .
a ibu e, alue)
Ve i y ha he a ibu e o he
componen indica ed ma ches
wi h he alue.
2.2 S eps o Gene a e Tes Cases
We sugges a p ocess o six s eps o gene a e es
models and o ob ain execu able es sc ip s. These
s eps a e shown in he ac i i y diag am in igu e 2
and desc ibed in he ollowing pa ag aphs.
Figu e 2: Ac i i ies o gene a e es cases.
The i s s ep is o build up a es objec i e model
om a use case, as desc ibed in poin 2.1. The
second one is o build up he es da a model as
desc ibed in poin 2.1. In he hi d s ep, es cases a e
gene a ed combining es objec i es wi h es alues.
The numbe o es cases is de e mined by he es
objec i es and he di e en pa i ions o he
a iables in ol ed in ha es objec i e. In he ou h
s ep, in e ace model is gene a ed, as desc ibed in
poin 2.1. In he i h s ep e en model is gene a ed.
Finally, e en messages, es alues and asse ions
a e ansla ed in o es sc ip s, comple ed wi h es
ha ness (Binde , 1999) and execu ed o e he eal
SUT.
ICSOFT 2006 - INTERNATIONAL CONFERENCE ON SOFTWARE AND DATA TECHNOLOGIES
284
3 CASE STUDY
This sec ion applies he p ocess desc ibed in sec ion
2 o e a eal sys em o gene a e es cases. The
sys em unde es is an implemen a ion o a classic
no epad. The use case selec ed o gene a e es cases
is Open File ( able 2).
Table 2: Templa e o use case "Open File".
Desc ip ion Load documen om ile
P econdi ion No
Main
scena io
1 Use selec “Open ile” op ion.
2 Sys em asks o he ile o
open.
3 Use selec s a ile.
4 Sys em loads he ile and
shows he documen .
Al e na i e /
e o s
3 Use may cancel he loading
ope a ion a any ime.
4 I ile does no exis o he e is
an e o , sys em shows an e o
message.
Pos
condi ion
No.
A ull co e age o he use case is selec ed. This
means ha a leas one es case o e e y iden i ied
es objec i e will be gene a ed.
3.1 Gene a ion o Tes Objec i es
Fi s o all, he es objec i e model is buil ( igu e
3). Ac i i ies 01 and 03 a e de eloped by he use
and ac i i ies 02, 04, 04.1 and 04.2 a e pe o med by
he sys em. S ep 4 ( able 4) has been di ided in o
ac i i ies 04, 04.1 and 04.2, and due o hei esul s
hey may be di e en i he e is an e o when
opening he ile.
Figu e 3: Tes objec i e model.
Table 4 shows es objec i es ob ained by
a e sing igu e 3.
3.2 Gene a ion o Tes Values
Fi s ly he a iables in ol ed in he use case a e
iden i ied. Tes objec i e model in igu e 3 e eals
ha he e a e, a leas , wo a iables ( he same
numbe as decision nodes). Va iables and domains
a e esumed in able 3.
Table 3: Va iables and domains.
Va iable Domain
Use -Op ion Op ions a ailable o he use : load
ile o cancel.
File File o open
Use -Op ion is a a iable o an enume a ed ype.
Howe e , File is a a iable o a complex ype. Fo
he es ing pu pose he e mus be known, a leas , he
name o he ile, i s con en and i s a ibu es.
Figu e 4: Tes da a.
Now, we di ide he domains in o da a pa i ions.
Finally, a leas one es alue is gene a ed o each
pa i ion. Objec diag am in igu e 4 shows es s
alues.
3.3 Build Tes Cases
A es case is a es objec i e wi h a conc e e alue
o i s a iables. Va iables and hei pa i ions a e
added o he es objec i es, as shown in able 4.
Table 4: Tes objec i es wi h a iables and pa i ions.
Tes objec i es
1 01, 02, 03( 01: Wi hou -E o s, op01:LoadOp ion), 04,
04.1
2 01, 02, 03( 02: Wi h-E o s, op02:LoadOp ion), 04, 04.1
3 01, 02, 03( 03: *, op03:CancelOp ion), 04, 04.1
3.4 Gene a e In e ace Model
I is assumed ha he sys em unde es is no buil
ye . So, i is gene a ed an abs ac desc ip ion o he
use in e ace wi h he minimum se o componen s
o pe o m he use case.
S udying he use case, we ealize ha he e a e
h ee sc eens in ol ed: he main sc een, whe e use
ac o clicks on open op ion, he ile selec ion sc een,
SYSTEM TEST CASES FROM USE CASES
285
whe e use ac o selec s he ile o open, and he
e o sc een whe e sys em shows he e o message,
i any.
The in e ace model is shown in he objec
diag am in igu e 5.
Figu e 5: In e ace model.
3.5 Gene a e E en Models and
Expec ed Resul s
Fi s , each use ac i i y is e ined using messages
lis ed in able 1 and he use in e ace, de ined in
poin 3.4. The e en model o e i y he main
scena io is desc ibed as UML sequence diag am in
igu e 6.
Figu e 6: E en model.
Valida ion ac ions a e implemen ed using he
asse p oposi ion shown in able 1 and ac i i ies
diag ams as p oposed in he UMLTP. Due hei
simplici y, he ha e been omi ed.
The p ocess has ended. The e ha e been
gene a ed es ac ions (shown in he e en model),
es alues (shown in he es alue model) and
expec ed esul s (shown in he e en model oo) ha
commi s ou es objec i es (shown in he es
objec i e model). Up o now, we ha e no needed
he design o he code o he sys em.
3.6 Building Tes Sc ip s
The in o ma ion ob ained in he poin s be o e, migh
be au oma ically ansla ed in o execu able es
sc ip s. De ails o he implemen a ion and es ool
a e needed o pe o m his s ep. I is used a eal
implemen a ion o he no epad, called S ylepad, o
gene a e es sc ip s. The S ylepad is dis ibu ed in
he Ja a De elope Ki . I has been used an open
sou ce ool called Abbo o codi y execu able
sc ip s.
4 CONCLUSIONS
This pape has shown a p ocess o he ea ly- es ing
o use cases. Al hough his p ocess has been
designed o es use cases om he pe spec i e o
human ac o s, i can be also used o es o he ac o s.
This p ocess can be applied in ea ly de elopmen
s ages. In ac , in case s udy desc ibed in sec ion 3,
all es cases ha e been gene a ed be o e choosing a
eal implemen a ion o es .
REFERENCES
Binde R.V. 1999. Tes ing Objec -O ien ed Sys ems.
Addison-Wesley. USA.
Bu ns ein, I. 2003. P ac ical so wa e Tes ing. Sp inge
P o essional Compu ing. USA.
Denge , C. Medina M. 2003. Tes Case De i ed om
Requi emen Speci ica ions. F aunho e IESE Repo .
Escalona M.J. 2004. Models and Techniques o he
Speci ica ion and Analysis o Na iga ion in So wa e
Sys ems. Ph. Eu opean Thesis. Depa men o
Compu e Language and Sys ems. Uni e si y o
Se ille. Se ille, Spain.
Gu ié ez, J.J., Escalona M.J., Mejías M., To es, J. 2004.
Compa a i e Analysis o Me hodological P oposes o
Sys ema ic Gene a ion o Sys em Tes Cases. 3º
Wo kshop on Sys em Tes ing and Valida ion. Pa is.
F ance.
Gu ié ez J.J., Escalona M.J., Mejías M., To es J. 2005. A
p ac ical app oach o Web Sys em Tes ing. Ad ances
in In o ma ion Sys ems De elopmen . Ed. Sp inge
Ve lag Ka ls ad, Sweeden.
Objec Managemen G oup. 2002. The UML 2.0 Tes ing
P o ile. www.omg.o g
ICSOFT 2006 - INTERNATIONAL CONFERENCE ON SOFTWARE AND DATA TECHNOLOGIES
286