117
University of Malta Department of Computer Science Faculty of ICT TATJA A Test Automation Tool for Java Applets Author: Matthew Xuereb Supervisor: Dr. Ernest Cachia Submitted in partial fulfillment of the requirements for the degree of B.Sc. I.T. (Hons.)

University of Malta - Matthew Xuereb

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

University of Malta 

Department of Computer Science  

Faculty of ICT 

TATJA ‐ A Test Automation Tool for Java Applets       

Author: Matthew Xuereb  

Supervisor: Dr. Ernest Cachia  

Submitted in partial fulfillment of the requirements for the degree of B.Sc. I.T. (Hons.) 

i

Abstract

A l t ho ug h th e r e a r e s o me v e r y g o od to o l s t o t e s t W eb A p p l i c a t io n s , s u ch

to o l s n e g le c t t h e f ac i l i t y t o t e s t J av a A p p l e t s . W i th ex i s t i n g

t e ch no lo g ie s , J av a A p p l e t s can o n ly b e t e s t ed e i th e r by us i ng

S w ing /AWT GUI T es t i ng T oo l s o r e l s e by u s ing t o o l s t ha t make s u se o f

i ma g e r e c og n i t i o n in o r d e r t o c a p tu r e and p l ay b ack ev en t s . S u ch t oo l s

a r e n o t t a i l o r ma d e t o t e s t J av a A p p l e t s an d c ann o t be u sed t o t e s t J av a

A p p l e t s i n t h e i r a c tu a l r u n n i n g e nv i r o n men t , t h a t i s , i n w eb b r o w s er s .

Th e i mp l e men t ed too l a l l o w s s o f twar e t e s t e r s t o t e s t J av a A p p le t s i n

t h e i r a c t u a l r u n n i n g en v i r o n men t s . T h e t o o l i s p l a t f o r m a n d b r o w s er

i n d ep e nd en t an d d oes ma k e u s e o f a ny th i rd pa r t y s c r ip t in g l an g uag e .

T e s t s c as es a r e g e n e r a t ed d i r e c t ly i n J ava .

ii

To MV Mar ia Do lores

F or b e in g m y in sp i r a t io n th r ou g ho u t t h i s co ur s e

iii

Acknowledgments

I w ou ld l i k e to t h ank my s up e r v i s o r D r . Er nes t Cac h i a f o r t he h e l p ,

p a t i e nc e , an d in s ig h t f u l adv i c e t h r ou g ho u t t h e co u r s e o f t h i s p r o j e c t .

A s pe c i a l t h an k s g oe s o u t t o M a r k M ic a l l e f , a f r i en d a nd a me n t o r , f o r

h e lp in g me t o fo r mu l a t e t h e i d ea o f t h i s p r o j ec t an d t o Ro b er t a M us ca t

f o r g i v in g me th e in i t i a l s e ed o f i n s p i r a t i o n t o i mp le men t t h i s t e s t i n g

to o l .

F in a l l y , I w o u l d l i k e to t h a n k my c l o s es t f r i e nd s L i nd s ay an d D an i e l f o r

t h e i r s u p po r t an d f o r he lp ing t o mak e t he s e f ou r y ea r s a t r u ly

m e mo r a b l e ex p e r i e n c e .

iv

Table of Contents 1. Introduction ..................................................................................................... 1

1.1 Background Theory ..........................................................................................................1 1.2 Software Testing Methods................................................................................................2 1.3 Static vs. Dynamic Testing...............................................................................................3 1.4 Test Levels........................................................................................................................4 1.5 Regression Testing ...........................................................................................................5 1.6 Automated Testing Tools .................................................................................................5 1.7 Summary...........................................................................................................................6

2. Testing Web Applications............................................................................... 7

2.1 Overview ..........................................................................................................................7 2.1.1 Presentation Layer Testing ........................................................................................9 2.1.2 Business Layer Testing............................................................................................10 2.1.3 Data Layer Testing ..................................................................................................10 2.1.4 Web Application Test Automaton Requirements....................................................11 2.1.5 Conclusions .............................................................................................................13

2.2 Web Application Testing Tools......................................................................................13 2.2.1 Content Testing Tools .............................................................................................14 2.2.2 Security Testing Tools.............................................................................................14 2.2.3 Functional Testing Tools .........................................................................................15 2.2.4 Conclusions .............................................................................................................19

2.3 Summary.........................................................................................................................19 3. A Test Automation Tool for Java Applets .................................................. 20

3.1 Java Applets Overview...................................................................................................20 3.2 TAJTA Overview ...........................................................................................................22 3.3 User action Capture and Generation...............................................................................25

3.3.1 Using the Java Robot Class .....................................................................................26 3.3.2 Using an Applet Wrapper ........................................................................................26 3.3.3 Conclusion...............................................................................................................27

3.4 Component Event and Method Invocation.....................................................................28 3.5 Technologies to be used .................................................................................................29

3.5.1 XML ........................................................................................................................29 3.5.2 The Reflection API..................................................................................................30

3.6 Summary.........................................................................................................................31

v

4. Specification and Design............................................................................... 32 4.1 General System Architecture..........................................................................................32

4.1.1 Recording Mode ......................................................................................................33 4.1.2 Playback Mode ........................................................................................................35

4.2 TatjaML..........................................................................................................................37 4.2.1 Commands ...............................................................................................................38 4.2.2 Events ......................................................................................................................39

4.3 GUI Design.....................................................................................................................41 4.3.1 The Record Toolbar.................................................................................................41 4.3.2 The Playback Toolbar..............................................................................................42

4.4 Applet’s Components Identification...............................................................................43 4.5 TATJA ‘Record’ Design ................................................................................................44

4.5.1 ‘Record Instruction’ Design ....................................................................................44 4.5.2 ‘Record GUI’ Design ..............................................................................................45

4.6 TATJA ‘Playback’ Design .............................................................................................47 4.7 Summary.........................................................................................................................48

5. Implementation.............................................................................................. 49

5.1 Implementation Overview ..............................................................................................49 5.2 Package common............................................................................................................50 5.3 Package defenitionsdriver ..............................................................................................50

5.3.1 Class DefenitionsDriver ..........................................................................................51 5.4 Package dialogboxes.......................................................................................................54 5.5 Package helpers ..............................................................................................................55

5.5.1 Class TestHelpers ....................................................................................................56 5.6 Package tatja ...................................................................................................................60

5.6.1 Class AppletTester...................................................................................................61 5.6.2 Class RecorderHandler ............................................................................................62 5.6.3 Class TestPlayHandler.............................................................................................63

5.7 TATJA Configuration files.............................................................................................64 5.8 Summary.........................................................................................................................65

6. Testing and Evaluation ................................................................................. 66

6.1 Testing Strategy..............................................................................................................66 6.2 Test Case 1 – A Data Clustering Simulation Applet ......................................................67

6.2.1 Test Case Design .....................................................................................................67 6.2.2 Test Case Execution ................................................................................................68

6.3 Test Case 2 – A Car Loan Calculator Applet .................................................................70 6.3.1 Test Case Design .....................................................................................................71 6.3.2 Test Case Execution ................................................................................................72

6.4 Test Case 3 – A Frictionless Slope Simulation Applet ..................................................73 6.4.1 Test Case Design .....................................................................................................74 6.4.2 Test Case Execution ................................................................................................75

6.5 Summary.........................................................................................................................77 7. Conclusions and Future Work..................................................................... 78

7.1 Summery of Results .......................................................................................................78 7.2 Future Work and Research .............................................................................................78

vi

7.3 Conclusion......................................................................................................................79 References .......................................................................................................... 81 Bibliography ...................................................................................................... 85 A. User Manual.................................................................................................. 86

A.1 Requirements .................................................................................................................86 A.2 Installation and Execution Instructions .........................................................................86 A.3 TATJA in Record Mode ................................................................................................87

A.3.1 The Record Toolbar................................................................................................87 A.3.2 Loading the Applet to be tested ..............................................................................88 A.3.2 Loading/Creating TATJA Test Classes ..................................................................89 A.3.3 Selecting/Creating TATJA Test Methods ..............................................................90 A.3.4 Test Case Recording...............................................................................................91

A.3 TATJA in Playback Mode.............................................................................................95 A.3.1 The Playback Toolbar.............................................................................................95 A.3.2 Loading Applet and Test Class...............................................................................96 A.3.2 Executing a Test Case.............................................................................................96

A.4 TATJA Test Suite ..........................................................................................................96 A.4.1 Creating a Test Suite...............................................................................................96 A.4.2 Editing/Programming a Test Suite .........................................................................97 A.4.3 Executing a Test Suite ............................................................................................98

B. TatjaML Sample Document ...................................................................... 100 C. Contents of the CD ROM .......................................................................... 105 D. Permissions and Clarifications.................................................................. 106

D.1 Permission to use working Applets .............................................................................106 D.1.1 Permission email from Mr. Damien Martin .........................................................106 D.1.2 Permission email from Profs. Deepak Kumar ......................................................107

D.2 The TATJA Logo ........................................................................................................108

vii

List of Figures F ig u r e 1 : U s e Cas e D i ag r a m 2 2 F ig u r e 2 : R e co r d in g p r o ces s A c t iv i t y D iag r a m 2 4 F ig u r e 3 : P l ay b ack p r oce s s A c t iv i ty D ia g r a m 2 4 F igu r e 4 : An XML markup fo r a news a r t i c l e 29 F ig u r e 5 : G en er a l S y s t e m A r ch i t e c tu r e 3 2 F ig u r e 6 : T A T JA in r ec o r d i ng mod e 3 4 F ig u r e 7 : T A T JA in p l a y b ac k mod e ( W h e n U s e d M a n u a l l y ) 3 5 F ig u r e 8 : T A T JA in p l a y b ac k mod e ( W h e n i n v o k e d p r o g r a m m a t i c a l l y ) 3 6 F ig u r e 9 : A n ex t r ac t f r o m a Ta t j aM L do cu me n t 3 7 F ig u r e 10 : A n ex a mp l e o f a T a t j aM L co m ma n d 3 8 F ig u r e 11 : A n ex amp l e o f a T a t j aM L ev en t 3 9 F i g u r e 1 2 : D es i g n o f t h e u s e r i n t e r f a c e 4 1 F ig u r e 13 : D es ig n o f t he t oo lb a r i n p l a y b ack mod e 4 2 F ig u r e 14 : Ex a mp l e o f t h e d o t n o t a t i o n a s ad op ted by TA TJA 4 4 F ig u r e 15 : E x a mp l e o f a T a t j a M L d e f in i t i on f o r a J R ad i o Bu t to n c o mpo n e n t 4 6

F ig u r e 16 : A sk e t ch o f t he ‘ r eco r d ’ d i a lo g bo x 4 7 F ig u r e 17 : A s c r e e n s ho t o f T A T J A i n S un ’ s A pp le t V i e w er 6 1 F ig u r e 18 : A s c r een s ho t o f T A TJ A wi th t h e mo us e p o in t e r on a c o mpo n e n t an d w i t h th e R e c or d D ia l og B o x v i s i b l e 6 3

F ig u r e 19 : A s c r e e n s ho t 6 7 F ig u r e 20 : A s c r e e n s ho t 6 9 F ig u r e 21 : A s c r e e n s ho t 7 0 F ig u r e 22 : A s c r e e n s ho t 7 1 F ig u r e 23 : A s c r e e n s ho t 7 2 F ig u r e 24 : A s c r e e n s ho t 7 3 F ig u r e 25 : A s c r e e n s ho t 7 4 F ig u r e 26 : A s c r e e n s ho t 7 5 F ig u r e 27 : A s c r e e n s ho t 7 7 F ig u r e 28 : S c r e en s h o t o f T A T J A Reco r d t oo l b a r 8 2 F ig u r e 29 : S c r e en s h o t o f t h e L o a d A pp le t D i a lo g Bo x 8 3 F ig u r e 30 : S c re en S h o t o f t h e T es t C l as s C h oo s e r D ia lo g Bo x 8 5 F ig u r e 31 : S c r e en s h o t o f t h e T es t M eth od Ch oo s e r D i a lo g Bo x 8 6 F ig u r e 32 : A s c r e e n s ho t 8 7

viii

F ig u r e 33 : A s c r e e n s ho t 8 8 F ig u r e 34 : A s c r e e n s ho t 8 8 F ig u r e 35 : A s c r e e n s ho t 8 9 F ig u r e 36 : A s c r e e n s ho t 9 0 F ig u r e 37 : A s c r e e n s ho t 9 0 F ig u r e 28 : A s c r e e n s ho t 9 2

1

Chapter 1 Introduction

1.1 Background Theory S o f tw a r e t e s t i ng i s t h e p r o c e s s u s ed to me a s u r e th e q ua l i t y o f c omp u t e r

s o f tw a r e i n t e r ms o f t he d e f ec t s f o un d . I n t h e b oo k e n t i t l ed T he Ar t o f

S o f t wa r e T es t in g [ 3 ] , t h e au t ho r a r gu es th a t so f tw ar e t e s t i n g i s no t t h e

p r o ce s s o f s h o w ing tha t t h e p r o g r a m d oe s n o t co n t a i n s e r r o r s , bu t i t i s

t h e o th e r w ay r oun d , t ha t i s , t he p r oc e s s o f ex e cu t in g a p r og r a m w i t h

th e t a r g e t o f f i n d i ng e r r o r s .

T h e r e a r e d i f f e r e n t me th o d s an d ap p r o a ch es to s o f tw ar e t e s t i n g .

H o w ev er b e f o r e ap p ly in g s uch me th o d s an d ap p r oach es , a s o f tw a r e t e s t

en g in e e r s h o u ld un d e r s t and th e b a s i c p r in c ip l e s t h a t g u i d e s o f t w ar e

t e s t i n g . P r e s s man [1 ] i d en t i f i e s a s e t o f t e s t i ng p r i nc i p l e s t h a t a r e

ad ap t ed f r o m t h e b oo k o f D av i s [3 1 ] , 20 1 Pr in c ip l e s o f So f twa re

D ev e lo pm e n t . T h es e b as i c p r in c i p l e s a r e l i s t ed an d ex p l a in ed b e lo w :

• Tes t in g s h ou l d b eg in ‘ in t h e s ma l l ’ a n d p ro gr es s t o wa r d s

t e s t in g ‘ in th e l arge ’ . T h e f i r s t t e s t s p l an n ed s h o u l d f o cu s i n

i n d iv id ua l c o mp o n e n t s and t hen s h i f t s f oc us t o f i n d e r r o r s i n t he

en t i r e s y s t e m.

• Ex h au s t iv e t e s t in g i s n o t p os s i b l e . I t i s i mp o s s ib l e t o e xe c u t e

ev e ry co mb in a t io n o f pa t hs d u r i n g t e s t i n g . I t i s p o s s i b l e

ho w ev er , t o ad eq u a te ly co ve r p r og r am l o g i c a n d to e ns u r e th a t a l l

co nd i t i on s h av e b e e n me t .

2

• A l l t e s t s s h ou ld b e t rac e ab l e t o c u s tome r r e q u irem en t s . The

ob jec t iv e o f s o f t w ar e t e s t i n g i s t o u n cov e r e r r o r s . Th e mo s t

s ev e r e d e f ec t s a r e t h o s e t h a t cau s e t h e p r o g r a m t o f a i l t o me e t i t s

r equ i r e men t s .

• Tes t s s h o u ld b e p la nn e d lo n g b e fo r e t e s t i ng b e g i ns . D et a i l ed

de f in i t i o n o f t e s t c a s es c an beg i n a s s oo n a s t he d e s ig n mod e l i s

r eady .

1.2 Software Testing Methods S o f tw a r e t e s t i ng me t ho ds a r e t r a d i t i o na l ly d iv id ed in t o b l a c k b o x

t e s t i n g and w h i t e b o x t e s t i n g . Th es e ap p ro ach es a r e u s ed to d es c r ib e

th e po in t o f v i e w tha t a s o f tw ar e t e s t en g in ee r t ak es w h en d es ig n i ng

t e s t c a s es .

B l ack b o x t e s t i ng i s co nc e r n ed ab o u t t h e f u n c t i on a l i t y o f t h e p r o g r a m

r a th e r t h an ab o u t t h e i n t e r n a l b e hav io u r o r s t r uc tu r e o f t h e sy s te m. I t

i s ca l l ed b lac k b ox f o r t h e s i mp l e r eas o n t h a t no k no w led g e o f t he

w o rk in gs o f t h e p ro g ra m i s u s ed a s pa r t o f t h e t e s t i n g . O n ly in pu t s an d

o u t pu t s a r e c on s ide r e d s i n c e th e p r og r a m i s t ho u g h t o f a s be i n g

in v i s ib l e w i t h i n a b l a ck b o x [ 2 ] . B l ack b o x t e s t i n g u s ua l ly r e qu i r e s

t h r ou gh t e s t c a s es t o b e p r o v id ed t o t he t e s t e r w h o t he n c an s i mp ly

v e r i fy t h a t f o r a g iven in pu t , t he o u tpu t v a lu e o r behav iou r i s t h e s a me

as t h e e xp e c t ed v a lu e s p e c i f i ed i n t he t e s t c a s e . B l ack b o x t e s t i ng

a t t e mp t s t o f i n d e r ro r s i n t h e f o l l ow i n g ca t eg o r i e s [1 ] :

• I n co r r ec t o r mi s s i n g f un c t io n s

• E r r o r s i n d a t a s t r u c tu r es o r e x t e r n a l d a t a b a se a c ces s

• Beh av io u r o r p e r f o r man ce e r r o r s

• In i t i a l i s a t i o n an d t e r min a t io n e r r o r s

3

W h i t e b o x t e s t i ng ( s o me t i me s a l s o c a l l ed G l a s s Bo x T e s t in g ) ma k es u s e

o f t he k no w led g e o f t he in t e r na l d a t a s t r uc t u r es , co d e an d a lg o r i t h ms o f

t h e s y s t em. U s i n g w h i t e bo x t e s t i n g me t h o d s , t h e t e s t e ng in ee r c a n

d e r iv e t e s t c a s es t h a t [1 ] :

• G ua r an t e e th a t a l i n d ep e n d en t p a th s w i th in a mod u le h av e b e e n

ex e rc i s ed a t l ea s t on ce

• E x erc i s e a l l l o g i c a l d e c i s i on s o n th e i r t r u e an d f a l s e s i d e s

• E x e cu t e a l l l oo ps a t t he i r b o u nd ar i e s an d w i t h i n th e i r o p e ra t io n a l

bo un d s

• E x erc i s e i n t e r n a l d a t a s t r u c t u r e t o a s s u r e th e i r v a l id i t y

1.3 Static vs. Dynamic Testing Th e r e a r e t w o b as i c w ay s o f h ow to t e s t a p i ece o f s o f t w ar e – e i t h e r

s t a t i c o r d y n a mi c . S t a t i c t e s t i n g i s w h en a p r o g r a m i s t e s t ed w i t h o u t

r u n n in g i t . S t a t i c t e s t i n g i s p r i ma r i l y sy n t ax check ing o f t he code and

manu a l l y r e ad ing o f t h e co d e o r do cu men t s t o f i nd e r r o r s . D ur in g s t a t i c

t e s t i n g , t e s t eng i n ee r s p e r f o r m fo r ma l r ev i ews , che cks fo r co r r ec t

co d in g s t an d a r d s , an d a l s o p e r f o r m c od e w a l k th r o u gh s . S t a t i c t e s t i n g

can be d o ne b e fo r e dy nami c t e s t ex ec u t ion .

O n th e o th e r h an d , dy n ami c t e s t i n g i s a b o u t t e s t i ng t h e d y n a mi c

b eh av iou r o f t h e co d e , i . e . t e s t i n g a ru nn in g p r og ra m. I n dy n ami c

t e s t i n g th e p r og ra m mu s t ac tu a l ly be co mp i l ed an d ex ecu t ed . Dy n a mi c

t e s t i n g i nv o lve s w or k ing w i th th e s o f tw a r e , g iv in g inp u t v a l u es a nd

ch eck in g i f t he o u t pu t i s a s ex p ec t e d .

4

1.4 Test Levels T h e r e a r e f o u r ma in l e v e l s o f s o f tw a r e t e s t i ng ( A s ag r e e d by many

s o f tw a r e t e s t i n g b o o ks ) . T he se a r e :

1 . Co mp on e n t T es t i n g

2 . In t eg r a t i o n Tes t in g

3 . S y s te m T es t in g

4 . Accep t ance Tes t i n g

C o mpo n e n t t e s t i n g ( a l so ca l l ed U ni t T e s t in g ) i s t h e p r oces s o f t e s t i n g

an in d iv i du a l p o r t i on o f co d e ( t ha t i s , a c o mp on en t ) t o d e t e r min e

w h e th e r i t f u n c t i o n s p r o pe r ly [ 4 ] . C o mp o n en t t e s t i n g i s u s ua l ly

p e r f o r me d by th e s o f t w a r e d e v e lo p e r an d n o t b y t he so f tw ar e t e s t

en g in e e r . I f co mp on en t t e s t i n g i s d on e p r o p e r l y , l a t e r t e s t i n g w i l l b e

mor e su c c es s f u l .

I n t eg r a t i on t e s t i n g i s t he p ha s e i n w h ich in d iv id u a l s o f t w ar e mo d u l e s

a r e co mb in ed an d t e s t ed a s a g r ou p . T he g o a l o f i n t eg r a t io n t e s t in g i s

t o exp os e f au l t s i n t h e i n t e r f aces and in i n t e r ac t io ns b e t we en in t eg ra t ed

co mp o n e n t s .

S y s t e m t e s t ing i s c a r r i ed o u t o n t h e c o mp l e t e i n t eg r a t ed sy s t e m i n o r d e r

t o ev a lu a t e t h e s y s t e m’s co mpl i an ce w i th i t s s p ec i f i ed r equ i r e men t s .

I t s g o a l i s t o v e r i f y t h a t t h e s y s te m me e t s t h e f u n c t i o n a l s p e c i f i c a t i o n

an d a l l t h e n on - f u nc t io n a l r eq u i r e me n t s .

A cc ep t an c e t e s t i n g i s f o rma l t e s t i n g w i t h r e s p e c t t o t h e u s e r n ee d s ,

r eq u i r e m en t s an d bu s in es s p r o ces s c on du c t ed t o de t e r m in e i f t h e sy s t e m

sa t i s f i e s a ccep tance c r i t e r i a and t o d ec id e whe t h e r o r no t t o a c cep t t he

sy s t e m. A ccep t an ce t e s t i n g i s co nd uc t ed e i t h e r by the en d -u s e r , o r t h e

cu s to mer , o r t h e c l i en t .

5

1.5 Regression Testing R eg r e s s i o n t e s t i n g i s t h e r e p e a t ed t e s t i n g o f an a l r ea dy t e s t ed p r o g r a m

a f t e r i t w a s mo d i f i ed . T he a i m b eh i n d r eg r e s s i on t e s t i ng i s t o d i s c ov e r

an y de f ec t s i n t ro d uc e d o r u n co v er ed a s a r e s u l t o f t h e c h a ng es . S u ch

t e s t i n g i s p e r fo r me d w hen th e s o f t w a re o r i t s env i r on men t h as ch an g ed .

R eg r e s s i o n t e s t i n g may be p e r f o r me d a t a l l t e s t l ev e l , an d app l i e s t o

f un c t ion a l , n o n - f u nc t io n a l a nd s t r u c tu r a l t e s t i n g . R eg r es s io n t e s t su i t e s

a r e ex ecu ted man y t i me s . D u e t o th i s r eas o n , r eg re s s i on t e s t i n g i s a

s t r on g c a nd id a t e f o r a u t o mat io n t e s t i n g .

1.6 Automated Testing Tools Tes t au to ma t io n i s t h e u s e o f s o f t ware t o co n t ro l t h e ex e cu t io n o f t e s t s .

A u to ma t e d t e s t i ng to o l s c a n en h a n c e t he t e s t i n g e f f o r t p r ov id ed t ha t

ex p ec t a t i o ns an d man ag ed t oo l i s s ue s a r e un d e r s to o d , an d a t o o l

co mp a t i b l e w i th t h e sy s t e m- en g i n e e r in g en v i r o n me n t i s s e l e c t e d [4 ] . I t

i s v e r y imp o r t a n t t ha t t h e to o l ma t c h e s th e t a sk a t h an d , a nd tha t t h e

t e s t s l end the ms e lv es t o au to ma t io n .

S o me t i me s i t i s d e t e r mi n e d t h a t n o to o l av a i l ab l e o n th e mar k e t

co mp le t e ly su i t e s t he p ro j ec t ’ s needs . I n such cas e , i t i s neces sa ry t o

d e c i d e w h e th e r t o d ev e lo p a u n i qu e s o l u t ion in t h e f o r m o f s c r ip t s o r

cu s to m to o l s , o r t o r e ly so l e ly o n man ua l t e s t i ng . I n o th e r cas es , t h e r e

may be c o mmer c i a l l y ava i l ab l e t oo l s t ha t wou ld work fo r t he t e s t i ng

e f f o r t , b u t o f f e r mor e f e a tu r es t h an th ey a r e n e ed ed [4 ] .

M an y s o f tw ar e t e s t au to mat io n t oo l s p r o v i de r e co r d an d p l a y b ack

f ea t u r e s t h a t a l l o w us e r s t o r e co r d in t e r ac t i ve l y u s e r a c t i on s an d r ep l ay

i t b a ck a n y n u mb e r o f t i me s co mp a r in g a c t u a l r e s u l t s t o t h o s e e x p e c t e d .

Tes t au to ma t ion i s expens iv e and i t i s an ad d i t i on , no t a r ep l acemen t t o

manu a l t e s t i n g .

6

1.7 Summary I n t h i s i n t r od u c to r y ch ap t e r , an ov e r v i ew o f t h e th eo ry beh in d s o f tw a r e

t e s t i n g i s g iv en . T he d i f f e r en t s o f tw ar e t e s t i n g me t h o d s , s t a t i c t e s t i n g

an d d y n ami c t e s t i ng a r e e xp la in e d . T he d i f f e r en t t e s t l e v e l s a n d

r eg r e s s i o n t e s t i n g a r e d i s cu s sed . A t t h e en d o f t h i s ch ap t e r a n d

o ve r v i ew o f au to mat e d t e s t i ng t oo l s i s g iv en .

7

Chapter 2 Testing Web Applications

Th e g o a l o f t e s t i n g I n t e r n e t -b as ed ap p l i ca t i on i s t h e s a me as t h a t o f

t e s t i n g t r ad i t i on a l app l i ca t i o ns . Th e ma i n a i m i s t o u nco v er e r r o r s i n

t h e ap p l i c a t ion be f o re d ep l oy in g i t t o t he in t e r n e t .

2.1 Overview

A Web- based ap p l i ca t i o n h as man y f a i l u r e po in t s t ha t s ho u l d b e

co n s id e re d du r i ng t e s t i n g . My er s [3 ] i d en t i f i e s a l i s t o f s o me o f t h e

ma i n ch a l l en g es a s s o c i a t ed w i t h t e s t i ng s u ch a pp l i c a t io ns . Th es e a r e :

• La rg e a nd v a r i e d u s e r b a s e . I n t e rn e t u se r s p o sse s s d i f f e r en t

s k i l l s e t s , e mplo y a va r i e ty o f b ro w s er s , and us e d i f f e r e n t

o p e r a t i n g s y s t e ms o r d ev i c e s . U s e r s a c ce s s t h e i n t e r n e t u s i n g a

w ide r an g e o f co nn e c t io n s pe ed s .

• Bu s in ess en v iro n men t . I f ope r a t i ng an e - co mmerce s i t e , i s s u es

s uch a s t ax ca l cu l a t io n , sh ip p in g co s t s , t r ack in g cu s to mer

p r o f i l e s , an d mo r e , sho u ld be con s id e red .

• Lo ca les . U s e r s may r e s i de in o t h e r co un t r i e s . I n s uch case

i n t e r na t io na l i s a t i o n i s s ues s u ch a s l an gu ag e t r ans l a t i o n , t i me

zo n e , and cu r r en cy co nv e r s i o n , s h ou ld b e co ns i de r ed .

8

• Tes t in g e n v iro n m en t s . T o p r o p e r ly t e s t a w e b ap p l i ca t io n , i t i s

r e qu i r ed to du p l i c a t e t h e p r o du c t i on en v i r o n me n t . T h i s me a n s

t ha t Web Se rve r s , App l i c a t i on Se rve r s , an d Da t abase Se rve r s t ha t

a r e i d en t i c a l t o t he p r od u c t i o n eq u i p me n t s ho u ld b e u s e d . F o r t he

mo s t a c c u r a t e t e s t i n g r e s u l t s , t h e ne t w or k in f r a s t r u c tu r e w i l l h ave

to b e du p l i c a t ed a s w e l l . Th i s i n c l ud es ro u t e r s , s w i t ch es , a nd

f i r ewa l l s .

• S ecu r i ty . S in ce t he w eb s i t e i s o p en to t h e w o r l d , i t s h ou ld b e

p r o t e c t e d f o r m h a ck e r s . H ac k e r s c an b r i n g t h e w eb s i t e t o a

g r in d ing h a l t w i th d en i a l - o f - s e rv i ce a t t a ck s o r e l s e r i p o f f t he

cu s t o me r s ’ c r e d i t c a r d i n f o r ma t i o n .

A n o t h e r ma j o r t e s t i n g ch a l l en g e i s t e s t i n g b r o w s e r co mp a t i b i l i t y .

T o d ay the r e a r e s e v e r a l d i f f e r en t w eb b r o w s er s o n th e mar k e t , an d e a ch

b eh av es d i f f e r en t l y . A l th ou gh s t a n d a r ds e x i s t f o r b row s e r o pe r a t io n ,

mos t v en d or s en h a nc e t h e i r b r ow s e r s t o t r y an d a t t r ac t a l o y a l u s e r ba s e

[3 ] . U n fo r tun a t e ly , t h i s caus es t h e b ro w s e r s t o o p e ra t e i n a n o n -

s t a n d a r d w ay .

A l t ho ug h many cha l l en g es e x i s t w h e n t e s t i n g W e b- b as ed ap p l i c a t io ns ,

o ne s ho u l d n a r ro w th e t e s t i ng e f fo r t s t o sp ec i f i c a r eas . M y er s [3 ]

i d en t i f i e s so me o f t he mo s t i mp o r t a n t t e s t i n g a r e as o f a W e b - b as e d

ap p l i ca t i o n . T h e l a t t e r d iv i d e s a W eb - b a s e d ap p l i c a t ion in t o th r e e

t i e r s :

1 . Presenta t ion La yer . The l ay e r o f an In t e r ne t ap p l i c a t i on t ha t

p rov ides t he g r aph ica l u se r i n t e r f ace .

2 . Bu s in ess Lo g i c La yer . Th e l ay e r t ha t mo d e l s t h e bu s in es s

p r oces s es su ch a s u s e r au th en t i c a t io n an d t r an s ac t i on s .

3 . D at a A cc es s L a ye r . T h e l ay e r t h a t h ou s e s da t a u s e d by the

ap p l i ca t i on o r t h a t i s co l l e c t ed f ro m th e en d u s e r .

9

2.1.1 Presentation Layer Testing T e s t in g t h e p r es en ta t io n l ay e r co n s i s t s o f f i n d i n g e r r o r s i n t h e g r a p h ic a l

u s e r i n t e r f ace o f t h e w eb ap p l i c a t i on . T h i s i mpo r t an t l a y e r p r ov id es t h e

cu r b app ea l o f t h e w eb s i t e , s o d e t e c t in g an d co r r ec t in g e r r o r s i n t h i s

l ay e r a r e c r i t i c a l t o p r e s en t in g a q u a l i t y , ro b us t w eb s i t e .

P r e s en t a t i on l ay e r t e s t i n g i s v e ry wor k in t en s iv e . H o weve r t h e w o rk

can be s eg men ted i n to t h r ee ma j o r a r ea s [ 3 ] :

1 . C on t en t t e s t i n g . Th e t e s t eng in ee r sh o u l d s ea r ch f o r e r r o r s i n t he

f o n t t y pe , s c r e e n l ay o u t , co l ou r s , g ra ph i cs r e s o lu t io ns , an d o th e r

f ea tu r e s t ha t d i r ec t l y a f f ec t t he en d - u s e r e xp e r i en c e . I n ad d i t i o n ,

t h e t e s t e r s ho u l d ch eck th e accu r acy o f t he in f o r ma t ion on t he

w eb s i t e .

2 . Web s i t e a r ch i t ec t u re . The webs i t e a r ch i t e c tu r e shou ld be t e s t ed

to f i nd n av ig a t io na l an d s t ru c t u r a l e r r o r s . Th e t e s t e r s h ou l d

s ea r ch f o r b r o ke n l i n k s , mi s s in g p ag es , w r o ng f i l e s , o r an y t h i ng

t h a t s en d s t h e u s e r t o t h e w r o n g a r e a o f t h e s i t e .

3 . U s er en v iro n men t . T he t e s t en g i ne e r s h ou ld t e s t f o r d i f f e r en t

w eb b r ow s e r s an d w eb b r o w s e r ’ s v e r s i on s an d o p e ra t in g s y s t e m

co nf ig u r a t i on s . U s e r env i ro n men t t e s t i n g b eco mes mo re co mp lex

when t h e web -app l i ca t i o n makes u se o f c l i en t - s id e s c r i p t i n g

an d /o r A p p le t s s i n c e ev e r y b ro w s er h as a d i f f e r en t s c r i p t i ng

en g in e o r v i r t u a l ma c h i ne to r u n s c r ip t s an d co d e on th e c l i e n t ’ s

mac h in e .

10

2.1.2 Business Layer Testing B us i n es s l ay e r t e s t i ng f oc us es on f in d in g e r r o r s i n t h e b us in es s l og i c o f

t h e w eb a pp l i c a t io n . T he r e a r e c e r t a in a r eas o f t he b u s i nes s l ay er t ha t

s h ou ld a l w ay s b e t e s t ed . T h es e a r ea s i nc lu de [3 ] :

1 . P e r f o rm a n ce . Te s t t o s e e w h e th e r t h e ap p l i c a t i on mee t s t h e

docu men t ed pe r fo r ma nce spec i f i c a t i ons . Thes e a r e gen e ra l l y

s pec i f i ed in r e s p o n s e t i mes a nd th r o u g hp u t r a t e s .

2 . D at a V a l i d i t y . T es t t o d e t e c t e r r o r s i n d a t a co l l e c t ed f r o m

cu s t o mer s .

3 . Tran s a c t i on s . Te s t t o u n c ov er e r r o r s i n t r an s ac t i on p r oces s in g ,

w h ich ma y in c l ud e i t e ms s u ch a s c re d i t c a r d p ro ces s i n g , e ma i l i ng

v e r i f i c a t i o n s , a n d c a l cu l a t i o n s a l e s t a x .

2.1.3 Data Layer Testing Tes t in g o f t h e da t a l ay e r co ns i s t s o f t e s t i n g th e d a t ab as e ma n a ge men t

sy s t e m th a t t h e w eb - ap p l i c a t i on u s es t o s to r e an d r e t r i ev e i n f o r ma t io n .

As w i th t he o the r t i e r s , t he r e a r e c e r t a in a r eas t ha t s h ou ld b e t ak en in t o

co n s i d e r a t i o n w h e n t e s t i n g t he d a t a l a y er . T h es e a r e [ 3 ] :

1 . R es p on s e T im e . S lo w web - app l i c a t i on s cau se un ha ppy use r s .

Th e re fo re , i t i s i mp o r t an t t h a t t h e t e s t eng in ee r mak es s u re t h a t

t h e w eb- ap p l i ca t i on r e sp on ds i n a t i me ly mann e r t o u s e r r eq ues t s

an d ac t i o ns . R es p o n s e T im e t e s t i n g i n t h i s l a y e r d oes no t i n c lu de

t i mi ng p a g e lo ad s , b u t f oc us e s o n id en t i f y i ng da t ab as e op e r a t i o n s

th a t d o no t me e t p e r f o r ma n c e o b j ec t i ves . W he n t e s t i n g th i s l a y e r ,

t h e t e s t e r s ho u ld e ns u r e t ha t i nd iv id ua l d a t ab a s e op e r a t i on s occ u r

qu ick ly so a s n o t t o bo t t l en e ck o th e r o pe r a t io n s .

2 . D at a I n t eg r i t y . D a t a I n t e g r i t y t e s t i ng i s t h e p r o c es s o f f i n d i ng

in accu r a t e d a t a i n y o u r da t ab as e t ab l e s . T h i s t e s t i s d i f f e r en t

11

f r o m d a t a v a l id a t io n . D a t a v a l i d a t io n t e s t i n g t r i e s t o f i n d e r r o r s i n

d a t a co l l e c t io n . D a t a i n t eg r i ty t e s t i n g s t r i v e s t o f i n d e r r o r s i n

h o w d a t a i s s t o r e d . T h e r e a r e ma n y f ac t o r s t h a t ma y a f f ec t h o t

t h e d a t a i s s t o r ed . F or exa mp l e t he d a t a t y p e an d l en g t h can

c au s e d a t a t r u n c a t io n o r l o s s o f p r ec i s io n . T he re a r e a l s o t i me

zo n e i s s u e s . F o r i n s t an c e s h o u ld t i me b e s to r ed b as ed o n th e

lo c a t i o n o f t h e c l i en t , t h e w e b s e rve r , t he app l i c a t i o n s e rve r , o r

t h e RD BM S? Th e t e s t e r s h ou ld a l so check fo r t he acc u racy o f t he

l o ok up / r e f e r enc e t ab l e s ( s uch a s t ax , t i me zo ne i n f o r ma t io n ,

e t c… ) u s ed b y th e w eb- ap p l i c a t io n .

3 . F a u l t t o l e r a n c e a nd r e co v e ra b i l i t y . I f t he w eb - ap p l i c a t i on r e l i e s

on an RD BMS, t hen t he sy s t e m mu s t s t ay up and r u nn in g . Th e re

i s v e ry l i t t l e , i f an y , t i me ava i l ab l e f o r d ow n t i me in t h i s s c en a r i o .

Th us , t h e t e s t en g in ee r sh o u l d t e s t t h e f au l t t o l e r an c e a nd

r ecov e r ab i l i t y o f t h e d a t a bas e s y s te m. O n e g oa l o f d a t ab as e

ope r a t i on s , i n gene ra l , i s t o ma x i mi s e MT BF an d mi n i mi se MTT R.

N o te t h a t t h es e v a lu es s h o u ld b e s pe c i f i ed i n t h e r e q u i r e me n t s

do cu men t a t io n o f t h e w eb- ap p l i ca t ion . T he t e s t e r ’ s g oa l w h en

t e s t i n g t h e d a t ab as e sy s t em r o b u s t n e s s i s t o t r y t o ex ceed t h e se

nu mb er s .

2.1.4 Web Application Test Automaton Requirements

I n o r d e r t o a s s u r e th e qu a l i t y o f a w eb app l i c a t io n i t i s r eq u i r ed t h a t a

nu mber o f t e s t c a se s a r e des i gn ed and execu t ed au to ma t i ca l ly and

r ep e a t e d l y to d e mon s t r a t e t h e r eq u i r ed w e b ap p l i ca t i o n ’ s c ap a b i l i t i e s

an d b eh a v io r s u n de r d i f f e r e n t c i r c u ms t an c es .

M i l l e r [2 9 ] i den t i f i e s t h e b as i c e l eme n t s t h a t a r e r eq u i r ed b y w eb

ap p l i ca t i o n t e s t i n g to o l s i n o r d e r t o a c h i e v e t h i s . A c c o r d in g to M i l l e r ,

12

ty p ica l e l e me n t s o f t e s t s s h o u ld in v o l v e t h e ch a ra c t e r i s t i c s ex p l a i n ed in

t h e f o l l o w in g l i s t :

• Bro ws e r I nd ep end en t . T e s t s s h o u ld b e r e a l i s t i c , b u t n o t

dep en d en t on a p a r t i c u l a r b r o w s er , w ho s e b i a s es a n d

ch a ra c t e r i s t i c s mi g h t ma sk a w e bs i t e ’ s p r o b l e ms .

• N o B u f f er in g , C a ch in g . Lo ca l bu f f e r in g and ca ch i ng – o f t en a

w ay to i mpr ov e a pp a r en t p e r f o r man ce – s h o u ld b e d i s ab l e d so t ha t

t i mes ex pe r i men t s a r e a t ru e mea s u re o f t h e B r o w s er - W e b -

Webs i t e - W eb -B r owser r e sp o ns e t i me .

• F o n t s a n d P re f e r e n c es . M os t b r ow s er s s up p or t a w id e r an ge o f

f o n t s an d p r e s en t a t i o n p r e f e r en c e s , and th es e s h o u ld no t a f f ec t

h o w q u a l i t y o n a w e b s i t e i s a s s e s s e d o r a s s u r ed .

• Ob jec t Mo d e . E d i t f i e l d s , p us h b u t ton s , r a d io b u t to ns , c h e c k

bo xes , e t c… A l l s h ou ld b e t r ea t ab l e i n o b je c t mo d e , t h a t i s ,

i n dep en d e n t o f t h e f o n t s an d p r e f e r e n c es .

O bje c t mo de o p e r a t i on i s e s s en t i a l t o p r o t ec t an i n v es t men t i n t e s t

s u i t e s an d to a s s u r e t h a t t e s t su i t e s co n t i nu e o p e r a t in g w h e n

w eb s i t e p ag e s e xp e r i en c e c h an g e . I n o t h e r w or ds , w he n b u t t o n s

an d f o r m en t r i e s ch ang e l o c a t io n o n th e s c r een , t h e t e s t s s h o u ld

s t i l l w o r k .

• Ta b les a nd Fo rms . Ev en w h en th e l ay ou t o f a t ab l e o r fo r m

va r i e s i n t he b r o w s er ’ s v i e w , t e s t o f i t s h ou l d c on t in u e

in dep en d e n t o f t h e s e f a c to r s .

• Fram es . W in do w s w i t h mu l t ip l e f r a me s sh o u ld b e p r o c e s sed a s i f

t h ey w er e mu l t i p l e s in g l e -p ag e f r a me s .

13

2.1.5 Conclusions I t i s con c l ud ed t h a t t h e r e a r e ba s i ca l ly th ree ma i n a r eas o f t e s t i ng a s

r eg a r ds t o w eb a p p l i c a t io n s . T h es e a r e :

1 . C on t en t T es t in g . T e s t in g o f t he v i s ib l e p a r t o f t h e w e b s i t e ,

i n c lu d i n g t e s t i n g to v e r i f y t h a t t h e w eb p ag es a r e r e n d e r ed th e

s a me o n t h e v a r io u s av a i l a b l e w e b b r o ws e r s .

2 . S ecu r i ty Tes t in g . Tes t in g f o r s ecu r i ty i s su es w i t h in th e w eb

ap p l i ca t i on .

3 . Fu n ct iona l T es t i n g . T es t i ng f o r t h e f u n c t io n a l i t y ( Bu s in e s s

Log ic ) o f t he app l i ca t i on .

S u ch t e s t s can b e au t o ma t ed . I n t h e n ex t s ec t io n o f t h i s ch ap t e r s o me

t e s t i n g to o l s t h a t a r e s pe c i f i c a l ly d es ig ned to t e s t w eb ap p l i ca t i o ns a r e

an d s o me i f t he ma i n w eb a pp l i c a t io n t e s t i n g g u id e l i n es a r e d i s c u s s ed .

2.2 Web Application Testing Tools T h e r e i s a l a r g e n u mb er o f W e b A pp l i c a t io n t e s t i n g to o l s . T h e So f twa re

Q A / T es t R e s ou r c e C en t r e [ 5 ] i d en t i f i e s mo re th an 3 7 0 o f s u ch too l s .

D i f f e r en t t oo l s c an be u s ed fo r d i f f e r en t pu r po s es a n d fo r d i f f e r en t

t e ch no lo g ie s .

S o me o f t h e s e to o l s a r e d i s c u s s ed i n t h i s s e c t io n . T h e d i s cu s s e d to o l s

a r e c a t eg o r i s ed i n t h r ee ca t ego r i e s a s d i s cus s ed i n S e c t io n 2 .1 .5 of t h i s

ch ap t e r .

14

2.2.1 Content Testing Tools Th e W3 C Co nso r t i u m [3 0 ] h as dev i sed a n u mber o f gu id e l in es an d f r ee

o n l in e t o o l s a s r eg a r ds to t h e co n t e n t o f w eb p ag es . S u ch too l s i n c lu d e :

• Ma rku p V a l id a t or . Th i s t o o l i s u sed to ch e ck fo r t he mar k u p

va l id i ty o f w eb do cu men t s w r i t t en i n H TM L, X HT M L, S M I L , and

mo r e [32 ] . Th i s t oo l i s a l s o u s ed to ch eck i f t h e w eb ap p l i ca t i on

i s ‘ a c ces s ib l e t o a w id e r r an g e o f p eo p l e w i th d i s ab i l i t i e s ,

i n c lu d i ng b l in dn es s a nd lo w v i s io n , d e a f n es s a nd h e a r in g lo s s ,

l e a r n in g d i s ab i l i t i e s , co g n i t i v e l i m i t a t io n s , l i mi t ed mo v e me n t ,

s pee ch d i f f i cu l t i e s , p ho to s en s i t i v i ty a nd c o mb in a t i o n s o f t h e s e ’

[3 2 ] . Th i s t oo l can be acces sed o n l i n e t h r o u g h t he fo l l owing

U RL : h t t p : / / v a l i d a t o r . w 3 . o r g /

• Link Ch ecke r . Th i s t oo l i s u s ed t o ch eck hy pe r l i nk s . I t i s v e ry

u s e f u l t o f i n d d a n g l in g l i nk s an d mo r e [3 3 ] . T h i s t oo l c an be

a cc e s s ed o n l i n e f r o m: h t tp : / / v a l id a to r . w 3 . o r g / ch eck l in k

• C SS V al id a t or . T h is t o o l i s u s e d to ch e c k an d v a l i d a t e C S S

d e f i n i t i o n s [3 4 ] . I t c an b e a c c e s s ed o n l i n e f r o m :

h t t p : / / j i g s aw . w 3 . o rg / c s s - va l id a to r /

2.2.2 Security Testing Tools Wi th t h e po p u l a r i t y o f th e i n t e r ne t and w eb ap p l i c a t ion s a lw ay s

i n c r eas i n g , a t t a c k e r s a n d ma l i c i o u s w eb us e r s a r e a l s o en han c i n g th e i r

t e chn iques t o a t t a ck su ch app l i c a t i o n s . I t i s t h e r e f o r e i mp o r t an t f o r

w eb ap p l i c a t i on d ev e lo p e r s t e s t en g in e e r s t o ke e p u p - to - d a t e w i t h t h e

l a t e s t s e cu r i t y t o o l s an d p r od uc t s t h a t c an he lp i n k eep in g a w eb

ap p l i ca t i o n s ecu r e f o r m s u ch v u ln e r ab i l i t y a t t a ck s .

15

Th er e a r e a l o t o f co mmerc i a l t o o l s t ha t c an b e u s ed ch eck w eb

ap p l i ca t i o n s a g a i n s t s ecu r i ty t h r ea t s . T he p i on ee r s i n t h i s a r ea a r e

Acun e t i x [ 35 ] , Se cu r i t y I nn o va t io n [3 6 ] an d Sp yD yn a m i cs [ 3 7 ] . S u ch

co mp an ie s p r ov id es v a r io us s t a t i c an d dy n ami c to o l s t h a t ch eck s w eb

ap p l i ca t i o n s f o r t h r ea t s s u ch a s In j ec t i o n F l aws , C r o s s S i t e S c r ip t in g ,

I n s ecur e Com m u ni ca t io ns and mo re .

D u e to t h e i mp o r t a n c e o f s ec u r i ty t e s t i ng i n w eb a pp l i c a t io ns , a n o n -

p r o f i t o r g an i s a t io n na med O W AS P ( O pen Web A p p l i ca t i on S ecu r i t y

P r o j ec t ) [ 3 8 ] h as b een s e t u p i n o r d e r t o pe r f o r m r es e a r ch an d k eep u p -

to - da t e w i th th e w eb s ecu r i t y i s su es .

T h e O W A S P o r g an i s a t i on i s mos t r en ow n ed f o r t h e O WASP T o p T en

Pro j ec t [3 9 ] . T h i s i s a g u i d e l in e f o r deve l o p e r s a nd t e s t e r s

h ig h l i gh t in g th e t o p t en m a l i c io us w eb ap p l i c a t io ns a t t ack s a n d h ow to

p r even t t he m. Th i s gu id e l i ne a l s o s ug ges t s t h e d i f f e r en t t oo l s t o u se in

o rd e r t o t e s t f o r s u ch a t t a c k s .

2.2.3 Functional Testing Tools

Th e r e a r e lo ad s o f w eb ap p l i c a t io n t e s t i ng to o l s t h a t a r e u s ed t o t e s t t h e

f un c t ion a l i t y an d th e bu s in es s l o g i c o f t he a p p l i c a t io n . A n umb e r o f

t h e s e t o o l s p r ov id e cap tu re /p l ay b ack w h i l s t o the r s c an on ly be u s ed

p r o g r a mmat i c a l ly . S o me o f t he s e t o o l s a r e ex p la in ed b e l ow .

• C ac t u s . C a c t us i s a s i mp l e f r a mew o rk f o r u n i t t e s t i n g s e r ve r - s i de

j av a cod e s u ch a s Serv l e t s , E JBs , T ag L ib s , an d mo r e . T h i s t o o l

i s an ex t ens io n o f t h e J av a A PI JU n i t [6 ] . Ca c tu s i s an op en

sou rce Jaka r ta p ro j ec t and i t c an be down loa ded f r ee o f ch a r ge

f r o m h t tp : / / j ak a r t a . ap ach e . o r g / c ac t u s / .

16

• Form Flo od . Th is i s a u t i l i t y p r og r a m th a t wi l l pu t a l o t o f

p l a u s ib l e d a t a i n t o w eb s i t e f o r m s [7 ] . F o r mF l ood i s a t oo l t o t e s t

w eb fo r ms to mak e s u re th ey can h an d l e a l o ad , t h a t a l l o f t h e

l i n k s w o r k , an d th a t a l l o f t h e f o r ms s u b mi t co r r ec t l y [ 7 ] . T h i s i s

an o th e r o pe n s ou r c e p r o j e c t a nd i t c an be down load ed f rom

h t tp : / / f o r mf l o od . s o u r ce f o r g e . n e t / .

• HT MLU ni t . H T ML U n i t i s a ‘ b ro w ser f o r J av a P ro g r ams ’ [8 ] . I t

mo de l s H TM L d o cu men t s an d p r ov id es an A P I th a t a l l o w s th e t e s t

en g in e e r t o i nv o k e pages , f i l l o u t H TM L f o rms , c l i ck l i nk s a n d

mo r e . HT M LU ni t i s n o t a g en e r i c t e s t i n g f r a me w or k . I t i s

s pec i f i c a l ly a w ay t o s i mu l a t e a b r ow s er f o r t e s t i ng pu r p o se s a n d

i s i n t e n d ed t o b e u s ed w i t h an o t h e r t e s t i n g f r a mew o rk s u ch a s

JU n i t [8 ] . Th i s i s an op en s o u r ce p ro j ec t and i t c an be

do w nload ed f r o m h t tp : / / h t ml u n i t . sou r ce fo rge . ne t / .

• HT T PUni t . H T T P U n i t i s a t e s t i n g to o l w r i t t en in J av a t h a t

e mu l a t e s t h e r e l e van t po r t i o ns o f b r o wse r beh av io u r , i n c lu d i ng

fo r m sub mi ss ion , J avaS cr i p t , b as i c h t t p au th en t i ca t i o n , coo k i e s

an d au to ma t i c p ag e r ed i r e c t io n , a n d a l l o w s j a v a t e s t c o d e t o

ex a mi n e r e tu r ned p ag es [9 ] . P r e f e r a b l y th i s t o o l s ho u ld be u s e d

in co n ju n c t ion w i th JU n i t . T h i s i s a f r e e t o o l a n d can b e

do w nload ed f r o m h t tp : / / w w w. h t tp un i t . o rg / .

• A p a ch e J M et e r . Th i s t oo l may b e us ed to t e s t p e r fo r man ce on

bo th s t a t i c a nd d y na mi c w e b a pp l i c a t i ons . Apache JM et e r c an be

us ed to s i mu l a t e a h eav y lo ad o n a s e r v e r , ne tw or k o r o b j ec t t o

t e s t i t s s t r eng th o r t o an a ly s e ov e r a l l p e r fo r man ce u nd e r d i f f e r en t

l o ad ty pes [ 10 ] . T h i s i s a no th e r o p e n s ou r c e J a k a r t a p r o j e c t t h a t

i s a v a i l ab l e f r o m h t t p : / / j ak a r t a . ap ach e . o r g / j me te r / .

• Ma x Q . ‘ M ax Q i s a w e b f u nc t io n a l t e s t i n g to o l ’ [1 1 ] . I t r e co rds

t h e ac t io ns do n e b e t h e u s e r an d tu r ns t he m i n t o a Py th on s c r i p t .

17

Th e s c r ip t c an t hen be p l ay b ack ed [ 11 ] . Th i s i s a f r e e t oo l t h a t

c an b e d o w n l o a d e d f r o m h t t p : / / max q . t i g r i s . o r g / .

• WA P T. WAP T i s a l o ad an d s t r e s s t e s t i n g t o o l t h a t p ro v ides an

e asy - to - us e w a y o f t e s t i n g w eb s i t e s , w eb s e r ve r s , a nd in t r a ne t

ap p l i ca t i on s w i t h w eb i n t e r f a c es [1 2 ] . T h i s i s a c o m m er c i a l t o o l

de s ign ed f o r Mic r oso f t Wind ow s an d i t c an b e pu rc hased f r o m

h t tp : / /w w w . l oa d t e s t in g t oo l . c o m/ .

• S e len i u m. S e l e n i u m i s a so f tw ar e t e s t i ng f r a mew o rk in w h i c h

t e s t s c an b e w r i t t en a s H T M L tab le s o r c o d ed in a n u mb e r o f

po pu la r p r og r a mmi ng l an gu ag es and c an b e r u n d i r ec t l y i n mo s t

mo de rn w eb b r ow se r s . S e l e n iu m can be u s ed on W in do w s , L in u x ,

an d Ma c in to s h [1 3 ] . Th i s i s on open so u rce t o o l t h a t c an be

do w nload ed f r o m h t tp : / / s e l en iu m. op en qa .o rg / .

• iMa cro s . i M acr o s i s a t e s t i n g to o l t h a t c an b e u se d to p e r f o r m i n -

b r ow s e r f u n c t io n a l , p e r f o rman ce , a nd r eg r e s s i on t e s t i n g o f w eb

ap p l i ca t i on s . T h i s i s a co mmer c i a l t oo l a nd i t c a n b e d o w n lo ad ed

f r o m h t t p : / / w w w . io p u s . c o m/ i ma cr o s /w e b - t e s t i n g . h t m. iM a c r o s

c l a i ms t h a t i s ‘ t h e on ly s o l u t i on th a t ca n t e s t F l a s h , F l e x ,

S i lv e r l i g h t , A c t iv e X an d J a v a A p p le t s i n s id e t h e b r o w s e r ’ [14 ] .

iM a cr o s mak es u s e o f i ma g e r ec o g n i t i o n t o i d e n t i f y d i f f e r en t

med i a componen t s ( such a s bu t t ons , l i nk s , f o r m f i e ld s , e t c… ) .

N o te t h a t t h i s t o o l i s p l a t fo r m dep en d en t s i n c e i t w o rk s on ly o n

M ic r os o f t W ind o w s .

A l t h o u g h a l l o f t h e a b o v e f un c t i o n a l t e s t i n g t o o l s h av e t h e i r o w n p r o s

an d con s , i n my o p in io n S e l en ium i s t h e b es t t o o l t o u s e f o r t h e t e s t i ng

o f t he b u s in es s l o g ic o f w e b ap p l i ca t ion s . T h e f o l lo w i ng mo r e i n - d ep t h

d es c r ip t i o n o f S e l en iu m e x p la i n s w h y I t h in k th a t S e l en iu m i s t h e b e s t

t o o l t o u s e .

18

S e l en iu m ex e cu tes t h e t e s t s d i r ec t l y i n a n a c t u a l w eb b r o w s e r .

Th i s t o o l i s p l a t f o r m in de pen d en t s in ce i t i s co mp a t ib l e w i t h

I n t e r n e t E xp lo r e r , M o z i l l a an d F i r e f o x o n W i nd ow s , L in ux a nd

M ac in to s h , and i t i s a l s o co mp a t i b l e w i t h s a f a r i o n th e M ac .

S e l en iu m has tw o mo d es o f o p e r a t io n :

1 . C o re . Se l en iu m Core i s w r i t t en i n J av a Sc r i p t / D H TM L.

Th es e t e chn o log i e s a r e u s ed to e mb ed a t e s t au to ma t i o n

en g in e in t h e b r o w s er . N o te th a t t h e w e b b r ow s er s h ou ld b e

J av aS c r ip t en ab l ed f o r S e l en i um Co r e t o b e e f f ec t iv e .

2 . R em o t e C o n t r o l ( RC ) . S e l en iu m R em o t e C on t r o l i s a t o o l

t h a t a l l o w s a t e s t e r t o w r i t e au t o ma t ed w eb a pp l i c a t io n u s e r

i n t e r f a ce t e s t s i n an y p r og r a mmi n g l an g u ag e ag a in s t a n y

H T T P w eb s i t e u s i n g an y Jav aS cr ip t en ab l ed w eb b r o w s e r .

S e l e n iu m R C co mes in two pa r t s :

I . A s e rv e r w h ich can au to ma t i ca l l y l au nch an d k i l l

su p po r t ed b r o w se r s , a nd a c t a s an H T T P p r oxy f o r w eb

r eq u es t s f r o m th es e b r o w s er s .

I I . Cl i en t l i b r a r i e s f o r t h e t e s t e r s ’ p r e f e r r ed p r og ra mmi ng

l an gu ag e .

A pa r t f ro m S e len iu m C or e a n d S e l en ium R C , t h e re i s a l s o a

F i r e fox ex t ens ion fo r S e l en iu m ca l l ed S e l e n i u m ID E . T h i s p lu g - i n

a l l o w s a t e s t e r t o r eco r d , ed i t , and d ep lo y t e s t s . By u s in g th i s

p l ug - i n , t h e t e s t e r c an ch oo s e to e i t h e r u s e i t s r e co r d i ng

c ap ab i l i t y o r e l s e t h e t e s t e r may e d i t t h e t e s t s c r ip t s by h an d .

(No te : A l l i n f o r ma t ion i s t a ken f r o m [13 ] ) .

19

2.2.4 Conclusions

A l t ho ug h as I s a id S e l en i u m i s i n my o p i n i o n th e b e s t w eb - ap p l i c a t i on

t e s t i n g t o o l t o u s e , i t s t i l l n eg l e c t s an i mp o r t a n t f e a t u r e . S e l en i u m i s

n o t c a p a b le o f t e s t i n g J av a A p p l e t s .

A cco r d i n g to my r e s ea rch , t h e on ly w eb- ap p l i c a t i on t e s t i ng to o l t h a t

c a n b e u s ed t o t e s t J ava A p p le t s i n t h e i r ac t u a l w o r k i n g en v i r o n me n t i s

t h e iM a c r o s [1 4 ] t o o l t h a t i s d ev e l o ped by iO p us ™ [1 5 ] . H ow e ve r ,

u n l ik e S e l en i u m, t h i s t o o l i s no t d i s t r i b u t ed f r e e o f c h a r ge . A no th e r

d r a w b ac k i s t h a t i Ma cr o s i s a p l a t fo rm d ep end en t t oo l s i nc e i t c a n on ly

b e u sed w i th I n t e rn e t Ex p l o r e r and F i r e f o x on Mic r os o f t Wind o ws o n ly .

2.3 Summary I n t h i s c h ap t e r , t h e t e s t i n g o f w eb a p p l i c a t i o n s w a s ex p l a in ed in s o me

d e t a i l . D i f f e r e n t k i n d s o f t e s t i n g t o o l s w er e a n a ly s e d and c r i t i c i s e d .

F r o m th i s ch ap t e r , i t i s co n c lu d e d t h a t a l t h o u g h th e r e a r e ma n y to o l s

t ha t a r e u sed t o t e s t web app l i c a t i ons , t h e re i s n ’ t a t o o l t h a t i s t a i l o r

mad e s p e c i f i c a l ly t o t e s t J a v a A p p l e t s . W i t h th e cu r r en t t o o l s J a v a

A p p l e t s can on ly b e t e s t ed e i t h e r b y u s in g S w in g t e s t i n g to o l s ( To o l s

t h a t t r e a t s a J av a A p p l e t a s a J av a A p p l i ca t i o n ) o r e l s e by us ing to o l s

t h a t ma k e s u se o f i ma g e p r o c e s s i ng .

20

Chapter 3 A Test Automation Tool for Java Applets A s d es c r ib ed in t h e p r e v i ou s ch ap te r , a l t h o ug h t he r e a r e a l o t o f t o o l s

t h a t c a n b e u s ed t o t e s t W e b A pp l i c a t io n s , t h e r e i s n o t a t oo l av a i l a b l e

t h a t c an b e u s ed t o t e s t J ava A pp le t s i n w eb b r o w s e r s an d t h a t i s

b r o w s e r a nd p l a t f o r m i nd ep en d en t .

T h e a i m o f t h i s d i s s e r t a t i on i s t o d ev e lo p a b r ow s er a nd p l a t f o r m

in d ep e n d en t t o o l t h a t i s a b l e t o t e s t J a v a A p p l e t s i n t h e i r a c t u a l

en v i r on men t s . W e a re g o in g to ca l l t h i s t o o l TATJA , s ho r t f o r A Te s t

Au to ma t i o n To o l f o r J ava A p p l e t s . N a tu r a l ly , t h i s t o o l s h o u l d b e

d ev e lo p e d u s in g J a v a a s i mp le me n t a t i on l ang u a g e . T he r e a s on s f o r t h i s

b e in g th a t :

1 . Java i s a p l a t f o r m in dep en d en t l ang u ag e , an d

2 . S ince A p p le t s a r e i mp l e me n ted u s in g Java , i t i s mu ch ea s i e r t o

acces s t h e co mp on en t s o f t h e Ap p le t w i th t h e s a me l an gu ag e t ha t

i mp le men t s t h e m.

3.1 Java Applets Overview A n A p p le t i s a s o f t w ar e co mp o ne n t t ha t r un s i n t he c o n t ex t o f ano th e r

p ro g ra m. A J ava A pp le t i s an A pp le t t h a t i s wr i t t en in t h e J av a

p r o g r a mmi n g l an g u ag e in o r d e r t o b e ex e c u t e d i n a w eb b r ow s e r .

A p p l e t s c an b e i n c lud ed i n an H TM L p ag e mu ch i n th e s a me w ay th a t an

i mag e i s i nc lud ed i n a p ag e .

21

A p p l e t s a r e u s ed t o p r o v id e i n t e r a c t i ve f e a t u r e s t o w e b ap p l i c a t i o n s t h a t

c a nn o t b e p r o v i ded by H T ML. A l th o ug h w i th th e in t r o d uc t io n o f A JA X

th e p o pu l a r i ty o f A p p le t s h as d ec r ea sed , J av a A p p l e t s a r e s t i l l b e i ng

u s ed in c r i t i c a l p a r t s o f w eb ap p l i c a t io ns , s u ch a s F T P c l i en t s ,

d ow n lo ad /u p lo ad man ag e r s , a nd mor e .

S in ce J av a A pp l e t s a r e d e l i v e r e d in t h e f o r m o f J av a by te co d e , J av a

A p p l e t s c an b e ex e c u t e d b y b r ow s er s o n d i f f e r en t p l a t f o r ms i n c lu d in g

W i nd o w s , L in u x , M a c O S , U N I X a nd mo r e . T he by te co d e o f t he

A p p l e t i s do w nl oaded f r o m a w eb se rv e r . Th e b r ow se r e i t h e r e mb ed s

t h e A p p l e t i n to a w eb p ag e o r e l s e op en s a ne w w i nd ow o r t ab sh ow in g

t he App l e t ’ s u se r i n t e r f a ce . Due t o t he f ac t t h a t J av a App le t s can hav e

ma l i c i ou s co d e , man y w eb b r o w s e r s e xe cu t e t h e m in a s and b ox . A

s an d bo x i s a s e cu r i t y me c ha n i s m f o r s a f e ly r un n i ng p r og r a ms .

D u r i ng th e d ev e l o p men t p ro ces s , J av a A p p l e t s a r e t e s t ed u s i ng S u n’ s

App le tV i ewer . Th i s i s a s t and a lo ne t oo l f o r t e s t i n g J ava A p p le t s .

A l t ho ug h th e A p p le t may b e w or k i ng co r r e c t l y on the A pp l e t V i ew er ,

many t i mes a n u m be r o f b ug s an d de f e c t s a r e v i s ib l e w h en th e A p p l e t i s

ex ecu t e d in i t s a c t u a l en v i r o n me n t , i . e . i n w eb b r o w s e r s .

D es p i t e t h e po pu la r i t y o f J av a App le t s , t he r e a r e n o t a n y to o l s

s p ec i a l i s ed f o r t e s t i ng J av a A p p le t s i n w eb b r ow s e r s . J av a A pp le t s c a n

e i th e r be t e s t ed us i ng to o l s t h a t a r e u s ed to t e s t Ja va S w i n g

A p p l i ca t i o n s or e l s e by u s ing g en e r i c t o o l s t h a t c an a l s o be u s e d to t e s t

o th e r t y pe o f med ia f i l e s s u ch a s Fl ash , Shockwa ve an d Ac t i veX . T h e

d i s ad v a n t ag e o f u s i ng t h e f o r me r i s t ha t i n s uch t e s t i n g to o l s , a J av a

A p p l e t i s t r ea t ed a s a con ve n t i on a l ap p l i c a t i o n r a th e r t h an a s an A p p l e t .

I f u s ing th e l a t t e r , a l t ho u g h A p p le t s a r e t e s t ed i n w e b b r ow s er s , s u ch

t oo l s a r e b rowser spec i f i c an d s i nce t h ey a re no t J av a spec i f i c , t h ey

mak e s u s e o f i ma ge p r oc e s s ing in o r d e r t o i d en t i f y d i f f e r en t med i a

co mp o n e n t s . S uc h to o l s a l s o mak e u s e o f t h i r d pa r ty s c r i p t i ng

22

l ang u a g e s , t h e r e f o r e i n o r de r t o u s e th e m th e s o f tw a r e t e s t e ng i n e e r h as

t o l e a r n n ew sy n tax .

3.2 TAJTA Overview F ig u r e 1 i l l u s t r a t e s a U s e Ca s e D ia gr a m of t he p r op osed sy s t e m.

T A T J A sho u ld b e a r e co r d /p l ay b ack t e s t i ng to o l . A s d i s cu s s ed in

Chap t e r 2 , such t o o l s a l l ows a T es t En g in e e r t o f i r s t r e co r d T es t C a s es

by mi mi ck in g th e u s e r a c t i o n s , an d then t h e r eco rded t e s t c a ses can b e

p l ay b ack ed fo r a n u mb er o f t i mes to t e s t t he s y s t e m.

Figure 1: Use Case Diagram

23

T h e p r o po s ed too l s ho u ld b e ab l e t o b e ex ecu ted on a ny w eb b ro w s er

an d on any o pe ra t in g sy s t em. A s i t i s c l ea r l y i l l u s t r a t ed in F i gu re 1 ,

t h e t e s t e n g i n e e r s h o u ld f i r s t l o a d t h e A p p l e t t o b e t e s t ed i n t he t o o l .

T h e p r o p o s ed sy s t e m i s go i n g to b e op e r a t e d in t w o mo des :

1 . Re cor d in g M od e

2 . P lay back M o de

D u r i ng t h e r e co r d i n g mo d e , t he u s e r o f t he t oo l s h o u ld b e ab le t o r e co r d

t e s t c a s es . T h e t e s t c a s es g e n e r a t ed by T A T JA s ho u l d b e w r i t t en u s i n g

th e J av a L an gu ag e . By u s in g J av a a s t h e l a n g ua g e f o r t he t e s t c a s e s

( I n s t ea d o f u s in g a no th e r t h i r d p a r ty s c r ip t in g l a n g ua g e ) , t he t e s t

en g in e e r s a r e g o in g t o b e a b l e t o c h a ng e , ed i t , o r en h a n c e th e t e s t c a s e s

w i t ho u t t h e n e ed o f l e a r n in g new sy n t ax .

A s s h own in F ig u r e 1 , t he r eco rd in g p ro ces s co ns i s t s o f f i r s t l o ad i n g

th e A p p l e t t o b e t e s t ed w i th in TA T J A . T hen th e u s e r s h o u ld c r ea t e

( T h r o ug h th e u s e o f t h e to o l ) o r mak e u s e o f a t e s t c l a s s i n o r d e r t o

co d e t h e r eco r ded t e s t ca s e s . I n TA T JA i t i s go in g to b e a s s u med t h a t

o n e t e s t c a s e i s e q u iv a l en t t o o n e J av a me t h o d w i t h i n a p a r t i cu l a r t e s t

c l a s s . The u s e r c an c r ea t e a nu mber o f d i f f e r en t t e s t me th ods and

th r ou gh t h e u s e o f t h e to o l , t h e u s e r sh o u l d b e ab le t o r e co r d th e s e t e s t

c a ses .

S in ce t h e r eco r ded t e s t c a s e s a r e g o in g to b e w r i t t en co mp l e t e ly i n

J av a , t h e t e s t en g in e e r c a n pe r f o r m ch an g e s o r e nh a n c e th e t e s t c a s es

an d c a n a l s o mak e us ed o f ex i s t en t J av a c l a s s es , l i b r a r i e s an d he lp e r s .

F ig u r e 2 i l l u s t r a t e s a n a c t iv i ty d i ag r a m o f t he r e co r d in g p r o ces s .

24

Figure 2: Recording process Activity Diagram

Du r ing t he p l ay back mo d e , t he r eco rded t e s t c a s es a r e p l ay backed so

th a t t h e t e s t eng in ee r can ana ly se t he p e r fo r man ce o f t h e A pp le t . A s

i l l u s t r a t e d in F ig u r e 1 , t h e p l ay b ac k p r oces s co n s i s t s o f f i r s t l oa d i ng

th e A pp l e t t o b e t e s t ed in t h e too l . The u se r shou ld be ab l e t o l o a d a

p a r t i cu l a r t e s t c l a s s t h a t h a s i n i t t h e d e s i r ed r eco r d ed t e s t c a s e s . Th e

u s e r c an th en p l ay b ack th e t e s t ca s es i n o r d e r t o o b t a in t he r e s u l t s .

F ig u re 3 i l l u s t r a t e s an ac t iv i ty d i ag ra m o f t he p l ay back p ro ces s .

Figure 3: Playback process Activity Diagram

25

N o te th a t t h e p l a y b a ck p r oc es s e xp l a i n ed ab o v e r eq u i r e s t h e u se r t o

l o ad th e J av a A p p l e t t o b e t e s t ed in t h e A p p l e t t e s t i ng to o l . S i nce in

t h e ma j o r i ty o f cas es T A T J A i s g o in g to b e u s ed t og e th e r w i t h o th e r

w eb - app l i c a t i o n t e s t i n g to o l s s u ch a s Se len iu m , TA T J A s h o u ld h ave th e

c a p a b i l i t y o f ex e cu t i n g t h e T A T J A t e s t c a s es w i t h o u t t h e n e ed o f

manu a l l y l o ad ing t he A p p l e t t e s t i ng t oo l .

Th e s o lu t io n f o r t h i s p ro b l em i s t o a l l o w th e u s e r t o c r ea t e a t e s t s u i t e .

A t e s t s u i t e i s on e s in g l e J a v a me th o d th a t co n ta in s c o d e t h a t i n v o ke s a

n u mbe r o f r ec o r d e d t e s t c a s es . A s i t i s c l e a r ly s h own i n F ig u r e 1 , a

u s e r s ho u ld be ab l e t o c r ea t e t e s t s u i t e . C rea t in g a t e s t s u i t e i n c lu d es

t h e c r ea t i on o f an H T ML d o cu men t i n o r de r t o e mb ed the A p p l e t t o be

t e s t ed w i t h i n the g en e r a t ed T es t S u i t e . I n o rd e r t o e xe cu t e t h i s T e s t

S u i t e , t h e u s e r h as t o p r o g r a mma t i c a l l y ( T h r o ug h t he u s e o f a t a i l o r

mad e A P I ) l oa ds th e g en e r a t ed H T M L d oc u men t i n a ny w eb b r ows er a nd

th e t e s t c a s es a r e p l ay b ack ed au t o ma t i ca l ly .

3.3 User action Capture and Generation A t t h i s s t ag e o f t h e p r o j e c t t h e f u n c t i o n a l i t y o f t h e p r o j e c t i s d e f in e d .

T h e n e x t s t ep i s t o d e c id e a b o u t h o w t o i mp l e me n t i t a n d th e t e ch n iq u es

t o u se . Bas i c a l l y t he r e a r e two way s o f how to cap tu r e and t hen

g en e r a t e u s e r a c t io n s o f d i f f e r en t A p p l e t ’ s c o mp o ne n t s i n a w eb

b r o w s er . T he r e tw o w ay s a r e :

1 . M ak ing u s e o f t h e J a v a R o b o t C l a s s i n o r d e r t o co n t r o l t h e mo u s e

an d k ey boa rd a c t i o n s .

2 . W r app in g t he A p p l e t t o be t e s t ed w i th in a no th e r A p p le t a n d

p r og r a mmat i c a l l y gen e ra t e t h e r equ i r ed mo use a nd key boa rd

ev en t s .

Th i s s ub s ec t io n d i s cus s es an d co mp are s th e ab ov e t w o o p t i o n s an d

co n c lu d e s w h ich o p t io n i s t he mos t l i k e ly t o be t h e b es t s o lu t io n .

26

3.3.1 Using the Java Robot Class The Ja va Ro bo t C l as s i s a J av a n a t i v e c l a s s t h a t i s u s ed ma in ly t o

g en e ra t e n a t iv e sy s t e m in pu t ev en t s f o r t h e p u r po s e o f t e s t au to ma t io n ,

s e l f r u n n in g d e mo s , a nd o t h e r a pp l i c a t io ns w h ere c on t r o l o f mo u se a n d

k ey bo ar d a r e n e ed ed . N o te t ha t u s in g th e R o b o t C l as s i s d i f f e r en t f r o m

p os t ing ev en t s t o t h e A WT ev en t q u eu e o r Sw i ng co mp on en t s bec au s e

th e ev en t s a r e g en e r a t ed i n t h e p l a t f o r m’ s na t i v e inp u t q u eu e . [ 2 7 ]

I n o r de r t o ma l e u s e o f t h e Ro b o t c l a s s , abs o l u t e s c ree n po s i t i o n s o f t h e

A p p l e t ’ s co mp o n e n t s a r e r eq u i r ed s i nc e man y o f t he me tho d s o f t h e

Rob o t c l a s s a r e o f a t y pe w h ere t h ey r eq u i r e s p a r a me t e r s s u ch a s t h e

s c r een coo rd ina t e s and t hey p l ace t he mo u s e po in t e r i n t h a t de f in ed

p os i t i o n . A l tho u g h i t mi g h t a t f i r s t s ee m t h a t by u s ing t h i s c l a s s t h i ng s

a r e g o ing to b e e a sy an d s t r a ig h t f o r w a r d , i t i s n o t t h e c a se . S i nce

many o f t he me th o d s o f t h e Ro b o t c l a s s r e q u i r e t h e ab so lu t e s c r e e n

p os i t i o ns , i t i s r equ i r ed to d ev e lo p a mech an i s m t h a t can co nv e r t

r e l a t i v e c o mpo ne n t s c r e en p o s i t i o n s i n to a bs o l u t e s c r e e n p os i t i o ns .

I t i s a l s o r equ i r ed to deve l op a w ay to u n i qu e ly i den t i fy each A p p l e t ’ s

co mp o n e n t an d g e t i n f o r ma t io n s u c h a s t he i r r e l a t i v e p os i t i on to t h e

A p p l e t . A l th o ug h by u s i ng the R o b o t c l a s s e v en t s can be g en e r a t ed on

each co mp onen t o f t h e App le t , na t i v e J ava me t hod ca l l s o f t he

co mp o n e n t s , s u ch a s g e tT ex t a n d s e t T ex t c a nn o t b e in v o ke d .

3.3.2 Using an Applet Wrapper So f twa re wrap p ing i s a t e ch n iqu e t ha t wraps a p i ece o f execu t ab l e

s o f tw a r e w i th in n ew ly d ev e lo p ed s o f tw ar e in o r d e r n o t t o r ew r i t e t h e

o ld p i e c e o f e x e c u t ab l e s o f t w a r e f r o m s c r a t ch . T h i s t e c hn iq u e i s u s e d

ma i n ly w i th th e r e p la c e me n t o f o ld l eg a cy sy s t e m. W i t h w r ap p i ng o ld

co d e i s l e f t i n i t s n a t iv e en v i r o n men t an d i s c o n n e c t e d to t h e n ew

so f twa re by an API o r a CORBA type in t e r f a ce [ 2 8 ] . T h i s me th o d i s

27

u s ed ma i n ly to g a i n t i me , h o w e v e r s o o n e r o r l a t e r ‘ t h e l eg acy f u n c t i o n s

mus t b e r e i mp l e men t ed w i th i n th e co n t ex t o f t h e n ew env i r on men t ’

[ 28 ] .

S o f tw a r e w r ap p i n g c an p o t en t i a l l y be t h e s o lu t io n to t h i s p r o j e c t . I n

o r d e r t o b e ab l e t o ex ecu t e t he to o l i n a w eb b r o w s er , t he to o l c an b e

i t s e l f an A p p l e t . Th e A p p l e t t o be t e s t ed i s wr ap p ed w i t h i n th e A pp le t

t o o l an d th us c an the n g a i n a cc e s s t o t he co mp on en t s o f t he A pp le t t o

b e t e s t ed . S in ce t he A pp l e t t o b e t e s t ed i s w r ap ped w i th i n t he A pp le t

t e s t in g to o l (TA T J A ) , each me t ho d t h a t i s ex ecu t ed o n th e t oo l i s a l s o

i n d i r e c t ly be ing ex e cu t ed in t he A p p l e t t o b e t e s t ed .

I f t he w rap p in g ap pr oach i s u s ed , t h en th e ev en t s c an be g en e ra t ed

p r o g r a mmat i c a l ly a nd s i nc e th e to o l c an g a in acc es s t o e a ch co mp o n en t

o f t h e A p p l e t t o b e t e s t ed , t h en na t iv e J av a me th o ds o f t h e co mp on en t s

c a n a l s o b e i nv ok ed . U s i n g th i s a p p r oach , a me c h an i s m to u n iq u e ly

id en t i f y e ach A p p le t ’ s co mpo n en t an d ge t r e l ev an t i n f o r ma t io n a b o u t i t

s t i l l h as t o b e d e v i s e d .

3.3.3 Conclusion I t i s co n c luded t h a t t he bes t t e chn iqu e t o u se fo r t he i mp le men t a t i on o f

t h i s p r o j e c t i s t h a t o f t h e wr ap p ing me th od . Th e ma i n r ea s on fo r t h i s

b e in g th a t on ce t h e A pp le t t o b e t e s t ed i s w r ap ped w i th in t h e A pp le t

t e s t i n g t o o l , t he t o o l c an g a i n t o t a l co n t r o l ov e r t h e en t i r e A p p l e t t o b e

t e s t ed c o mpo nen t s . The ex t r a mech an i s m r ega rd in g th e i s s u e o f

u n i qu e ly id en t i f y i ng e a ch A p p l e t ’ s co mp o n en t t h a t ha s t o b e

i mp l e men ted , w o u ld s t i l l hav e t o b e i mp l e men ted ha v in g ch o sen t h e

o th e r t e c hn iq ue , t h a t o f t h e R ob o t c l a s s .

28

3.4 Component Event and Method Invocation I n o r de r t o be ab l e t o r eco r d and th en p l ay back a p a r t i c u l a r u s e r a c t io n ,

T A T J A has to f i r s t a cq u i r e t h e p r iv i l eg e s t o i n vo k e a me t h o d o r ev en t

o n th e co mp o nen t s o f t h e A p p le t t h a t i s be in g t e s t ed . Th e r e a re ma ny

a c t io ns t h a t c a n b e d o ne o n ea ch A p p l e t co mp o n en t . F o r i n s t a n c e on a

r ad io bu t to n on e can c l i ck , d o ub le c l i c k , s e t a s c h e ck e d , s e t a s

u n c h e ck e d , a n d mo r e .

S ince t he r e a r e i n f i n i t e l y many ac t i ons and ev en t s t ha t c an be d one on

e a ch A pp le t ( S w ing ) co mp o n en t , i t i s i mpo s s i b l e t o p r og r a mma t i c a l ly

h a r d co d e e a ch a nd ev e ry po s s ib l e a c t i on i n t h e co d in g o f t h e A pp l e t

t e s t i n g t oo l . I n c e r t a i n c as e s , s o me d ev e lo p e r s dev e l o p n ew

co mp o n e n t s t h a t e x t en d f r o m t h e S w i ng A P I . I f t h e me th o ds a n d ev en t s

t h a t c a n be p e r f o r med by T A T J A a r e h a r d co d ed , t h en t he me t h o d s a n d

ev en t s o f s u ch c o mp o ne n t s c an n o t b e i nv o k ed by th e to o l .

D u e t o t h e r e as o n s ex p l a in e d ab o ve , t he to o l s h ou ld h a v e a me c ha n i s m

th a t l e t s t he us e r t o d e f in e t h e co mm an ds ( i . e . me th o ds an d ev en t s ) t ha t

c a n be in vo k ed o n ea c h A p p le t co mp on en t . T he mo s t e f f ec t iv e w ay o f

i mp l e men t i ng th i s i s t o h a ve an XM L f i l e w i t h t h e d i f f e r en t A pp le t

co mp o n e n t s t og e t h e r w i th th e i r r e s p e c t iv e co m ma n d s ( i . e . me t h od s a nd

ev en t s ) t ha t c an b e u s ed b y TA TJA. Wh en r eco r d ing a p a r t i cu l a r t e s t

c a s e , T A T J A s ho u l d o n l y a l low th e u s e r t o p e r f o r m th e a c t i on s tha t a r e

l i s t ed a s co mmand s o f t h a t p a r t i cu l a r co mpo n en t i n t he s a i d X M L f i l e .

I n t h e p l a y b ack p r oces s , t h e to o l s ho u ld b e a b l e t o d y n a mi c a l l y i n vo k e

th e ev en t s o r me th od s th a t a r e d e f in ed in t h e X M L f i l e f o r each

co mp o n e n t .

29

3.5 Technologies to be used TA T J A i s i mp l e me n ted in J av a . Th e t w o ma i n t e ch no l o g i e s u se d in t h i s

p r o j e c t a pa r t f r o m th e J a v a S tan d a r d E d i t i o n ( J2 S E) a r e XM L an d th e

Ja va R e f l e c t i o n A P I .

3.5.1 XML E x tens ib l e M ar ku p L a ng u a g e ( X M L ) i s a ma r k up l an g u ag e f o r

d oc u men t s co n t a in in g s t r u c t u r ed in f o r ma t io n . X M L ma kes u s e o f t ags .

T h i s mar ku p l an g u ag e h as b ee n a W 3 C [1 6 ] r e c o mme n d a t io n s i nc e

F eb r ua r y 19 9 8 . F ig u r e 4 sh o w s an ex a mp l e t a ken f r o m [2 3 ] o f a n X ML

mar k u p f o r a new s A r t i c l e .

Figure 4: An XML markup for a news article

A s s ho w n in F i gu r e 4 , X M L d o cu me n t s co n t a in on ly da t a , n o t

f o r ma t t i n g in s t r uc t io ns , s o app l i c a t io ns t h a t p r o ces s XM L d ocu men t s

mus t d e c i de ho w to man ip u la t e o r d i s p l ay th e do cu me n t ’ s da t a . F o r

ex a mp le a P e r s on a l D i g i t a l A s s i s t a n t (P DA) may r end e r an X ML

d oc u men t d i f f e r en t ly f r o m a mo b i l e p ho ne o r a de s k to p co mp u t e r .

X M L p e r mi t s d ocu me n t au t h o r s t o c r ea t e ma r ku p f o r v i r tu a l l y any ty pe

o f i n f o r ma t io n . T h i s ex t en s i b i l i t y en ab l es d o cu me n t a u th o r s t o c r ea t e

30

mar k u p l an gu ag e f o r d es c r ib ing d a t a su ch a s ma t h e mat i ca l f o r mu l a s ,

mus i c , ne w s , a nd mo r e . E x a mp l e s o f X M L ma r ku p l ang u ag e s in c l ud e :

• Ma th ML . X M L f o r d es c r ib i n g ma t h e ma t i c a l n o ta t io ns . [ 1 7 ]

• Gra p h M L . X M L fo r d es c r i b i ng g r ap h s . [ 18 ]

• Mu s icX ML . X M L f o r d es c r ib in g mu s i c no ta t i on . [ 19 ]

X M L i s g o ing t o be u s e d i n t h i s p r o j e c t i n o r d e r t o d e f in e a ma r k u p

l ang u a g e f o r T A JTA . T h i s mar k u p l an gu ag e i s g o in g to b e c a l l ed

T at j aM L a nd i t i s g o ing t o b e u s ed to d e f in e th e c o m man ds ( e v e n t s a n d

me t h od s ) t h a t t h e u s e r o f t h e to o l can i n vo k e o n e ach d i f f e r en t

co mp o n e n t .

3.5.2 The Reflection API I n co mpu te r s c i en c e , r e f l e c t io n i s t h e p r oce s s by w h ich a c o mp u t e r

p r o g r a m c a n ‘ o bs e r v e a nd mo d i f y i t s o w n s t r uc tu r e an d b eh av io u r ’ [2 0 ] .

R e f l e c t io n i s c o mmo nly u sed by p ro g r a ms w h ich r eq u i r e t he a b i l i t y t o

ex a mi ne o r mo d i fy the r un t i me b e h av io u r o f a pp l i c a t io ns . [ 2 1 ] .

‘ T he u s e o f r e f l e c t io n i s an i mp o r t an t t e ch n iqu e f o r i mp r o v i n g

p r od u c t iv i t y . Re f l e c t io n f a c i l i t a t e s d ev e lo p m en t o f p r o g r a ms t ha t

a r e e a s i l y ad ap t ed t o r eq u i r e men t c ha ng es . W i th r e f l e c t i on o n e

c an d e ve lop s o f t w a r e e ng in e e r in g to o l s t h a t ex a mi n e [ and / ] o r

p r od u ce co d e . Re f l ec t i o n f ac i l i t a t e s t e s t i n g an d p r ob le m

d e t e r mi n a t i o n b y f ac i l i t a t i n g th e au to ma t i o n o f mor e t ed i o u s

t a s k s . I n g en e r a l , r e f l e c t i on i mpr o ves th e f l ex ib i l i t y ,

ex t en s ib i l i t y , an d r eu s ab i l i t y o f o ne ' s cod e . ’ [ 2 2 ]

T h e J av a p r o g r a mmi n g l a n g ua g e ( f r o m v e r s i on 1 . 4 up w ar ds ) c on ta i n s a

h igh ly e f f ec t i ve r e f l e c t i on f ac i l i t y . A d es c r ip t io n o f t h e c l a s s es a nd

me th od s o f t h e J ava R ef l ec t i o n A P I – j a va . l a n g . r e f l e c t c an be f o u nd o n : h t t p : / / j a v a . s u n . c o m / j 2 s e / 1 . 4 . 2 / d o c s / a p i / j a v a / l a n g / r e f l e c t / p a c k a g e - s u m m a r y . h t m l

31

Th e r e f l ec t i on A P I i s go in g to b e u s e d in t h i s p r o j ec t i n o r de r t o b e ab l e

t o a c ces s t he d i f f e r en t co mp onen t s t ha t make up t he A p p le t . Re f l ec t i on

i s a l s o g o ing to be u s e i n o rd e r t o dy nami ca l ly p e r fo r m t h e d i f f e r en t

co mmands on t he d i f f e r en t co mp on en t s t ha t a r e de f i n ed i n t he Ta t jaML

X M L f i l e .

3.6 Summary I n t h i s c ha p t e r an ov e r v i e w o f t h e t e s t i n g to o l i s g i v en . T h e n a me o f

t h e t o o l , T A TJ A , i s a l s o d e f ined . Th e way to t a ck le t h e p ro b l e m o f h ow

to c ap t u r e a nd th en g en e r a t e t he u s e r a c t io n i s d i s c u s s ed . A s ho r t

d es c r ip t i o n o f t h e t e c hn o l og ie s t o be u s ed i s g iv en to ge t h e r w i t h a

d es c r ip t i o n o f w h er e an d w hy thes e t e ch n o lo g i e s a r e u s e d . T he

r eq u i r e m en t s o f t h e to o l a r e de f in ed . Th es e r eq u i r e men t s a r e l i s t ed

b e lo w :

Th e to o l s h ou ld :

• Be ab l e t o t e s t J av a A p p l e t s i n w eb b r o w s er s

• Be b r o w s er a nd p l a t f o r m in d ep e nd en t

• H av e t e s t c ap tu r e ( r eco r d ) a n d p l a y b ac k cap ab i l i t i e s

• H av e a mech an i s m to p r o g r a m an d e x e c u t e r e g r e s s i on t e s t s

• M ak e u s e o f t he J a v a l an gu ag e to p r o g r a m t h e r e co r d ed t e s t c a s es

• Be f l e x i b l e an d a l lo w th e u s e r t o d e f in e h i s / he r o w n p o ss i b l e

co mp on e n t a c t io n s ( by me a n s o f an X M L d e f in i t i o n f i l e )

32

Chapter 4 Specification and Design

4.1 General System Architecture A s i t i s ex p l a in ed i n t he p r ev iou s c h ap t e r , i t i s d ec i d ed th a t T A T J A

s h o u l d b e a n A p p l e t t h a t w r aps w i t h i n i t t h e A p p le t t o b e t e s t e d . O n c e

th a t t h e A pp le t t o be t e s t ed i s w r ap ped i n s id e t he App le t t e s t i ng too l ,

t h e t e s t i n g t o o l c a n ga in ac ces s o f t he co mpo nen t s , t hen i t c an be u s ed

to r e c o r d an d p l ay ba ck u s e r a c t io ns .

Figure 5: General System Architecture

33

F ig u r e 5 i l l u s t r a t e s a d i ag r a m o f t h e g en e r a l sy s t e m a r ch i t ec t u r e o f t h e

p r o p os ed sy s t e m. A s i t i s c l e a r ly ex p la in ed i n F i gu r e 5 , t h e A p p le t t o

b e t e s t ed i s f i r s t l o ad ed an d wr ap p ed w i th in t h e t oo l . O n ce t h a t t h e

A p p l e t t o be t e s t e d i s w r ap ped w i t h i n TA T J A, a mech an i s m to u n iq u e ly

id en t i f y e ach co mp on en t i s u sed t o u n iq u e l y id en t i fy ea ch A p p l e t ’ s

co mp o n e n t s .

Th en th e us e r d ec i des i n w h ich mo d e t o o pe ra t e t h e t o o l . I f t h e t o o l i s

o pe r a t ed in r e co r d in g mo d e , a r e co r de r h an d le r t a k es co n t r o l o f t h e

sy s t e m w h i l e i f t h e to o l i s o p e r a t e d i n p l a y b ac k mo d e , a p l ay b ack

h an d l e r t ak es c on t r o l o f t he to o l . T he r e co r d e r h an d l e r an d th e

p l ay back hand l e r a r e ex p l a i n ed in so me mo r e d e t a i l i n t h e n ex t t w o s ub

s ec t io ns . N o te t h a t a s i l l u s t r a t ed in F ig u r e 5 , bo th h an d le r s ma k e u s e

o f t h e T a t ja M L d oc um e n t an d o f t he gen e r a t ed t e s t c l a s se s . T he

T a t ja ML do cu m en t i s exp l a in ed in d e t a i l f u r th e r on in t h i s c hap t e r .

F ig u r e 5 .5 i l l u s t r a t e s a s e q u en ce d i a g r a m o f t h e p r op o s ed s y s t e m.

Figure 5.5: A sequence diagram of the proposed system

4.1.1 Recording Mode

F ig u re 6 g iv es an ov e r v i ew o f t h e a r ch i t e c tu re o f TA T JA i n r ec o r d i ng

mo d e . A s s h o w n in F ig u r e 6 , t he A pp le t t o b e t e s t ed i s w r ap ped in to

an o th e r A pp le t . T h e R eco rder Hand ler i s i n ch a r g e o f e ve ry th in g t h a t

34

h ap p e ns d u r in g th e r e co r d i n g mod e . I n t h e Ta t jaML F i l e t h e r e s h ou l d

be t h e co mman ds t oge th e r w i th a l l t h e r eq u i r ed d a t a t h a t e a c h A p p l e t

co mp o n e n t c an p e r f o r m.

Wh en th e u s e r s w i t ch es T A TJ A to be u s ed i n r eco rd in g mo de , t h e

Re co r der Ha n d l er i n d i ca t e s t h e a c t io n s th a t t h e us e r i s a l l o w ed

( ac c o r d i n g t o t h e Ta t j aM L s pe c i f i c a t i o n ) t o d o . T h e Recorder Hand le r

s h ou ld h an d l e a l l t h e ac t i o ns pe r fo r med b y th e u se r an d a l l t h e s e

ac t io ns a r e t r an s l a t ed in to co mp i l ed J av a co d e a s t e s t c a s es . N o t e t h a t

i n o rd e r t o b e ab l e t o r e co rd t he t e s t ca s es , t h e Reco r de r H and l e r mak es

u s e o f t h e Com p on en t Id en t i f i ca t io n Reso urc e .

Figure 6: TATJA in recording mode

The u se r i s a l l o wed t o r eco rd a s mu ch t e s t c a se s a s i t i s dee me d

n e ces s a ry in d i f f e r en t J av a c l a s s es a nd me th o d s . N o t e th a t i n T A T J A i t

i s a s s u m ed th a t o n e me t h o d i s eq u i v a l e n t t o o ne s in g le t e s t c a se . A

c l a s s c an h av e man y me t ho d s , i . e . ma ny t e s t c a s es .

35

4.1.2 Playback Mode F ig u r e 7 g iv es a n ov e r v i ew o f t h e a r ch i t e c tu r e o f T A T J A w he n i n

p l ay back mo d e . T he A p p l e t t o b e t e s t ed i s w r a pp ed w i t h i n an o th e r

A p p l e t – t h e p r in c i p l e t h a t i s u s ed in r eco r d ing mod e i s r ep ea t ed h e r e .

Wh en t h e us e r s w i t ch es TA TJ A t o be us ed i n p l ay b ack mo d e , t h e

Playba ck H an d le r mak es u s e o f t h e T a t ja ML d ocu me n t i n o r de r t o b e

ab l e t o d y n ami ca l l y r end e r t he ac t io n s ( co mma nd s ) t h a t a r e cod ed i n the

t e s t c l a s s e s . N o t e t h a t t h e T a t ja ML f i l e t o b e us ed in p l ay b ack mo d e

s h ou ld b e th e s a me t ha t w as u s ed in t h e r eco r d i ng mo d e w h en th e t e s t

c a s es w er e b e i n g r e c o r d e d b y t h e u s e r . N o t e t h a t i n o r d e r t o b e ab l e t o

p l ay back t e s t c a s es , t he r eco rde r hand l e r ma kes u se o f t he Co m po n en t

I d e n t i f i ca t i o n R es o u r ce .

Figure 7: TATJA in Playback mode (When used manually)

T h e u s e r s ho u l d b e a l lo w ed to p l a y b ack a s much t e s t c a s es a s i t i s

d ee med n eces s a ry . Th e us e r s ho u l d a l s o b e a l lo w ed t o ex ecu t e t he s a me

t e s t c a s e ov e r a nd o v e r ag a i n .

36

N o te th a t t he to o l s ho u ld b e o pe r a t ed in P layb a c k M od e i n tw o way s . I t

c a n b e o p e ra t ed by ex ecu t ing th e t oo l i n a b r ow s er an d man u a l ly

s e l e c t i ng th e t e s t c a s es t o b e ex e cu t e d . T h i s o p t io n i s mo s t l i ke ly to b e

u s ed d u r i n g th e t e s t c a s es c r e a t io n p h a s e . T A T J A a l s o h a s t h e op t io n t o

p r o g r a mmat i c a l ly ex ecu t e t h e t e s t c a s e s o n d i f f e r en t w e b b r o w se r s .

Be in g ab l e t o p ro g r a mmat i ca l l y i nvok e T A T J A an d pe r f o r m t e s t s i n

d i f f e r en t w e b b r o w s er s , mak es i t p o s s i b l e t o u s e an d in t eg r a t e t h e to o l

w i th o th e r W eb A pp l i ca t i on t e s t i n g t o o l s such a s S e l en i u m. T h i s op t ion

i s mo s t l i k e l y to b e u s ed i n r e g r es s io n t e s t i n g s in ce t h e t e s t e ng in e e r

can p r og ra mmat i ca l l y i nv oke a p a r t i c u l a r w eb b ro w se r an d ex ecu t e on i t

a s e l ec t i o n o f t e s t c a ses .

F ig u r e 8 i l l u s t r a t e s t h e a r ch i t e c tu r e o f T A T J A w he n i t i s i n v ok ed

p r o g r a mmat i c a l ly i n p l ay back mod e .

Figure 8: TATJA in playback mode (When invoked programmatically)

I n t he s cen a r io d ep ic t ed in F i gu re 8 , t h e A p p l e t t o b e t e s t ed i s w rapp ed

in s id e a n o th e r A pp le t . A J ava me t ho d th a t i nv ok es a s e l e c t io n o f t e s t

37

c l a s s es i s a l s o gen e r a t ed in t h e A pp le t w r ap pe r . T h i s J ava me th od i s

g en e r a t ed in o r d e r t o b e inv o ked w h e n i t i s r e q u i r ed t o e xe cu t e t h e t e s t .

A n H T ML p ag e w i t h th e c o d e th a t e mb eds t h e A p p l e t i s a l s o g e n e r a t e d .

T h i s H T M L pag e a l so co n ta in s J a v aS cr ip t c od e t ha t i nv o k es th e

p r e v i ou s l y gene r a t ed J av a me t ho d . W hen th e H TM L pag e i s l o a ded i n a

w eb b r ow s e r , t he J a vaS c r ip t co d e a u t o ma t i ca l ly i nv ok es th e J av a

me t h od t h a t h as i n i t t h e i n s t r uc t io ns t o run th e de s i r ed t e s t c a s e s .

T h u s by o n l y l oa d in g th e g en e r a t ed H T M L page in a w e b b r ow ser , t h e

t e s t c a s es a re ex ec u t ed au to ma t i ca l l y .

4.2 TatjaML T a t j a ML i s t h e n ame o f t h e mar k up l ang u ag e t h a t i s g o i ng t o b e u s e d by

TA T J A . Ta t j aM L con t a i n s a l i s t o f a l l t he ac t io n s t h a t can b e

p e r f o r me d o n e a c h co mp o n en t . A n a c t i o n can b e e i t h e r an ev e n t o r a

me thod c a l l ( co mmand) on t he co mponen t . Wi th each ac t i on t he r e i s

i n c l ud ed a l l t h e i n fo r ma t io n th a t i s needed b y TA T JA to dy nami ca l ly

p e r f o r m t h a t o p e r a t io n .

Figure 9: An extract taken from a TatjaML document

38

A compo nen t i s de f i ned i n a Ta t j aML docu me n t u s ing t he c o m po n en t

t ag . T h e pa ra me te r n am e o f t h i s t ag id en t i f i e s t h e J av a co mp on en t ( F o r

ex a mp le JP a ne l , J B u t ton … ) . F i gu r e 9 s ho w s an e x t r ac t o f a p a r t i cu l a r

co mp o n e n t t ag t ak en f r o m a T a t j aM L do cu men t .

A co m pon en t t ag co ns i s t s o f t w o o th e r t ag s , co m m an d s a n d e ve n t s .

T h es e tw o t ag s a r e u s e d to d e f in e u s e r a c t io n s th a t c a n b e p e r f o r med

e i th e r b y me th o d c a l l s o r by e ve n t g en e r a t i o n r e s pe c t iv e ly . N o te t h a t

e a ch co m p on en t d e f in i t i o n c a n h a ve z e r o o r mo r e co m m a n ds an d even t s .

4.2.1 Commands A T A TJA co mmand i s d e f in ed b y c rea t in g a n ew t ag w i t h in t h e

co m m a nd s t ag . T he n a me o f t h i s t a g s h ou ld be th e name o f t h e n a me

th a t i d en t i f i e s t h a t co m man d . F i g u re 1 0 s ho w s an ex a mp le o f a

T a t j a ML c o mman d .

Figure 10: An example of a TatjaML command

A co m m an d t ag h a s tw o pa r a me t e r s , p ar a m s an d d es c . T he p a r a me t e r

p ar a m s i s u s ed to i d en t i fy a n y p a r ame t e r t y p es ( s u c h a s i n t , S t r i n g … )

th a t t h e p a r t i cu l a r co m ma n d r eq u i r e s w h en i t i s c a l l e d b y TA T JA . T h e

o th e r p a r a me t e r , d e s c , i s u s ed t o l e t t he u s e r t o w r i t e a d es c r ip t io n o f

t h a t co mma n d .

39

The c om m a nd t ag co ns i s t s o f ano th e r tw o t a gs , t h e r e tu r n t ag a nd th e

i n vo ke t ag . The re tu r n t ag i s u s ed t o i d en t i f y t h e r e t u r n va l ue o f t ha t

co mman d ( s uch a s nu l l , i n t , S t r in g …) . Th e i n vo ke t ag i s u s ed to

i d en t i f y t h e me th o d th a t h as t o b e i nv ok ed o n t ha t p a r t i cu l a r

co mp o n e n t . T h e me t ho d n a me i s de f in ed i n t h e m e th o d p ar a me t e r .

N o te t h a t i f t h e me th od r eq u i r e s p a r a me t e r s , a l i s t o f p a ra me t e r s a r e

g iv en w i th in th e i n vo k e t ag a s p a r am t ags . Each pa ram t ag has a

p a r a me t e r t yp e t h a t i s u s ed to de f in e th e p a r ame t e r t y pe . Th e co n t en t

o f t he pa ram t ag i s t he v a lue o f t h e p a r a me t e r . I f t he v a l u e o f t he

p a r a me t e r i s no t c on s t an t bu t i t h a s t o b e e n t e r e d b y t he u s e r a s a

co m m a nd p ar a me t e r , t h e c o n t e n t s o f t h e p a r am t ag s ho u ld be a n a me

w i t h an a mp er s a n d sy mb o l ( &) a t t he b eg in n in g ( S ee F ig u r e 10 ) . A n

a mp e r s an d sy mb o l a t t h e b eg inn in g o f t ha t p a r t i c u l a r p ar a m t ag va lu e

me a n s th a t t h e v a l u e o f t h a t p a r a me t e r h as t o be map p e d to a p a r a me t e r

t h a t w as de f i n ed i n t h e f i s t t ag o f t h a t p a r t i cu l a r co mmand .

4.2.2 Events A TA TJA ev en t i s d e f in ed b y c r ea t in g a n ew t ag w i th in th e even t s t ag .

I t i s mu c h th e s a me a s t h e com m and s t ag , w i th t h e p a r a me t e r s p ar a m

an d d es c fo r t he p a ra me t e r s and d esc r ip t i o n r e s p ec t iv e l y . T h i s t y p e o f

t ag i s ma d e u p th e t ag s l i s t en er a n d i nvoke . F ig u r e 11 s h ow s an ex a mp l e

o f a Ta t j aM L ev en t .

40

Figure 11: An example of a TatjaML event

The l i s t e n er t ag i s u s ed t o i d e n t i f y t h e n a me o f t h e e v e n t l i s t e n e r t h a t

h as t o b e c r e a t ed b y T A T J A .

The i n v o k e t ag h a s a p a r a me t e r m e t ho d t ha t i d en t i f i e s t he na me o f t h e

me t h od t h a t h as t o be in vo k ed in o r d e r t o g e n e r a t e t h e ev en t . T h e l a t t e r

h as an o t h e r t ag , t h e p a s s_ o b j e c t t a g . T h i s t a g i s u s ed to i d e n t i fy t he

ev en t ob j ec t t h a t has t o b e p as s ed a s a p a r ame t e r t o t h e me t h o d t ha t

d e f in e d i n t he i n voke t ag . T he p a s s _ o b je c t t ag c an hav e ze r o o r mo r e

p ar a m t a gs . Th e pa ram t ag s a r e u s ed to i d en t i f y t he p a ra me t e r s ( ty pe

an d v a lu e ) t h a t h av e t o b e p as s ed to t he ev en t o b j e c t i n o r de r fo r i t t o

b e c r e a to r .

Th e v a lu es o f t he p ar a m t ag c an b e o f t h r ee t y p es . T h ey can e i the r b e

h a r d co d ed v a lu es , o r va lue s t ha t s t a r t s w i th a n a mp e r s a nd sy mb o l ( & ) ,

o r e l s e t h e va lu e c a n b e o n l y o r s t a r t s w i t h th e c a r r o t sy mb o l ( ^ ) . I f t h e

v a lu e s t a r t s w i th a n a mp er s and s y mb o l , t h en t he v a lu e o f t h a t p a r a me t e r

h as t o b e map p e d t o a p a r a me t e r t h a t w as d e f in ed i n t h e f i s t t a g o f t h a t

p a r t i cu l a r ev en t ( t h e s a me as in t h e co m m an d t ag ) . I f o n th e o th e r hand

th e v a lue i s j u s t t h e ca r ro t sy mbo l ( S ee F ig u r e 5 . 6 ) , i t me ans t h a t t h a t

p a r t i cu l a r co mp on en t h a s t o b e pa s s ed a s a p a ra me t e r t o t h e ev en t

41

o b j ec t – s e l f map p ing . I f t h e v a l u e s t a r t s w i th t he ca r r o t sy mb o l , t h en

th e p a r ame t e r t o b e p as s ed i s a me t ho d c a l l on th a t p a r t i c u l a r ev en t

o b j ec t w i th t h e me t h od n a me b e in g th e s t r i ng f o l lo w ing th e ca r r o t

sy mb o l .

4.3 GUI Design S in ce T A T J A c an be op e r a t e d in tw o mo d es ( R e co r d mod e a nd P lay b ack

mo d e) i t i s dec id ed th a t t h e u s e r i n t e r f ace o f t h i s t o o l s ho u ld co ns i s t o f

tw o t ab s – o ne f o r t h e r e co r d mo d e a nd t h e o t he r on e f o r t h e p l a y b ac k

mo d e . T he in t e r f a c e i s k ep t a s s i mp le a s po s s i b l e , w i t h o n ly a t o o l b a r

a t t h e to p p a r t o f t h e A p p l e t an d t h e r e s t o f t he a r ea r e s e r ved f o r t h e

A p p l e t t h a t i s b e in g t e s t ed .

4.3.1 The Record Toolbar F ig u re 12 i l l u s t r a t e s a d es i gn o f t h e us e r i n t e r f ace o f T A TJ A an d a l s o

th e con t e n t s o f t h e r eco r d i n g mo d e to o l b a r . A s i t i s sh o w n in t h e

d es ig n , t h e R eco r d t o o lb a r co n s i s t s o f a n u mb er o f t e x t b ox es , b u t to ns ,

an d i c on s .

Figure 12: Design of the user interface

T h e f i s t t ex t b ox i s t h e L oa dA pp le t F i e l d . T h i s t ex t b ox i s u s ed t o

co n t a in t he n a me o f t h e A pp le t t h a t i s l oa d e d in t h e to o l i n o r d e r f o r t h e

42

u s e r t o r e co r d t e s t s o n i t . T h e L o a dA p p le tB u t t b u t t on i s t h e b u t to n t ha t

i s u se d in o r d e r t o l o ad an A pp le t i n T A T J A . T h e i co n na med

Re cordBu t t i s u s ed to i n d ic a t e s t ha t t h e u s es w an t s t o r eco r d a t e s t ca s e

w h i l e t h e o t h e r i co n na med P ic kP o i n t s B u t t i s u sed t o i n d i ca t e t he mouse

po in t e r p os i t i on r e l a t i ve t o e ach A p p le t co mp onen t . The Cl as sName

t ex t f i e l d s u s e d to con t a in th e n a me o f t he J a va c l a s s w her e th e t e s t

c a ses a r e be ing r eco rded wh i l e T es t C la s sD i a l og B u t t i s u s ed to lo ad o r

c r e a t e a n e w J av a t e s t c l a s s . T h e M et ho dN a me d i a l og bo x i s u sed to

co n t a in t he n a me o f t h e J a va me t ho d w h ere t h e to o l i s r e co r d in g the t e s t

c a s es . T h e T es t M et ho dD i a l og B u t t i s u s ed t o l oad o r c r e a t e a n ew t e s t

me t h od i n th e J av a c l a s s t h a t i s l i s t e d in t h e ClassNam e t ex t f i e l d .

4.3.2 The Playback Toolbar

F ig u re 13 i l l u s t r a t e s a d es i gn o f t h e us e r i n t e r f ace o f T A TJ A an d a l s o

th e co n t e n t s o f t he r eco r d in g mo d e t o o lb a r . T h i s t oo l b a r i s ve r y s i mi l a r

t o t h e R eco r d t oo l b a r . T he Lo a dA pp le tF ie ld2 t ex t f i e ld i s u sed t o s t o r e

t h e na me o f t h e A p p le t t h a t i s l o ad ed in TA T J A, t ha t i s , t h e A p p l e t t h a t

i s be in g t e s t ed .

Figure 13: Design of the toolbar in playback mode

The Clas sNam e2 t ex t f i e ld i s u s e d to i n d i c a t e t he n a me o f t h e J a va c l a s s

w h er e t h e r e a r e t h e r e co rd ed t e s t c a s e s , w h i l e t h e co mb o b ox

M eth o dN am e 2 i s u s e d to c on ta in th e n a me o f a p a r t i c u l a r t e s t me t h o d

th a t i s f o u n d i n t h e J av a c l a s s l i s t ed in Class Nam e2 . N o te t h a t i n o rd e r

t o l o ad an App le t t o t e s t o r l oad a c l a s s t h a t h as t e s t c a se s t he u se r has

t o o pe n the i r r e s pe c t iv e d i a l og b ox es by c l i ck i ng o n the bu t t on s

L o ad Ap p le tB u t t2 an d T e s tD ia lo gB u t t 2 r e s p e c t iv e l y . T h e

P l ayM e th o d B u t t i c on i s u s ed t o ex e cu t e t h e t e s t ca s e i f t h e me t h od

43

l i s t ed in M et ho d N a m e2 . Th e C r ea t e T es tS u i t e B u t t i co n i s u s ed to c r e a t e

a t e s t su i t e w h i l e t h e T es t S u i t e t e x t b ox i s u s ed to co n ta in th e n a me o f

t he J av a c l a s s t ha t has i n i t t h e c r ea t ed t e s t su i t e .

4.4 Applet’s Components Identification A n i mp o r t an t o p e r a t io n t h a t h a s t o b e d o ne b y TA T J A i s t ha t o f

u n i qu e ly id en t i f y i ng th e d i f f e r en t co mp on en t s t h a t ma kes up th e A pp l e t

t o b e t e s t ed . I t i s i mp o r t a n t t h a t TATJA iden t i f i e s t h e co mp onen t s o f a

J av a A p p le t du r i n g th e p l a y b ack p r o ce s s i n t he s a me man n er t h a t i t

i d en t i f i e s t h e m d ur in g th e r eco r d i ng p ro ces s .

J av a d o e s n o t hav e a me c h an i s m o f u n i qu e ly id en t i f y in g e ac h

co mp o n e n t t h a t mak es up a J av a A p p l e t ( o r an y o th e r t y p e o f G U I ) .

T h u s i t i s r e qu i r e d by T A T J A to g iv e a u n i q u e id en t i f i c a t i on na me t o

e a ch A p p l e t c o mp o n e n t . N o t e t h a t a J av a p r o g r a mme r c an o p t i o n a l l y

g iv e a n a me to a S w in g co mp o ne n t , h o w e ve r t h i s n a me h as no t t o be

u n i qu e . S inc e i t i s n o t man d a t o r y f o r a J av a p r og r a mme r to g iv e a n a me

f o r t h e G U I co mp o n en t s , ma ny p r o g r am me r s do es n o t g i ve n a mes to t h e

co mp o n e n t s .

I n o r d e r t o u n iq u e l y i d e n t i f y each G U I c o mpo n en t , a h as h t ab l e i s u s e d .

Th e v a lu e o f t h e ha s h t ab l e co n t a in s a r e f e r en ce t o t h e a c tu a l A pp le t

co mp o n e n t . T h e k e y o f t h e h as h t ab l e i s a g en e r a t e d un iq u e

id en t i f i ca t i o n s t r i n g . I f a p a r t i cu l a r co mp on en t h a s a n a me (g i v en by

th e p r o g r a m mer du r i ng th e dev e l op men t o f t h e A pp le t ) , t h an t h e k ey o f

t h a t pa r t i cu l a r co mp on en t i n t h e h a s h t ab l e i s t h e n ame g iv en by the

p rog ra mmer . I f t he r e a r e mo re t h an on e co mp o nen t w i th t h e s a me n a me

in th e s a me A p p l e t , t h an th a t n a me i s s t i l l u s ed a s an i d en t i f i c a t io n k ey

h ow e ve r a n u mb er i s ap p en d ed to i t i n o r de r t o mak e i t u n i qu e . I f o n

th e o t he r hand t h e A p p le t c o mpo ne n t d oe s n o t h av e a n a me , t h e k ey o f

t h a t co mp o nen t i n t he h as h t ab l e i s t he t y pe o f t ha t co mpo n en t , f o r

44

ex a mp le JBu t t o n w i th a n u mb er ap p en d e d t o i t i n o rd e r t o mak e i t

u n i qu e , f o r e xa mp le JBu t to n 5 .

4.5 TATJA ‘Record’ Design

By hav in g a w ay o f un iq ue ly i d en t i f y in g an A p p le t co mp o nen t , an d a l s o

by hav i n g t he me ch a n i s m o f de f i n i n g a l l t h e p os s ib l e u s e r ac t io ns o n

each App le t co mponen t , now i t i s p o s s ib l e t o d e s ig n t h e w ay t h a t

T A T J A can b e i n f o r me d to p e r f o r m a n a c t i on o n a p a r t i cu l a r c o m po ne n t .

4.5.1 ‘Record Instruction’ Design I n o r d e r t o i n s t r uc t T A T J A to p e r f o r m a pa r t i cu l a r a c t i o n o n a

p a r t i cu l a r co mpo n e n t , t h e d o t n o t a t i on t e ch n i qu e i s g o i n g t o be a d o p te d .

F ig u re 14 i l l u s t r a t e s an ex a mp le o f ho w TA T J A ad op ted t h e d o t

n o t a t io n .

Figure 14: Example of the dot notation as adopted by TATJA

T h e l i t e r a l b e f o r e t h e d o t i s g o in g t o id en t i f y t he co mp on en t o n w h ich

to p e r f o r m t h e a c t io n , w h i l e t h e l i t e r a l a f t e r t h e d o t i s g o in g t o b e u s e d

to i d e n t i f y t h e ac t io n to b e p e r f o r med . R e c a l l t h a t t h e ide n t i f i c a t i o n

n a me o f e a ch co mpo n en t i s s to r e d i n a ha sh t ab l e an d a l l t h e p o s s i b l e

a c t io ns t h a t c an b e p e r f o r med o n e a ch co mp on en t a r e de f i n ed in t h e

T a t j a ML d o cu me n t .

45

A s s h own i n F i g u r e 1 4 , a n a c t io n c an h av e z e r o o r mo r e p a r a me t e r s .

S in ce t h e T A T J A i ns t r u c t io n i s g o ing to be e xe c u ted in t h e J av a

l an g u a g e , i t i s i mp o r t an t t h a t i f t h e r e a r e a n y p a r a met e r s w i t h in an

ac t i on , t he p a r a me te r s a r e wr i t t en acco rd i ng t o t h e J ava l angu age

s p ec i f i c a t io n s . T h a t i s , i f a s t r i n g i s p a s se d a s a p a r a m et e r i t s h o u ld b e

en c l os ed w i th in do u b le qu o t e s ( “ ” ) , i f t h e p a ra me t e r i s a Bo o l ean va l u e

th e v a lu e s can e i t h e r be t r ue o r f a l s e , an d i f t h e p a rame t e r i s a n u mb er

i t s h ou ld b e w r i t t e n a cco r d i n g to t h e J av a nu mer i c t y p es s p ec i f i c a t i on s .

4.5.2 ‘Record GUI’ Design N o w th a t t he w ay o f ho w to in s t r uc t a p a r t i c u l a r A pp l e t co mpo n en t t o

p e r f o r m a n o pe r a t i on ( A me t ho d c a l l on th e c o mpo n en t o r a n ev en t ) , i s

w e l l d e f i n ed , t he n ex t s t e p i s t o d es i g n th e G U I t ha t t h e u s e r w i l l u s e in

o r d e r t o r ec o r d a pa r t i cu l a r t e s t . A s ex p la in e d in s e c t i o n 4 . 3 . 1 o f t h i s

ch ap t e r , i n o r d e r t o r eco r d a t e s t c a s e , t h e u s e r h a s t o l o a d t h e A p p l e t t o

b e t e s t ed i n t h e t o o l , an d a f t e r s e t t i n g th e t e s t c l a s s an d t e s t me t h o d ,

t h e u s e r ha s t o c l i ck on t h e Re co rd B u t t i con t o s t a r t r eco r d i ng .

Once t he u se r c l i ck s on t h e R e cor d Bu t t i con , t h e u se r w i l l b e ab l e t o

r eco rd ac t i ons on each o f t he App l e t ’ s co mp on en t s . When th e u s e r

mo v es th e mo u s e po in t e r on a p a r t i cu l a r c o mp on en t , t ha t p a r t i cu l a r

co mp o n e n t s h ou ld b e h ig h l i gh t ed , a nd a po p up d i a lo g bo x s h ou l d b e

d i s p l ay ed on th i s s c r e en . T h i s d i a l og b o x sh o u l d co n t a i n a l l t h e

r e l e van t i n f o r ma t i o n a bo u t t ha t c o mp o ne n t ( s u ch a s t y pe , n a me … ) a n d

s h ou ld a l s o co n t a in a l l t h e po s s ib l e a c t i n s ( t o g e th e r w i t h t h e i r

d es c r ip t i o n ) t ha t a r e p os s i b l e t o d o on t ha t co mp on en t . Re ca l l t ha t a l l

t he pos s ib l e a c t i ons t ha t c an be p e r fo rmed o n a co mponen t a r e de f i n ed

i n t he T a t j aML do cu men t .

Fo r i n s t ance , suppose t h a t t he u se r p l a c es t he mo u se p o i n t e r on a

JR ad io Bu t to n , an d in t he T a t j aM L d ocu me n t t he r e i s t h e co d e s h o w n in

F ig u r e 1 5 de f in ed f o r t h e JR ad io Bu t to n co mp o n e n t .

46

Figure 15: Example of a TatjaML definition for a JRadioButton component

F o r t h e T A T J A de f in i t i o n o f F ig u r e 1 5 , t h e ‘ r e co r d in g ’ d i a l o g b ox

s h ou ld b e d i s p l ay ed a s s k e t ch ed in F ig u r e 1 6 . A t t he to p p a r t o f t h e

d i a l og bo x th e r e s ho u l d b e th e d e t a i l s o f t ha t pa r t i cu l a r co mp on e n t . A t

t h e b o t to m pa r t o f t h e d i a lo g b o x th e r e s ho u l d b e a l l t h e p o ss i b l e

a c t i ons a s de f in ed i n t h e T a t j aML do cu men t .

47

Figure 16: A sketch of the 'record' dialog box

I n o r d e r t o s e l ec t a p a r t i cu l a r a c t io n th e u s e r h as t o c l i ck o n th e n a me

o f t h e de s i r e d a c t i o n . I f t h e a c t ion ch os en b y the u s e r h as p a r a me t e r s ,

t h an an o t he r d i a lo g bo x s h o u ld b e d i s p l a y ed o n t h e s c r e en i n o rd e r t o

l e t t h e u s e r t o en t e r t h e r equ i r ed p a ra me t e r s .

When t h e u se r r e co rds a pa r t i cu l a r a c t ion , t h i s a c t ion i s ‘ coded ’ a s p a r t

o f t h e J a v a me th o d ( d e f in e d i n t h e M eth od N am e t ex t f i e ld ) w i t h in t h e

J av a c l a s s ( d e f i n e d i n t h e C la s s Na m e t ex t f i e ld ) . N o t e t h a t w h en th e

u s e r r e m ov es th e mo u s e po in t e r f r o m a p a r t i cu l a r A p p l e t co mp on en t ,

t h e ‘ r e co r d ’ d i a l o g b ox i s d i s po s ed . I f t h e u s e r t han p l a c es t h e mo u s e

p o i n t e r o n an o th e r co mp o n en t , a new ‘ r e co r d ’ d i a lo g b ox i s t h e n

g en e ra t ed .

4.6 TATJA ‘Playback’ Design

I n T A J T A , a r e co r d ed t e s t c a s e c a n b e ex ecu t e d in tw o w a y s . A t e s t c an

e i th e r b e e x e c u t e d ma n u a l l y f r o m t h e to o l i t s e l f o r e l s e i t c an b e

ex ecu t e d by c r e a t i n g a t e s t s u i t e t h a t c an b e i nv o ked p r og r a mma t i c a l ly

f ro m a J av a p r og ram. I n o rde r t o ex ecu t e a t e s t ca s e manu a l l y , t h e u s e r

h as l o a d t h e A p p l e t i n t h e to o l , s e l e c t t h e t e s t c l a s s an d t e s t me t h o d a n d

c l i ck o n t he P l a y M et ho dB u t t i n o r d e r t o s t a r t t h e e xe cu t io n o f t h e t e s t .

A l t h o u g h th i s me th o d i s p r e t ty ea sy i t h as t h e d i s a d v an t ag e t h a t i n

o rd e r t o ex ecu t e a t e s t t h e to o l (T A TJ A ) a s t o b e lo ad ed an d t h e u s e r

48

h as t o s t a r t t h e t e s t man u a l ly . Th us i t i s no t p os s i b l e t o p e r fo r m

r eg re s s i o n t e s t i n g . Th i s p r ob le m i s s o lv ed b y c r ea t i ng a T es t Su i t e .

4.7 Summary I n t h i s c h ap t e r t h e a r c h i t e c t u r e o f t h e p r o p os ed t oo l i s de f i n ed a nd

d es ig n e d . T he a i m f o r t h e T a t jaM L d o cum e n t i s e x p la i n ed i n so me

d e t a i l a n d t h e f o r ma t o f t h i s ma r k up l ang u ag e i s d e f in ed . T h e d e s ig n o f

t h e g r ap h i ca l u se r i n t e r f a ce i s a l s o des ign ed i n t h i s chap te r . The

mech an i s m o f ho w th e t o o l i s go i n g to un i q ue ly i d en t i f y each o f t he

A p p l e t ’ s co mp o n en t s i s dev i s e d an d th e w ay h ow to r ec o r d an d

s u bs eq u e n t ly p l ay b a ck t e s t c a s es a r e d ev i s ed .

49

Chapter 5 Implementation T h i s ch a p te r d i s c u s s e s i n s o me d e t a i l t h e ma i n c l a s s es an d a l g o r i th ms

th a t a r e u s ed in TA T J A.

5.1 Implementation Overview T A T J A con s i s t s o f 3 0 Jav a c l a s s es a nd a n u mb er o f co n f ig u r a t i on f i l e s .

T h e J av a c l a s s es a r e c a t eg o r i s ed i n t o 5 packages acco rd ing t o t he t y pe

o f f u n c t i o n a l i t y t h ey h av e . T he s e p a c k ag es a r e :

• co m mo m

• de fen i t i o n s d r iv e r

• d i a lo gb o x es

• he lp e r s

• t a t j a

Th e co nf ig u r a t io n f i l e s a r e s to r ed i n t h e fo l d e r n a me d r e s o u r c es t h a t

r e s id es a t t h e r o o t o f t h e d i r e c t o r y o f t h e A pp le t p r o j e c t t h a t i s b e i n g

t e s t ed .

T h e to o l s u s e d f o r t he i mp l e me n t a t io n o f t h i s p r o j e c t a r e Ec l ip s e

3 .3 .1 . 1 I D E an d NetB e an s 6 . 0 I D E . T h e j a v a r u n t i me e nv i r on me n t u s e d

i s j r e 1 . 6 .0 U p da te 5 .

50

5.2 Package common Th i s p ac kag e co ns i s t s o f o n l y o n e c l a s s t h a t i s n o t s pe c i f i c t o t h i s

p r o j e c t , b u t a c l a s s t h a t c an be p o t en t i a l l y u s ed in o t h e r f u t u r e p r o j e c t s

t h a t a r e n o t ne ces s a ry r e l a t ed t o s o f t w ar e t e s t i ng . T h i s c l a s s i s t h e

C S V T o k a n i s er c l a s s . I t h as t he s ame fu nc t i o na l i t y a s t h e na t i v e J ava

S t r in gT o k a n i se r , h o w ev er i n s t e ad o f u s in g a s p a ce a s a d e l i mi t e r i t u s es

a co mma ( , ) .

5.3 Package defenitionsdriver Th i s pa ck ag e con s i s t s o f 7 c l a s s es . T h es e a r e :

• Co mma n d Co n t a i n e r

• D efen i t i o ns D r iv e r

• D et a i l s C o n ta in e r

• E v en t Co n t a in e r

• P ar a ms C o n ta i n e r

• Re cor d e r T oo lCon t r o l

• T e mp C o m ma n d Co n t r o l

Th es e c l a s s es a r e u s ed by TA TJA in o rd e r t o p a r se a r e ex t r ac t

i n f o r ma t i on f r o m th e T a t j a M L d oc umen t . A s i t w as e xp l a i ned i n t h e

p r e v i ou s ch ap t e r s , T a t j a M L i s ma r k u p l a ng u ag e th a t i s go in g t o b e u s ed

by TATJA. As t he i r na me i mp l i e s , t he c l a s ses CommandCon ta in er ,

D e t a i l s C o n t a i n er , E v en t Co n ta i n e r , P a r a m sC o n t a in er ,

Re co r der T o o l Co m nt r o l an d T em p C om m a nd Con t r o l a r e u s ed a s d a t a

p l a c e h o l d e r s an d d o es n o t co n t a in a l o t o f f u n c t i o n a l i t y . H o w ev er t h e

c l a s s D ef e n i t i o n D r iv er i s a ve ry c r i t i c a l c l a s s s in ce i t h as a l o t o f

f un c t i on a l i t y . Th i s c l a s s an d i t s me th od s a r e de sc r i bed i n so me d e t a i l

i n s e c t i on 5 .3 . 1 .

51

5.3.1 Class DefenitionsDriver Th i s i s a v e r y imp o r t an t c l a s s s i n ce a l l op e r a t i on s r e l a t ed to t h e

Ta t j aML d o cu men t a r e pe r f o r med th r o ug h i t . A l l t h e me th o ds o f t h i s

c l a s s a r e d e f i n ed a s s t a t i c . Th i s mak es i t p os s ib l e t o u s e th i s c l a s s

w i t ho u t t h e n eed o f c r ea t ing an in s t an ce o f i t .

I n t h e n e x t f ew l i n es , t h e f u nc t io n a l i t y o f ea c h me t ho d o f t h i s c l a s s i s

b r i e f l y ex p l a in ed .

pu b l i c s t a t i c S t r i n g remo v eX ML C om m en ts (S tr in g s )

Th i s me t h od i s u s ed t o r emo ve any co mmen t s f r o m t he T a t j aM L

do cu men t . Th e t ex t o f t h e d o cu me n t i s p as s ed a s a p a r a me t e r

t h r o ug h s .

pu b l i c s t a t i c A r r a y Li s t< S tr in g> to ken i s e X ML (S t r in g s )

Th i s me t h o d i s u s ed t o t o k en i s e a T a t j aM L f i l e , t h a t i s , i t r e tu rn s

t he con ten t s o f t he Ta t j aML docu men t a s a l i s t o f s in g le e l e me n t s .

pu b l i c s t a t i c S t r i n g g e tX MLS tr i n g ( )

Th i s me t h o d i s u s ed t o g e t t h e co n t en t s o f t h e T a t j aM L f i l e a o n e

w ho le s t r i ng .

pu b l i c s t a t i c A r r a y Li s t< S tr in g>

ge tEv e n ts Of C o mpo n en t ( A rray L i s t< S tr in g> to ken s )

Th i s me t h od i s u s ed to g e t a l i s t o f a l l t h e d e f i n ed e ve n t s o f a

pa r t i cu l a r A pp le t c o mp on en t . T h e l i s t o f t ok en s o f t ha t pa r t i cu l a r

co mp o n e n t i s p as s ed a s p a r a me t e r .

pu b l i c s t a t i c A r r a y Li s t< S tr in g>

g e t C om mand s Of Com p onent ( A rra y L is t < S tr i ng> to ken s )

Th i s me t h od i s u s ed to g e t a l i s t o f a l l t h e d e f i n ed co mma n d s

( me th od c a l l s ) o f a p a r t i c u l a r A p p le t co mp onen t . The l i s t o f

t o ken s o f t h a t p a r t i cu l a r co mp o n en t i s p as s ed a s pa r a met e r .

52

pu b l i c s t a t i c A rra y Li s t< TempC o mma nd C on ta in er>

g e t C on t ro lD et a i l s Of C omp on e nt ( S tr i n g co mpo n en tN am e)

T h is me t h o d i s u s ed t o g e t a l i s t o f t h e r eq u i r e d co n t r o l

i n f o r ma t i o n o f a p a r t i c u l a r co mp on en t . T he n a me o f t h e

co mp o n e n t i s p as s ed a s p a r a me t e r .

pu b l i c s t a t i c S t r i n g g e t C om man dDes c r ip t i on

( A rra yL i s t < St r i n g> to ken s , S tr i n g co mm an d)

Th i s me t h od i s u s ed t o ge t t h e d es c r ip t i o n o f a pa r t i cu l a r

co m man d th a t i s d e f in ed i n t he T a t j aM L d o cu men t . Th e l i s t o f

t o ken s o f t h e p a r t i cu l a r A pp l e t co mp o nen t a nd th e n a me o f t he

co m man d a r e p a s s ed a s pa r a me t e r s .

pu b l i c s t a t i c b o o l e an i s C om m an d Ev en t ( A r r a y L i s t < S t r i n g > c o m p o n e n t T o k e n s , S t r i n g c o m p o n e n t N a m e , S t r i n g c o m m a n d )

T h is me t h o d i s u s e d to che ck i f a p a r t i cu l a r d e f in ed a c t i o n o f a

pa r t i cu l a r co mp on en t i s an ev en t o r no t . Th e l i s t o f t o k ens o f t h e

pa r t i cu l a r T a t j aM L d o cu men t , t h e n ame o f t h e co mp on en t an d th e

na me o f t he co mman d a r e p as sed a s p a r a me te r s .

pu b l i c s t a t i c S t r i n g g e t Ta gP ar am e t er ( S tr in g t ag ,S t r in g p a ra m eter )

T h is me t h o d i s u s ed to g e t t h e p a r a me t e r o f a p a r t i cu l a r T a t j a M L

t ag . T h e t ag an d th e n a me o f t h e p a r a met e r a r e p as s ed a s

pa r a me te r s .

pu b l i c s t a t i c Pa ra ms C on ta in e r g e t C om m an dPa ra m s

( S tr in g co mp on ent N am e, Str in g co m m a nd)

T h is me t h o d i s u sed to g e t t h e p a r a me t e r d e t a i l s o f a p a r t i cu l a r

co mp on en t co mman d th rough an i n s t an ce o f a p a r am sCon ta in er

c l a s s . T h e n a me o f t h e co mp o n en t a nd n a me o f t h e c o mma nd a r e

pa s sed a s pa r a me te r .

53

pu b l i c s t a t i c A r r a y Li s t< S tr in g> ge t T oke n s O fTa g

( A rra yL i s t < St r i n g> t o ken s ,S t r in g t agN a me )

T h is me t h o d i s u se d to t o ken i s e a p a r t i cu l a r T a t j a M L t a g

de t en t io n . T h e l i s t o f t o k e ns o f t he p a r t i cu l a r A p p l e t co mp on e n t

an d th e t ag n a me a r e p a s se d a s pa r ame t e r s .

pu b l i c s t a t i c S t r i n g g e t Ta gA r gu m en t (S t r in g t a g )

T h is me t ho d i s u s ed to ge t t h e a r g u men t o f a p a r t i cu l a r T a t j a M L

t ag . T h e t ag co n t e n t i s p as s ed a s p a r a me t e r .

pu b l i c s t a t i c S t r i n g g e t Ta gN a m e(St r i ng ta g )

Th i s me t h od i s u s ed t o g e t t he n a me o f t h e Ta t j aM L t ag th a t i s

pa s s ed a s a p a r a me te r .

pu b l i c s t a t i c A r r a y Li s t< S tr in g> ge t T oke n s O fC o mp onen t

(A rray L i s t< St r in g > l i s t , S t r i ng co mpo n en tN am e)

Th i s me t h od i s u s ed to g e t t h e l i s t o f t o ken e l e men t s o f a

pa r t i cu l a r A p p le t c o mp o n e n t t h a t i s de f i n ed in t he T a t j a M L

do cu men t . T h i s l i s t o f t o k en s o f t h e w h o l e T a j t aM L d oc u me n t

an d t h e c o mponen t na me a r e pa s sed a s pa r a me t e r .

pu b l i c s t a t i c A r r a y Li s t< S tr in g>

ge t C o m m a n d N am es ( A r ra yL is t <S t r ing > t )

T h is me t ho d i s u s ed to g e t t h e l i s t o f co mman d n a mes o f a

pa r t i cu l a r A p p le t c o mpo n en t a s de f i n ed in t h e T a t j aM L do cu men t .

Th e l i s t o f t o ken s o f t h a t pa r t i cu l a r co mpo n en t i s p as sed a s

pa r a me te r .

pu b l i c s t a t i c C o mp on en tCom man ds g e t C omp on en tCo m man ds

(A rray L i s t< St r in g > l i s t , S t r i ng co mpo n en tN am e)

Th is me t h od i s u s ed to g e t t h e a l l co mma nd s ( a s d e f in ed i n t h e

T a t j aM L d o cu me n t ) t o g e t h e r w i t h th e i r d e t a i l s o f a p a r t i cu l a r

co mp on e n t t h r o u gh an i n s t a n ce o f a C om p oen t Co m m an ds c l a s s .

54

T h e l i s t o f t ok en s o f t he w h o l e T a t j aM L d oc u men t an d th e

co mp on en t n a me a r e p as s ed a s p a r a me t e r s .

pu b l i c s t a t i c C o mm a ndC o nta in er g e t C omm and D et a i l s

(A rray L i s t<St r in g > t oken s , S tr in g co mm an dNam e)

Th i s me t ho d i s u s ed to g e t t h e d e t a i l s o f a p a r t i cu l a r co mp on en t

co m ma n d t h r o u g h a n i n s t an c e o f c l a s s C o m m a n dC o n ta in er . T h e

l i s t o f t o kens o f t h e p a r t i cu l a r co m po n en t a n d th e co m ma n d n a me

a r e p as s ed a s p a r ame t e r s .

pu b l i c s t a t i c Ev ent C on ta iner g e t Ev en tD eta i l s

( A rra yL i s t < St r i n g> t o ken s ,S t r in g e ve nt N a me)

Th i s me t h od i s u s ed to g e t t he d e t a i l s o f a de f in ed e ven t i n t h e

Ta j t aM L do cu me n t o f a p a r t i cu l a r co mp on en t t h r ou g h an i n s t ance

o f c l a s s E v e n t C o n ta in er . T he l i s t o f t ok en s o f t h e pa r t i cu l a r

co mp on en t and t h e n a me o f t h e ev en t a r e pa s s ed a s pa r a me t e r s .

pu b l i c s t a t i c A r r a y Li s t< S tr in g> ge t L i s t Of Al lC om p onen t s

(A rray L i s t< St r in g > t oken s )

Th i s me t h o d i s u s ed to g e t a l i s t o f a l l t h e d e f i ned co mp on en t s i n

t h e T a t j a M L d o c u men t . T h e l i s t o f t o k en s o f t h e w h o le T a t j a M L

do cu men t i s p as s ed a s p a r a me t e r .

5.4 Package dialogboxes Th i s pa ck ag e con s i s t s o f 1 3 J av a c l a s s e s . Th es e a r e :

• A s se r t D i a lo g B o x

• Co mmand Con s t r uc t io nD ia lo g Box

• D el ay D ia log Box

• L o adA p p l e tD i a lo g B ox

• Lo adT es t S u i t eD i a l o gBo x

55

• N ew Tes t S u i t eD i a l og Bo x

• P lay Cl as s D ia lo g Bo x

• P o in tP ick e rD ia lo g Box

• P reD ef i ned Co m ma n ds P an e l

• Re cor d e r T oo lP an e l

• T es t C k as s Ch o o s e r D ia l o g Bo x

• T es tM e th od Ch o os e r D ia l og B o x

• Tex tW i nd ow

A s t he n a me o f t h e pa ck age an d o f t h e c l a s s e s t h e ms e lv es i mp l i e s , t h e

r o l e o f t h e s e c l a s s e s i s t o p ro v i d e t h e r eq u i r e d d i a lo g b ox es to T A T J A .

T h es e d i a lo g b ox es a r e i mp l e me n t ed u s i ng t h e J av a S w i ng A P I .

5.5 Package helpers P ac k a g e h e lp er s co ns i s t o f 4 J av a c l a s se s . A s t he n a me o f t h e pa ck ag e

i mp l i e s , t he c l a s s e s th a t a r e s t o r ed in th i s p ack ag e a r e h e lp e r c l a s s es to

f o r T A T J A . T h e s e c l a s s es a r e :

• Co mp on en tCo m ma n ds

• M is c e l l an eo u s

• TA TJA Con so le

• Tes tH e lp e r s

Th e c l a s s C om p on en t C om m a nd s i s a s i mp l e i n f o r ma t ion p l a ce ho ld e r

c l a s s . I t i s u s ed to s t o r e t he a l l t he co mmand s t o g e th e r w i t h t h e i r

r eq u i r ed d e t a i l s o f a pa r t i cu l a r co mp on en t . Th i s c l a s s mak es u s e o f a

h as h t ab l e i n o r d e r t o map th e co mma nd n ame w i th a r e f e r en c e to a

D et a i l s C o n t a i n er ob je c t .

The c l a s s M i s c e l l a n eo us h a s a nu mb er o f s t a t i c me t h o d s t h a t p e r f o r m

v a r io us s i mp le bu t v i t a l o p e r a t io ns . S uc h o p e r a t io n in c lud es a pp en d i n g

56

in s t r uc t io n t o g en e r a t ed t e s t c a s es , c r ea t io n o f n ew J a v a me th o d s in a

t e s t c l a s s , an d mor e .

Th e c l a s s TAT JAConso l e i s a c l a s s t ha t ha s o n ly 2 s t a t i c me t ho ds .

Th es e a r e :

• pu bl i c s ta t i c vo id ru n Fi l e I nW eb Bro ws er

(S t r in g bro ws e r C on s t ant ,S t r in g f i l e Pa th )

• pu bl i c s ta t i c vo id r u n HT T PP ag eI n W eb B ro ws e r

( S tr in g bro ws e rC o n s t ant , S tr in g u r l )

Th es e 2 me t h o ds a r e u s ed to r un an H TM L pag e i n a s p ec i f i c w eb

b r o w s er b y e i t h e r s p e c i f y in g th e U R L o r e l s e s p e c i f y ing t h e ab s o l u t e

f i l e pa th o f whe re t he r e i s t he HT M L do cu men t . T h e s t r i n g p a r a me t e r s

b r o w s er C o n s ta n t a r e th e r e t o d e f in e t he na me / t y p e o f b ro w se r t o i n vo k e

s u ch a s ‘ I n t e r n e t E xp lo r e r 6 .0 ’ o r ‘ O pe r a ’ o r ‘ S a f a r i ’ . N o te t ha t i n

o r d e r t o b e a b l e t o u s e th e s e t w o me tho d s , s o me co n f ig u r a t ion d e t a i l s

h av e to be s e t up in t he con f i gu r a t io n f i l e

W eb B r o w s er C o n f i g s . p r o p e r t i e s . Mo r e on th e co n f ig u r a t i on f i l e s i n

s ec t i o n 5 . 7 o f t h i s ch ap t e r .

The Tes tHe lp er s c l a s s i s a f unda men t a l c l a s s i n TATJA. Th i s c l a s s and

s o me o f i t s pu b l i c me t ho d s a r e d e sc r i b ed in s o me d e t a i l s i n s e c t i on

5 .5 .1 .

5.5.1 Class TestHelpers C l a s s T e s t H e lp er s i s a f u n d a men ta l c l a s s b ec a us e i t i s u s e d to c on v er t

t h e co mma nd s a n d a c t io n s d e f ined in t h e T a t j aM L d oc u men t i n to r ea l

J av a a c t i on s dy n ami c a l ly . A s i t w a s ex p la in ed e a r l i e r i n Ch ap te r 3 , t h i s

i s do n e b y u s in g th e Jav a R ef l ec t ion A PI .

57

T h i s c l a s s co ns i s t s o f a n u m be r o f p r i v a t e a nd p ub l i c me t ho ds , h o w ev er

t h e mos t t w o f un da me n ta l me t h o ds a r e i n vo k eC o m m an d a n d

i n vo keE ven t . T h e s e me t ho ds a r e e x p la i n e d i n s o me d e t a i l b e lo w .

5 .5 .1 . 1 Met h od in vokeC om ma nd

pu b l i c O bj ec t in v okeC o m ma nd (Objec t co m p on en t , S t r in g inv oke ,

S t r in g r e tu r nTyp e , S t r in g [ ] p a ra ms ,

S t r in g [ ] a rg s , S t r in g co m m a n d P a ra m et ers ,

S t r in g c om man dArg u me n ts )

Th is me t ho d i s u s ed to i n v ok e a p a r t i cu l a r co mma nd on a p a r t i cu l a r

J av a A p p l e t co mp on en t . T he A p p l e t c o mpo n e n t o n w h i c h to i n v o ke th e

co mman d i s p as s e d a s a p a r a me t e r t h r ou g h th e a r g u men t c o m p o n en t .

T h e na me o f t he j av a me t ho d to i n v ok e in o r d e r t o e x e c u t e t h e c o mma n d

i s pa s sed a s a s t r i ng pa ra me te r t h ro ugh i n vo ke w h i l e t h e r e tu r n ty p e o f

t h e me t ho d i s pa s s e d a s a p a r a me t e r t h r ou g h a r gu men t r e tu rnType .

Th e a r gu me n t s o f t h e J av a me t h od s a re p as s ed a s t r i n g a r r ay pa r a me t e r

t h r ou gh a r g u men t arg s . I f t h e r e a r e an y p a r ame t e r s t h a t a r e p a s s ed by

th e u s e r , t h e a r gu me n t s a r e d e f in ed a s a co mma s ep a ra t ed s t r i n g a n d

p as s ed a s a p a r a m et e r t h r o u g h t h e a r g u me n t c om m a nd Ar g um e n t s . T he

r e spec t i ve v a lues o f t he l a t t e r a r e pa s sed a s a co mma sepa ra t ed s t r i ng

p a r a me t e r t h r o u gh a r g u men t com m a n dPa r a m et er s .

I f t he i n vo ked c o mman d r eq u i r e s r e tu r n ing a va lu e , t he va lue i s

r e tu r n ed t h r ou gh t he g e ne r i c c l a s s t y pe O b j ec t . T h e c o d e s n ip p e t b e lo w

s h ow s th e co mp u t a t io n th a t i s p e r f o r med b y th i s me t h o d in o r de r t o

i n v ok e a c o mma n d ( me t ho d ) o n a pa r t i cu l a r co mp o n en t . I n l in e

co mmen t s a r e i n c lu ded w i th i n t he s n i pp e t f o r c od e c l a r i f i ca t i o ns .

58

public Object invokeCommand(Object component,String invoke,String returnType,String[] params, String[] args,String commandParameters,String commandArguments){

Object ans = null; try{

//First create a class instance of the object component to //invoke command on

String className = component.getClass().toString(); className = className.substring(className.lastIndexOf(" ") +

1,className.length()); Class c = Class.forName(className); //Create the method to invoke Method m = c.getMethod(invoke,getParametersClasses(params)); Object[] arguments =

getConstructorArguments(component,args,params); //Merge arguments[] and args[] Object[] test = new Object[args.length]; for(int i = 0;i < test.length;i++){ if(arguments[i] == null){ test[i] = args[i]; }else{ test[i] = arguments[i]; } } arguments = fixArguments(test,commandArguments,params); ans = m.invoke(component,arguments); }catch(Exception e) { e.printStackTrace(); } return ans; }

C o d e S n i p p e t o f m e t h o d i n v o k e C o m m a n d f r o m c l a s s T e s t H e l p e r s

5 .5 .1 . 2 M et h o d in voke Ev en t

pu b l i c v o i d in v o ke Ev en t (O b jec t co mp on en t ,S t r in g l i s t e n er ,

S t r i n g inv oke , S tr i n g p a s sO b jec t , S t r in g [ ] p ara ms ,

S tr i n g [ ] a rgs , S tr i n g ev en t Pa ram et e rs , S t r i ng ev e n tAr gu m en ts )

Th i s me t h o d i s u sed t o c r ea t e an d in vo ke a pa r t i c u l a r ev en t o n a

pa r t i cu l a r J ava Ap p le t co mponen t . The App le t co mp o nen t i s pas sed a s

p a r a me t e r t h r o ug h a rg u men t co m po nen t . I n o r d e r t o g en e r a t e a J av a

ev en t , an e v e n t l i s t en e r h a s f i r s t t o b e in i t i a t e d . T h e n a me o f t h i s ev en t

i s pa s s e d a s p a r a met e r t h r o ug h l i s t en er w h i l e t h e n a me o f t he me tho d to

i n v ok e on t he ev en t l i s t e n e r i s p as s ed t h r ou g h a r gu men t i n vo ke .

59

T h e n a me o f t he e ve n t o b j e c t t h a t i s p as s ed t o t he c o mp o ne n t i s p as s ed

a s p a r a me t e r t h r o ug h th e a r g u me n t p a s s O b je c t . A s t r i n g a r r ay w i th t he

a r g u men t s t o p as s t o t he e v en t o b j e c t i s p a s s e d a s p a r a me t e r t h r o u gh

a r gs w h i l e t h e i r r e s p ec t iv e v a l u es a r e p a s se d th r o u gh pa ram s . I f t he r e

a r e an y pa ra me t e r s t ha t a r e p as s ed by th e us e r , t h e a r gu me n t s a r e

d e f in e d a s a c o mm a s ep a r a t ed s t r i ng an d p as s e d a s a pa r a me t e r t h r o u gh

th e a r g u me n t even tArgume n t s . T h e r e s p e c t i v e v a l u es o f t h e l a t t e r a r e

p as s ed a s a co m ma s e p a r a t ed s t r i n g pa r a me t e r t h r ou gh a r g u men t

e v en tP a r am et er s .

T h e co d e s n ipp e t b e lo w s h ow s th e c o mp u t a t io n tha t i s p e r f o r me d by th i s

me t h od i n o r d e r t o c r e a t e a nd i n v ok e a n ev e n t on a pa r t i cu l a r

co mp o n e n t . I n l i n e c o m me n t s a r e i n c l ud ed w i th in th e s n i pp e t f o r co de

c l a r i f i c a t i on s .

60

public void invokeEvent(Object component,String listener,String invoke,String passObject, String[] params,String[] args,String eventParameters,String eventArguments){ try{ //First create object to get Class event = Class.forName("java.awt.event." + passObject); //Get constructor parameters Class[] constParam = getParametersClasses(params); //Get constructor arguments Object[] arguments =

getConstructorArguments(component,args,params); arguments = fixArguments(arguments,eventArguments,params); //Create event constructor Constructor constructor = event.getConstructor(constParam); //Create an instance of the event and pass to it the

//constructor arguments Object object = constructor.newInstance(arguments); // Create a listener type Class c = Class.forName("java.awt.event." + listener); //Get an array with all the listener types of the component //...first create a class type String className = component.getClass().toString(); className = className.substring(className.lastIndexOf(" ") +

1,className.length()); Class temp = Class.forName(className); //...then create the method to get the listeners Method method = temp.getMethod("get" + listener + "s",null); EventListener[] listeners =

(EventListener[])method.invoke(component,null); // Create the event method to invoke method = c.getMethod(invoke,event); // Invoke the method on each event listener for(int i = 0;i < listeners.length;i++){ method.invoke(listeners[i],object); } }catch(Exception e){ e.printStackTrace(); } }

C o d e S n i p p e t o f m e t h o d i n v o k E v e n t f r o m c l a s s T e s t H e l p e r s

5.6 Package tatja P ac k a g e t a t ja con s i s t s o f 4 c l a s s es . Th es e a r e :

• A pp le t T e s t e r

• Co n s t an t s

• Re cor d e r H and l e r

• Tes tP l ay H a nd l e r

61

A s i t s n a me i mp l i e s , c l a s s Co n s t a n t s i s a s i mp l e c l a s s w i t h so me

co n s t an t s d e t e n t io n s . H o w ev er t he o t he r t h r e e c l a s s e s a r e f un da me n ta l

c l a s s es a n d can b e d e f in e d a s t h e ‘ he a r t ’ o r t h e en g i ne th a t d r i ve s t h e

w h o l e t e s t au t o ma t io n too l . Th es e c l a s s es a r e d e f i n ed in t h e n ex t t h ree

s ec t io ns .

5.6.1 Class AppletTester C l a s s Ap p le tT es t e r i s t h e ma i n c l a s s o f t h i s t e s t au t o ma t io n t o o l . A s

ex p l a in ed i n t h e p r e v io u s c h ap t e r s , i t i s a J av a A p p l e t t ha t w r ap s in i t

an o th e r A pp le t – t h e A p p l e t t o b e t e s t e d .

A p ar t f r om p r o v id in g th e w r ap p ing me c h an i s m a n d th e G U I o f T A T J A ,

th i s c l a s s p e r fo r ms a l o t o f fu n c t io n a l i t y . A l l t h e ev en t h an d l ing o f t he

to o l i s p e r f o r med by t h i s c l a s s . F ig u r e 17 s h ow s a s c r e en s ho t o f

TA T J A wh en ex ecu ted us in g S un ’ s A pp le t V i ew er . A t t h e to p p a r t o f

t h e ap p l i c a t i on th e r e i s t h e t abb ed to o l b a r . O n e o f t h e t abs i s f o r

r eco r d in g mo d e w h i l e t h e o t he r on e i s f o r p l ay b ack mod e . The r e s t o f

t h e a r ea i s l e f t s o t ha t t h e A p p le t t o b e t e s t ed c an b e lo a ded th e re .

Figure 17: A screen shot of TATJA in Sun's Applet Viewer

62

5.6.2 Class RecorderHandler When t he u se r c l i ck s on t h e r eco rd i con , t he Record erHand ler co mes

in to a c t io n . T h i s c l a s s i s u sed by TA TJ A in a l l t h e r eco rd in g p ro ces s .

W h en t h i s c l a s s i s i n i t i a t e d , i t f i r s t c r e a t e s a h as h t a b l e w i t h a l l t h e

co mp o n e n t s t h a t a r e p a r t o f t h e A pp le t t o b e t e s t ed . T h e co mp on en t s

a r e g iv e n a u n i qu e id en t i f i c a t ion na me . I f t h e co mp o n en t s d o no t h av e

an id en t i f i c a t io n n a me , t h ey a r e g iv en an i d en t i f i c a t io n n a me by the

o r d e r o f h o w t he c o mpo n e n t s w er e ad ded t o t he A p p le t t o b e t e s t ed

d u r in g i t s d ev e lo p me n t p r o c es s .

C l as s R e co r d e r H a n d l er t a k es a l s o th e c o n t r o l o f t h e to o l ’ s G U I

in t e r f ace du r in g t he r eco rd in g p r oces s . D ur ing t h i s p r oc es s , t h i s c l a s s

man i pu la t e so me o f t h e co mp o nen t ’ s p r op e r t i e s i n o r de r t o mak e the m

h ig h l i gh t w h en th e u s e r i s r eco r d in g a p a r t i c u l a r a c t i o n on t he m. T h e

Re co r der H a nd le r c l a s s h as a l s o me t h o d s th a t mak e us e o f t h e

D ef en i t i o ns D r iver c l a s s t h a t i s de f in ed in t h e d e f en i t i o n sd r i v er

p ack ag e . Th es e me t ho ds a r e ab l e t o ge t a l l t h e n a mes o f t h e ac t i on s

th a t c an b e p e r f o r med o n e a ch pa r t i cu l a r c o mp o ne n t t og e th e r w i th th e

n eces s a ry d e t a i l s o f each ac t io n . Th es e d e t a i l s a r e d i s p l ay ed in a t a i l o r

mad e d i a l o g b ox f ro m w h i ch th e u s e r c an de c id e w h ich a c t ion to r e co r d

w h en th e us e r p l a ces th e mo u s e po in t e r o n a pa r t i cu l a r co mp on en t a s

s h ow n i n F ig u r e 18 .

63

Figure 18: A screen shot of TATJA with the mouse pointer on a component and with the Record Dialog Box Visible

T h e u s e r c an c l i c k o n an y o f t h e a va i l ab l e a c t io n s o f e ach co mp o n en t

an d R eco r de rH a n d l er w i l l gen e r a t e a l l t h e n e ces s a r y J av a co d e . T h i s

g en e r a t ed c od e c an th an b e e x e cu t ed an d p l ay b a ck in o r d e r t o ru n t h e

r eco r ded t e s t c a s es by us in g th e o th e r c l a s s o f t h e t a t ja pack ag e – t h e

T es t P la yH an d ler c l a s s .

5.6.3 Class TestPlayHandler C l a s s T es tP la yH an d ler i s u sed i n o rde r t o p l ay back t he r eco rded t e s t

c a s es . W h e n th i s c l a s s i s i n i t i a t ed , i t f i r s t i d en t i f i e s an d s to r e s i n a

h as h t ab l e un iq ue l y ea c h c o mp o nen t t h a t ma kes u p t h e A pp l e t t o b e

t e s t ed . By h av ing a hash t ab l e t h a t map s each un iq ue na me to i t s

co mp o n e n t , by u s ing s o me o f i t s me t ho ds , T es tP la yH an d ler c a n e x ecu t e

64

an d p l ay ba ck th e r eco r d ed t e s t c a s e s a s i f ex ecu t i ng a co n ven t i o n a l J av a

me t h od .

5.7 TATJA Configuration files TA T J A req u i r e s 3 co n f ig u r a t i on f i l e s i n o r de r t o b e ab l e t o o pe r a t e

co r r e c t l y . T h e s e co n f i g u r a t i o n f i l e s shou ld be p l ac e s i n t h e fo lde r

n a me d r e s o u r ce s a t t he roo t o f t he d i r ec to ry o f t he App le t p ro j e c t t ha t

i s be in g t e s t ed . T h ese co n f ig u r a t i on f i l e s a r e :

• D ef a u l tCo mp o ne n t s . c s v

• D ef i n i t i o ns . x ml

• W eb B r o w s erC o nf ig s .p r o pe r t i e s

The D ef au l tCo m po nen t s . c s v f i l e i s a f i l e t h a t h as a l i s t ( co mm a

s ep a r a t e d ) o f a l l t h e J av a S w in g n a t i v e co m po n en t s s uch a s JBu t ton ,

JT e x tF i e l d , a nd mo r e . T he r ea s on b e h i nd th i s co n f ig u r a t i on f i l e i s s o

th a t T A T J A w i l l kn o w i f a pa r t i cu l a r co mp o n en t i s a n a t i v e S w i ng

co mp o n e n t o r e l s e i t i s a t a i l o r mad e co mp on en t ex t en d i ng f r o m a

n a t i v e o n e .

The D e f i n i t i o n s . x m l f i l e i s a v e ry imp o r t an t f i l e . Th i s f i l e h a s i n t he

a l l t he T a t j a M L d e f in i t i o n s . W i th o u t t h es e d e f in i t i o n s T A T J A w i l l n o t

b e ab l e t o r e co r d a n y t e s t c a s es .

Th e l a s t co n f ig u r a t io n f i l e i s t h e W e b B r o ws e r C o n f ig s . p ro p er t i e s . T h i s

co n f i gu r a t io n f i l e i s u s ed b y th e tw o me t h o d s o f c l a s s TAT JAConso l e .

S in ce th es e tw o me t h od s in v ok es d i f f e r e n t w eb b r ow s er s , t h e s h e l l

co mman d s t ha t i nv ok es a nd lo a ds th e b r o w s er s ( O per a t ing S y s t e m

s p ec i f i c ) a r e s t o r e d in t h i s co n f ig u r a t io n f i l e .

65

5.8 Summary I n t h i s c h ap t e r t h e i mp l e men t a t io n d e t a i l s o f t h e s y s te m a r e d i s cu ss e d .

A d es c r i p t i o n i s g i v en f o r e a c h p ac k ag e . A d esc r ip t i o n i s a l so g iven t o

s o me f u nd a me n t a l c l a s s es an d a l s o to s o me i mp or t a n t me th o d s . A n

ex p l an a t i o n i s g iv e n f o r ea ch co n f ig u r a t io n f i l e t h a t i s u s ed b y TA T J A .

66

Chapter 6 Testing and Evaluation 6.1 Testing Strategy W hi te bo x a n d b la c k bo x t e s t i ng a r e ap p l i ed o n TA TJ A . E ach

co mp o n e n t o f T A T JA i s d ev e lo p e d and t e s t ed o n i t s o w n . W h er e

ap p l i ca b l e u n i t t e s t s a r e c a r r i e d o u t .

I n t eg ra t i on t e s t i n g fo l l ow s a f t e r co mp on en t t e s t i n g to t e s t i f t h e

d i f f e r en t mo d u l es s t i l l f u n c t io n co r r ec t l y a f t e r b e i n g i n t e r f a c e d w i t h

e a ch o t h e r . F in a l l y sy s t em a n d a c c ep t an ce t e s t i n g a r e c a r r i e d o u t t o

ch eck i f t he s y s t e m h as me t t h e s p e c i f i c a t io n s i t w a s d es ig n ed f o r a n d

to s e e i f t h e s y s t e m i s p e r f o r mi n g w e l l o ve r - a l l .

A f t e r t h e t e s t i ng p ro ces s , t h r ee t e s t c a s es o n r ea l A pp l e t s a r e p e r fo r me d

to ev a lu a t e t h e sy s t e m. Th e s e t h r ee A p p le t s a r e :

1 . A D at a C lu s t e r in g S i mu l a t io n A p p le t

2 . A C ar L o an C a l cu l a to r A p p l e t

3 . A F r i c t i o n le s s S lo pe S i mu l a t io n A pp le t

I n t he ne x t t h r ee s ec t i ons o f t h i s chap t e r e ach t e s t c a s e i s exp l a i ned i n

s o me d e t a i l .

67

6.2 Test Case 1 – A Data Clustering Simulation Applet The D a ta C lus t e r in g S im u la t i on A p p le t i s a J ava App le t t h a t i s u sed t o

s i mu la t e a n u mb er o f da t a c lu s t e r i n g me th o d s . T h e us e r c r e a t e s a

n u mbe r o f n o des b y c l i c k in g o n th e g r ey pane l . A f t e r s e l e c t ing t he ty pe

o f c lu s t e r i ng a lg o r i th m t o u s e , t h e u s e r sh o u l d c l i ck on th e s t a r t bu t t on

to s t a r t t h e s i mu l a t io n p r o c e s s . E a c h t i me t ha t t h e u s e r c l i ck s o n th e

n ex t bu t t o n th e A pp le t g r o u ps a ne w c l us t e r u n t i l a l l t h e c r e a t e d no d e s

a r e c l u s t e r ed in to o ne g r ou p . F i gu r e 1 9 i s a s c r e e n s h o t o f t h i s A pp le t

i n Su n’ s A pp le t V i ew er A pp l i ca t i on .

Figure 19: A Screen Shot of the Applet to be tested in Sun’s Applet Viewer

6.2.1 Test Case Design 6 .2 .1 . 1 R e co rd Ou t l in e

1 . Load TA T JA in F i r eF o x

2 . L o ad th e A pp le t t o t e s t i n T A T J A ( Re co r d in g M od e)

68

3 . Cr ea t e a t e s t c l a s s – Cl us S i m T es t

4 . Re cor d th e fo l l ow i n g t e s t c a s e i n a me t ho d n ame d T es t C as e 1 :

i . G en er a t e 1 0 r a nd o m no des i n t he g r e y pane l .

i i . S e l e c t a S ing l e A gg lo m er a t i ve C lu s t e r ing as c l u s t e r i ng

a l go r i th m f r o m th e c lu s t e r in g me t ho d co mb o b ox .

i i i . G en er a t e a c l i c k e v e n t o n t h e S ta r t bu t to n , an d th en

s u bs eq u e n t ly on t he N e x t bu t to n un t i l a l l t h e n o d e s a r e

c l u s t e r e d in to o n e w h o le g r o u p .

6 . 2 .1 . 2 P la y b a ck Ou t l in e :

1 . Load TA T JA in F i r eF o x

2 . Lo ad th e A pp le t t o t e s t i n T A T J A ( P lay back M o de )

3 . Lo ad th e c l a s s an d me t ho d w i th th e r eco r ded t e s t c a s e .

4 . P lay back th e t e s t c a s e .

5 . Repea t t he p l ay back p roce s s on Sa fa r i .

6.2.2 Test Case Execution A s i t i s o u t l i n ed i n s ec t i o n 6 .2 .1 TA TJ A i s ex ecu t ed in F i r e fo x and th e

A p p l e t t o b e t e s t e d i s l oad ed . A new t e s t c l a s s na me d Cl us S i m T es t and

a n ew t e s t c a s e ( me th o d) T e s t Ca s e1 a r e c r ea t e d a s s ho w n in F i gu re 2 0 .

69

Figure 20: A screen shot with the Clustering Simulation Applet loaded in TATJA on Firefox

Th e t e s t c a se i s r eco r d ed a s o u t l i n ed in 6 . 2 . 1 . 1 an d th e r equ i r ed co de i s

g en e r a t ed a s s h ow n i n th e c o d e s n i pp e t be lo w :

public class ClusSimTest extends tatja.TestPlayHandler{ public ClusSimTest(JApplet test,Map<String,Component> map){ super(test,map); } public void TestCase1(){ // TATJA Generated TestCase1 Random randomGenerator = new Random(); for(int i = 0;i < 10;i++){ String s = "ClustersPanel1.singleClick(" + (randomGenerator.nextInt(770) + 1) + "," + (randomGenerator.nextInt(345) + 1) + ")"; runCommand(s); } runCommand("JButton1.click()"); while((Boolean)runCommand("JButton2.isClickable()")){ runCommand("JButton2.click()"); } }// TATJA end of TestCase1 } // End of TATJA generated class

70

Th e r e co rd ed t e s t c a s e w as p l ay b ack ed b o t h o n F i r e fo x an d on S a fa r i .

F ig u r e 2 1 i l l u s t r a t e s t h e ex e cu t ed t e s t c a s e o n S a f a r i .

Figure 21: A screen shot of the executed test case on Safari

6.3 Test Case 2 – A Car Loan Calculator Applet

The Ca r L o an C a l cu la t or i s a s i mp l e Ap p le t t h a t i s u s ed to ca l cu la t e a l l

t he r e l ev an t d e t a i l s t ha t a r e r equ i red when t ak en a l oan i n o rde r t o

pu rchas e a c a r . Th i s App le t an d i t s cod e a r e av a i l a b l e on l i n e [2 4 ] .

F ig u re 2 2 i l l u s t r a t e s a s c r een s h o t o f t h i s App le t a s v i ew ed o n S u n’ s

A p p l e t V i ew er .

71

Figure 22: A screen shot of the Car Loan Applet Calculator as executed in Sun’s Applet Viewer

6.3.1 Test Case Design 6 .3 .1 . 1 R e co rd Ou t l in e

1 . Lo ad T A T J A in Ope r a

2 . L o ad t h e A pp le t t o t e s t i n T A T J A ( R e co r d in g M o de)

3 . Crea t e a t e s t c l a s s – L o ad Ca lcT es t

4 . Reco rd t he fo l l owi ng t e s t c a se i n a me thod n amed T es t C a se1 :

i . S e t t h e f o l lo w i n g d a t a a n d t he n c l i ck o n c a l c u la t e : Cost of Car $ 4535

Cash in hand $ 3465

Length of Loan 24 Months

Yearly Interest Rate 4.6%

Sales Tax Rate 1.0%

6 .3 .1 . 2 P la y b a ck Ou t l in e :

1 . Lo ad T A T J A in Ope r a

2 . Lo ad t h e A pp le t t o t e s t i n T A TJ A ( P lay b ack M o d e)

3 . Lo ad t h e c l a s s an d me th od w i t h th e r eco r d ed t e s t c a s e .

4 . P lay back t he t e s t c a s e .

5 . R ep e a t t h e p l a y b ac k p r oce s s o n I n t e r n e t E x p l o r e r .

72

6.3.2 Test Case Execution A s ou t l i n ed i n s ec t i on 6 . 3 . 1 , t he A p p l e t i s l o ad ed i n TA TJ A on Op er a a s

a w eb b r o w se r . A t e s t c l a s s na me d L oa n CalcT e s t an d t e s t c a s e na med

T es t Ca s e 1 a r e c r ea t ed a s s h o w n in F ig u re 2 3 be lo w .

Figure 23: A screen shot with the Car Loan Calculator Applet loaded in TATJA on Opera

Th e t e s t c a s e i s r eco r ded a s ou t l i n ed an d th e r equ i r ed co de i s g en e ra t ed

a s s ho w n in th e c o d e sn ip p e t be l ow :

public class LoanCalcTest extends tatja.TestPlayHandler{ public LoanCalcTest(JApplet test,Map<String,Component> map){ super(test,map); } public void TestCase1(){ // TATJA Generated TestCase1 runCommand("JTextField1.type(4535)"); runCommand("JTextField2.type(3465)"); runCommand("JTextField3.type(24)"); runCommand("JTextField4.type(4.6)"); runCommand("JTextField5.type(1.0)"); runCommand("JButton1.click()"); }// TATJA end of TestCase1 } // End of TATJA generated class

73

Th e r e co r d ed t e s t c a s e w as p l ay b ack ed b o t h o n O p era an d o n I n t e r n e t

Exp lo r e r . F igu re 24 i l l u s t r a t e s t he ex ecu t ed t e s t c a se o n Oper a .

Figure 24: A screen shot of the executed test case on Opera

6.4 Test Case 3 – A Frictionless Slope Simulation Applet The F r i c t io n l e s s S lo p e S i m u la t io n A pp le t i s o n e o f a s e r iou s o f

s i mu la t io ns A pp le t s av a i l ab l e o n M r D a mi en M ar t in ’ s ( U n i ve r s i t y o f

C a l i f o r n i a a t D a v i s ) w eb s i t e [2 5 ] . T h e A p p le t a nd i t s c o de a r e

av a i l ab l e o n [26 ] . I t i s u s ed to by s tud en t s t o sho w th e phy s i c s beh ind

an o b j ec t mo v i ng d ow n a s lo pe . F ig u r e 2 5 i l l u s t r a t e s a s c r e en s ho t o f

t h i s A pp l e t a s s ho w n o n S un ’ s A p p l e t V iew er .

74

Figure 25: A screen shot of the Frictionless Slope Applet as executed in Sun’s Applet Viewer

6.4.1 Test Case Design 6 .3 .1 . 1 R e co rd Ou t l in e

1 . L o ad T A T JA in N e t s c ap e N av ig a to r

2 . Lo ad th e A pp le t t o be t e s t ed in T A TJ A ( Reco r d in g M o de )

3 . Cr e a t e a t e s t c l a s s – S lop eT es t

4 . Re cor d th e fo l l ow i n g t e s t c a s e i n a me tho d n ame d T es t C as e 1 :

i . S e t t o s lo pe t o b e a t 3 0% .

i i . S e t t h e ‘ show ne t f o r ce ’ and ‘ show fo rce s fo r su mmi n g’

c h e ck b o x es s e l ec t ed .

i i i . S t a r t t h e s i mu la t io n .

i v . A f te r 3 s eco nd s se t t h e v e lo c i t y r ad i o bu t to n .

v . A f te r 3 s eco nd s se t t h e p os i t i o n r ad i o bu t to n .

v i . A f te r 5 s eco nd s c l i ck on t h e r e s e t b u t ton .

75

6 .3 .1 . 2 P la y b a ck Ou t l in e

1 . L o ad T A T JA in N e t s c ap e N av ig a to r .

2 . Lo ad th e A pp le t t o t e s t i n T A T J A ( P lay back M o de ) .

3 . Lo ad th e c l a s s an d me t ho d w i t h t he r eco rded t e s t c a se .

4 . P lay back th e t e s t c a s e .

5 . Cr e a t e a s i mp l e T e s t S u i t e t o b e ab l e t o au t o ma t i c a l ly ex e c u te t h e

g e n e r a t ed t e s t c a s e .

6 . Ex ecu t e t he T es t S u i t e on I n t e r ne t Ex p l o r e r an d N a t s c ap e

N av ig a to r .

6.4.2 Test Case Execution Th e A pp l e t i s l o ad ed on N e t s cap e N av i g a t o r a s a web b r ow s e r . A t e s t

c l a s s na med S l op eT es t an d t e s t c a s e n a med T es tC as e 1 a r e c r ea t ed a s

s h ow n i n F ig u r e 26 b e l ow .

Figure 26: A screen shot with the Frictionless Slope Applet loaded in TATJA on Netscape Navigator

76

Th e t e s t c a s e i s r eco r ded a s ou t l i n ed an d th e r eq u i r ed co de i s g en e ra t ed

a s s ho w n in th e c o d e sn ip p e t be l ow :

public class SlopeTest extends tatja.TestPlayHandler{ public SlopeTest(JApplet test,Map<String,Component> map){ super(test,map); } public void TestMethod1(){ // TATJA Generated TestMethod1 runCommand("JSlider1.setPosition(30)"); runCommand("JCheckBox1.click()"); runCommand("JCheckBox3.click()"); runCommand("JButton1.click()"); try{ Thread.sleep(1000 * 3); }catch(InterruptedException e){ } runCommand("JRadioButton2.click()"); try{ Thread.sleep(1000 * 3); }catch(InterruptedException e){ } runCommand("JRadioButton3.click()"); try{ Thread.sleep(1000 * 5); }catch(InterruptedException e){ } runCommand("JButton1.click()"); }// TATJA end of TestMethod1 } // End of TATJA generated class

T h e r e co r d ed t e s t c a s e i s p l a y b ac k e d o n N e t s c a p e N av ig a t o r . F i g u r e 2 7

s h o w s a s c r e en s h o t o f t h e e x e c u t ed t e s t c a s e .

77

Figure 27: A screen shot of the executed test case on Netscape Navigator

A f t e r t h e ab o v e i s ex ecu t ed , a t e s t s u i t e o f t h e a b o v e t e s t c a s e i s

c r e a t ed a n d e x ecu t e d o n I n t e r n e t E x p lo r e r an d N e t sc ap e N a v ig a t o r .

6.5 Summary I n t h i s ch ap t e r a b r i e f d es c r ip t io n o f t h e t e s t i n g ca r r i ed ou t o n th e t o o l

i s g iv en . The too l i s t e s t ed w i t h t h r e e d i f f e r en t w or k i ng Ap p le t s . The

r e s u l t s o f t h e t h r ee t e s t c a s es pe r f o r me d o n t h es e A p p le t s a r e r ep o r t e d

in t h i s ch ap t e r . The t e s t c a s es w e r e ex ecu t ed o n fo u r d i f f e r en t w eb

b r o w s er s : M ic r o s o f t I n t e r n e t E x p lo r e r , M oz i l l a F i r e f o x , S a f a r i ,

N e t s c ap e N a v i g a t o r a n d O p e r a .

78

Chapter 7 Conclusions and Future Work T h i s d i s s e r t a t i o n i s c on c lu d e d b y d i scu s s i ng t he r e s u l t s o b ta in e d in t h e

p r e v i ou s ch ap t e r – T e s t in g an d E v a l u a t io n . I n v i ew o f t h es e r e s u l t s ,

s o me i mp r o v e me n t s on th e t e chn iq u e u s ed a n d s o me s ug ge s t i o ns a r e

p r e s en t ed .

7.1 Summery of Results Th e to o l ha s b een t e s t ed w i t h ex i s t i n g J av a A p p l e t s o f d i f f e r en t t y p es .

I n C ha p t e r 6 , T A TJ A w as t e s t ed o n th r e e w o r k in g A pp le t s t h a t be t w e e n

th e m t h e y co v e r t h e t y p e o f co mp o n en t s t h a t a r e u s e d in J av a A p p le t s .

T h e t e s t i ng t oo l w as a l s o t e s t e d o n v a r io us w e b b r o w s er s t o mak e s u r e

t h a t t h e r e a r e n o b r o w s er i s s u es t h a t c an ma k e T A T J A no t p e r f o rmi n g a s

ex p ec t ed .

T h e d es i r ed f un c t i on a l i t y o f t h e to o l w as o b ta in ed . T h e t e s t i ng to o l

a l s o g av e t h e e x p ec t e d r e s u l t s f o r a l l t he t e s t c a ses c a r r i ed ou t . I t c an

th u s b e co n c lu d ed th a t a l l ob j ec t iv es s e t f o r t h i s p r o j e c t w e r e

succes s fu l l y ach i eved .

7.2 Future Work and Research A l t ho ug h th e to o l w as su cc es s fu l ly imp l e me n t ed and a l l t h e ob j ec t iv es

s e t f o r t h i s p r o j e c t w er e s u c c e s s f u l ly a ch i ev ed , o b v i o u s l y t h e r e i s r o o m

f o r i mp r o v e me n t i n o r d e r t o ma k e t h e t o o l mor e u s a b l e . W i th t h e

cu r r en t s t a t e o f t he to o l t h e r e i s n ’ t a me ch an i s m t o che ck th e sy n tax

79

an d th e s e man t i c s o f t he T at j aM L d oc um en t . S in ce u s e r s o f TAT J A can

h av e th e i r o w n cu s to m m ade T at j aM L d ocu men t an d t h ey can a l s o add

mor e d e f i n i t i o ns to t h e ex i s t i ng do cu me n t , I t h i nk th a t i s w o u ld b e o f a

g r e a t a s s i s t an t t o t h e u s e r s o f T A T JA i f t h e to o l w i l l hav e a f un c t i on t o

ch eck th e sy n t ax a n d s e man t i c s o f t h i s i mp o r t an t d e f in i t i o n d o c u me n t .

Cu r r en t l y a u se r c an p l ayback a t e s t c a se t ha t was r eco rded fo r a

p a r t i cu l a r A p p le t on a d i f f e r en t A p p le t . A l th ou g h th i s op e r a t i on d oe

n o t c r a s h o r do an y h a r m t o t h e s y s t e m a n d t o t h e A p p l e t s b e in g t e s t e d ,

I t h i nk t h a t T A T J A s ho u l d b e ab l e t o r eco g n i s e t h e A p p l e t on w h i c h t o

run a pa r t i cu l a r t e s t c a se . I f t he r e w i l l be an i mpr oved ve r s ion o f

T A T J A , th i s i s s u e s h o u l d b e t a ck ed w i t h p r io r i t y .

A p os s ib l e r e s e a r c h th a t c a n l ead to an i mp r o ve me n t o n th e t o o l i s i n

t h e w a y t ha t T A T J A u n iqu e l y id en t i f i e s e a ch co mp o n e n t o f t h e A pp le t

t o b e t e s t e d . W i t h t h e cu r r en t s y s te m, i f s o meo n e r e mo v es an d a d d s

s o me co mp o n en t s t o t h e A p p le t t o b e t e s t e d , i t mi g h t b e t h ee c a s e t h a t

s o me o f t h e co mp o n en t s w i l l b e co n s t r a in e d to c h a ng e th e i r

i d en t i f i ca t io n n a me , r e s u l t i ng i n s ome o f t h e p r ev io u s ly r eco rd ed t e s t

c a s es t o b e i r r e l ev an t .

7.3 Conclusion T h i s p r o j e c t h a s g iv en me t he o p po r t un i ty t o l e a r n mor e ab o u t s o f t w ar e

t e s t i n g – a p r ac t i c e t ha t i s ga in ing mor e po p u la r i t y a s s o f t w ar e c l i en t s

a r e a cc e p t i ng mo r e r ob us t an d r e l i ab l e p r o d uc t s f r o m th e s o f t w ar e

in d us t r y .

Th i s p ro j e c t h as a l so a l l o we d me to i mpr ov e my s k i l l s a s r eg a rd s t o t h e

o b j e c t - o r i e n t e d p a r ad ig m es p e c i a l ly in t he a r e a o f d es i g n . I a l s o l e a r n t

n ew t e ch n o lo g i e s su ch a s t he R ef l e c t io n A P I , w h ich I w as to t a l ly

u na w are o f , p r io r t h e c o m men ce men t o f t h i s p r o j e c t .

80

Th e ex p e r i en ce o f r e sea r ch , de s ign in g , i mp l eme n t ing , an d do cu me n t in g

a p r o j ec t o f t h i s s i ze has p r ov ed to be a l so an ex e r c i s e i n p ro j e c t and

t i me man ag e men t – a s k i l l t h a t f o r s u r e i s r e qu i r ed b y e a ch an d e ve r y

I T pe r s o n th a t w or ks in i nd us t ry .

81

References [ 1 ] P r es s me n , R . S . & I nce I . S o f t w ar e E n g in e er in g : A P r ac t i t i o n er ’ s

Approach . McGr aw - H i l l , 20 00 .

[ 2 ] D ou g l as Be l l . S o f twar e E n g ine er in g : A P r ogr a m m i ng A p pr o ac h .

A dd i so n -Wes l ey , 20 00 .

[ 3 ] G len fo r d J . My er s . T h e A r t o f So f t wa r e T es t in g (2 n d Ed i t i o n ) . J o hn

Wi ley & S on s , 2 004 .

[ 4 ] E l f r i ed e D us t in . E f f e c t i ve S o f t w a re T es t i n g : 5 0 S p ec i f i c W a ys T o

I m p r ove Y o u r T es t i ng . A dd i s o n W es l e y , 2 0 02 .

[ 5 ] W W W . Web T es t T o o l s .

h t tp : / /w w w .s o f tw ar eq a t e s t . c o m/ q a t w eb1 . h t ml # OT H ER

[6 ] WWW . Jaka r t a Cac tus

h t t p : / / j aka r t a . ap ache . o rg / cac tu s /

[ 7 ] WWW .

h t tp : / / f o r mf l o od . s o u r ce f o r g e . n e t /

[ 8 ] WWW . Ht ml U n i t .

h t t p : / / h t ml u n i t . s o u r c e f o r ge .n e t /

[ 9 ] WWW . Ht tp U ni t Ho me .

h t tp : / /w w w .h t t pu n i t . o r g /

82

[10 ] WWW . JMe te r .

h t t p : / / j aka r t a . ap ache . o rg / j me t e r /

[ 11 ] WWW .

h t t p : / / ma xq . t i g r i s . o r g /

[ 12 ] W W W . Web A pp l i c a t io n Lo a d , S t r e s s & P e r f o rma n c e T e s t in g .

h t tp : / /w w w . l oa d t e s t in g t oo l . c o m/

[ 13 ] W W W . S e l e n iu m.

h t t p : / / s e l en iu m. o p enq a . o r g /

[ 14 ] WWW . iMac ros .

h t t p : / /w w w . i op u s . c o m/ i ma c r o s /w eb - t e s t in g . h t m

[15 ] WWW iOpus .

h t tp : / /w w w . i op u s . c o m/

[ 16 ] W W W . Ex ten s ib l e M ar ku p L a ng u a ge ( X M L ) .

h t tp : / /w w w .w 3 . or g / X M L/

[17 ] WWW . W3 C Math H o me .

h t tp : / /w w w .w 3 . or g / M a th /

[ 18 ] WWW . Th e G rap h M L F i l e F o r ma t .

h t t p : / / g r a p h ml . g r a p h dr aw in g . o r g /

[ 19 ] WWW . Mus i cXML Def in i t i o n .

h t tp : / /w w w . r ec o r da r e . co m/ x ml .h t ml

[ 20 ] W W W . Re f l ec t i on ( co mp u t e r s c i e nc e ) .

h t t p : / / en . w i k i p ed i a . o r g /w ik i /R ef l ec t i o n _ % 2 8 co mp u t e r _ s c i e n ce % 2 9

83

[ 21 ] W W W . Tr i a l : T h e R ef l e c t io n A P I .

h t t p : / / j a v a . s u n . co m/ d o c s /b o o ks / t u to r i a l / r e f l e c t /

[ 22 ] WWW . OO PS LA 20 03 .

h t tp : / /w w w .o o ps l a . o r g /o o ps l a 20 03 / f i l e s / t u t - 2 7 . h t ml

[ 23 ] D e i t e l H . M . , D e i t e l P . J . & G o ld be r g A . B . I n t e r n e t & W o r ld

Wide W eb : H ow T o Prog ram . P r en t i c e H a l l , 2 0 04 .

[ 24 ] WWW . Ca r Loan Ca l cu l a to r .

h t t p : / / ma in l in e .b r y n maw r . e d u /C ou r s e s / c s 1 10 / s p r i ng 20 0 2 /A p p le t s /

Ca rLo an / Car Lo an . h t ml

[ 25 ] WWW . Da mi en M ar t in ’ s p hy s i c s w eb s i t e .

h t t p : / / l i f s h i t z . u cda v i s . ed u / ~ d mar t in / i n dex . h t ml

[ 26 ] W W W . S lo pe A p p l e t : F i r s t p hy s i c s A pp le t .

h t t p : / / l i f s h i t z . u cda v i s . ed u / ~ d mar t in / t each _ j av a / s lo pe / f i r s t_ phy s i c s

. h t ml

[ 27 ] W W W . Ro b o t ( J av a 2 P l a t f o r m S E v . 14 .2 ) .

h t t p : / / j a v a . s u n . co m/ j 2 s e /1 . 4 . 2 / d o cs / ap i / j av a / aw t / Ro b o t . h t ml

[ 28 ] Ha r ry M. S need . T he R a t io n a l e f o r S o f t w ar e W r a pp i n g . I E E E,

19 97 .

[ 29 ] Edward Mi l l e r . WebS i t e T es t i ng . eV a l i d , 2 0 08 .

[ 30 ] W W W . W or ld W id e W eb C on s o r t i u m

h t tp : / /w w w .w 3 c . o rg

[ 31 ] A lan M . D av i s . 2 01 P r i nc ip l e s o f So f tw ar e D ev e lo pm en t . M cG r a w

Hi l l , 1995 .

84

[ 32 ] WWW . The W 3C Mark up Va l id a t i on Se rv i ce .

h t t p : / / v a l id a t o r . w 3 . o r g /

[ 3 3 ] W W W . W 3 C L i n k C h e c k e r .

h t t p : / / v a l id a t o r . w 3 . o r g / ch e c k l in k

[ 34 ] W W W . T he W 3C C S S V a l i d a t io n S e r v ice .

h t t p : / / j i g s aw . w 3 . o r g /c s s - v a l id a to r /

[ 35 ] W W W . W eb s i t e S ecu r i ty – A c un e t i x W eb V u ln e r ab i l i t y S can n e r .

h t t p : / /w w w .a cu n e t i x . co m/

[ 36 ] WWW . A p p l i c a t i o n S e c u r i t y , R i s k A s s e s s m e n t a n d R i s k M i t i g a t i o n

h t tp : / /w w w .s e cu r i t y in n ov a t i on . co m/

[ 37 ] WWW . W e b A p p l i c a t i o n S e c u r i t y a n d T e s t i n g f r o m S P I y D y n a m i c s

h t tp : / /w w w .s py dy na mi c s . co m/

[ 38 ] WWW . OW ASP.

h t tp : / /w w w .o w as p .o r g /

[ 39 ] W W W . O W A S P T o p T en P r o je c t

h t tp : / /w w w .o w as p .o r g / i nd ex .p h p /O W A S P _To p_T en _P r o je c t

85

Bibliography

J o hn D . M c Gr eg o r & D a v i d A . S y kes . A P r a c t i c a l G u i d e T o T es t i n g

Ob jec t -Or i en t ed S o f t wa re . A dd i so n Wes l ey , 20 05 .

B i l l H e t z e l . T h e Co m pl e t e G u ide t o So f t wa r e Tes t in g (2 n d Ed i t i on ) .

J o hn W i l y & S o ns , 1 9 98 .

Mau r o P i z ze & Mich a e l Y o un g . So f twa r e T es t in g a n d A n a lys es :

Proces s , Pr inc ip l e s and Techn i ques . J oh n W i l y & S o ns , 2 00 8 .

J e f f T ian . S o f twa re Q u a l i t y En g in e er in g : T e s t i n g , Q ua l i t y As su ra n ce ,

a nd Q u a nt i f i a b l e I m p r ovem en t . Jo h n W i l y & S on s , 20 05 .

86

Appendix A User Manual

A.1 Requirements T A T J A i s c o mp a t i b l e w i t h t h e J av a R un t i me E nv i r on men t 1 . 6 ( j r e 1 . 6 )

o r h igh e r . I n o r de r t o ex ecu te TA T J A on a w eb b r owse r i t i s r equ i r ed

to g r an t a l l pe r mi s s ion s to t h e A p p l e t S e cu r i t y M a na g e r . Th i s can b e

ach i eved by r ep l a c ing t he con t en t s o f t he j a v a p o l i c y f i l e t h a t i s f o u nd

u nd er t h e d i r e c to r y :

<JAVA_HOME>\lib\security\java.policy

… w i th t h e f o l low i ng con t en t s :

grant {

permission java.security.AllPermission;

};

A.2 Installation and Execution Instructions TA T J A con s i s t s o f a J A R f i l e , a r e s o u rces f o ld e r and a s i mp l e H TM L

p ag e . Th es e a r e av a i l ab l e on the C D d i s t r i b u ted w i t h th i s

d oc u men t a t io n a n d o n l in e o n t h e T A T JA h o me p ag e an d c a n b e

d ow n lo ad ed f ro m h t tp : / / t a t j a . ma t th ew xu er eb . co m/ .

TA T J A i s d es ig n ed to w o rk in a J av a d ev e lo p men t en v i ro n men t , t ha t i s ,

i n I n t eg r a t ed D ev e lo p me n t En v i r o n men t s ( I D Es ) . I n o r de r t o b e ab l e t o

u s e T A TJ A , th e T A TJ A r eso ur ce s f o ld e r and t h e TA TJ A H TM L pag e h as

87

to b e s to r ed a t t h e r o o t o f t h e J a v a A p p le t a pp l i c a t io n p r o j e c t t h a t h as

t o b e t e s t e d . T h e J A R s h o u l d b e p laced i n t h e s a me d i r ec to ry whe re t h e

c l a s s f i l e s a r e s to r ed . I t i s i mpo r t an t t h a t t h e J A R f i l e i s a l s o ad d ed to

t h e b u i l d pa th o f t h e p r o j e c t .

I n o r de r t o r un TAT JA t he TA TJ A HT M L f i l e has t o b e ex ecu te d i n any

w eb b r ows e r , s u ch a s O p era , S a f a r i , F i r e fo x , an d mo re .

A.3 TATJA in Record Mode

A.3.1 The Record Toolbar F ig u r e 2 8 b e l ow i l l u s t r a t e s a s c r e e n s ho t o f t h e t oo l b a r o f T A T J A in

Reco r d Mo de . A s i t c an be sho w n in F igu re 28 , nea r ly a l l o f t h e

b u t to ns a nd i co ns a r e d i s ab l ed e x c e p t f o r t he l o ad A p p le t b u t to n an d th e

h e lp i co n . O n ce an A p p l e t i s l o ad ed in s id e t h e t o o l , t h e bu t t on s an d

i con s s t a r t t o b e en ab l ed . T h i s he lp s t he u s e r n o t t o b e con f us ed w h ich

s t ep t o d o nex t i n t he t e s t c a se r eco r d in g p r oc es s .

Figure 28: Screen shot of TATJA Record toolbar

88

T h e n ex t s ec t io n o f t h i s u s e r ma nu a l mak e s r e f e r en c e t o t h e a bo ve

to o lb a r i l l u s t r a t e d in F ig u r e 2 8 .

A.3.2 Loading the Applet to be tested I n o rde r t o be ab l e t o r e co rd t e s t c a se s o n a p a r t i c u l a r A pp l e t , t he

A p p l e t h as t o b e f i r s t l oad ed i n t h e t e s t i n g t oo l . I n o rd e r t o l o ad th e

A p p l e t , t h e u se r h a s t o c l i c k o n t h e L o ad Ap p le t Bu t to n .

W h en t h e u s e r c l i ck s o n th i s b u t ton , a d i a log b o x a s s h o w n in F ig u r e 2 9

i s d i s p l a y e d o n t h e s c r e en . T h e u s e r h as t o s e l e c t a p ac k ag e f r o m w h er e

t o l oad t h e App l e t . Onc e t h e u s e r s e l ec t s a pa r t i cu l a r p ackag e f rom the

‘ L oad App le t Fr om ’ co mbo b ox , t h e ‘ Se lec t Ap p le t ’ l i s t bo x i s

popu l a t ed w i th a l l t he av a i l ab l e J ava C la s se s . The u se r has t o s e l ec t a

p a r t i cu l a r c l a s s t h a t i s an A p p l e t f r o m t h e l i s t b ox a n d c l i ck s o n o k .

O n ce th e us e r h i t s t he ‘ O k’ bu t to n , t he d i a log box i s n o t d i sp l ay ed any

mor e and the A p p l e t t o b e t e s t ed i s l oad ed w i t h in th e to o l .

Figure 29: Screen shot of the Load Applet Dialog Box

89

A.3.2 Loading/Creating TATJA Test Classes O n ce th e us e r h as l o ad ed t h e A pp l e t t o be t e s t ed i n TA TJ A , t he n ex t

s t ep i s t h a t o f l o a d in g o r c r ea t i ng a new t e s t c l a s s w he re t o s t o r e t he

r eco r ded t e s t c a s e s . I n o r d e r t o d o th i s t h e u s e r h a s t o c l i ck o n th e

‘ L oa dC la s s B u t ton ’ . When th i s bu t to n i s c l i ck ed , a d i a lo g b ox a s

s h ow n in F ig u r e 30 i s d i s p l ay ed o n the sc r e e n . F r o m th i s d i a l o g bo x

th e u s e r c an s e l e c t s a nd mak e s u s e o f an ex i s t en t t e s t c l a s s . E l s e , t h e

u s e r c a n c r e a t e a n ew t e s t c l a s s .

T o u s e a n e x i s t en t t e s t c l a s s , t h e u s e r ha s t o f i r s t s e l ec t t h e pa ck ag e

f ro m w he r e to lo ad th e t e s t c l a s s . Th e p ack ag e i s s e l e c t ed f ro m th e

‘ S e l ec t p a c k a g e’ co mb o b o x . Th en t h e us e r h as t o s e l ec t t h e c l a s s f r o m

th e ‘ C h oo s e c la s s ’ co mb o bo x .

I n o rd e r t o c r ea t e a n ew c l a s s t he u s e r h as t o f i r s t e i t h e r s e l ec t t h e

p ack ag e w h er e t o s t o r e t h e n ew c l a s s by mak in g u s e o f t h e ‘ S e l e c t

Package’ co mbo b o x o r e l s e c r ea t e s a new pa ckage b y ty p ing t he n a me

o f t h e n ew pack ag e in t h e ‘ N e w P ac k ag e’ t ex t f i e ld . T h en th e us e r h a s

t o t y p e in t he n a me o f t h e n ew t e s t c l a s s i n t h e ‘ Ne w C la s s ’ t ex t f i e ld .

I n o r de r t o co n t in u e w i th t he t e s t i n g p r o ces s , t he u s e r h as t o c l i ck on

th e ‘ O k ’ bu t to n . O n ce th e u s e r c l i c ks i n t h i s bu t to n , t he d i a l og b o x i s

r e mo v ed and t he u se r c an p roceed t o t he nex t s t ep o f t he r eco rd ing

p r o ce s s .

90

Figure 30: Screen shot of the Test Class Chooser Dialog Box

A.3.3 Selecting/Creating TATJA Test Methods O n ce th e us e r ha s c r ea t ed o r s e l e c t ed th e t e s t c l a s s , t h e n ex t s t ep i s t o

s e l ec t o r c r ea t e n ew t e s t me t ho ds w her e to r e co rd t h e t e s t c a s es . I n

o rd e r t o do th i s , t he u s e r has t o c l i ck i n t h e ‘ T es tM e th od Bu t to n ’ .

W h en th e u s e r c l i cks o n t h i s bu t to n , a d i a l o g b ox a s i l l u s t r a t ed in

F ig u r e 31 i s d i s p l a y ed o n the s c r e e n . F r o m th i s d i a log b o x t he u se r c a n

e i t h e r c r e a t e a n ew t e s t me t h o d o r e l s e u s e an e x i s t en t m e t h o d . I n o r d e r

t o s e l e c t an ex i s t i n g me t h o d ( i f t h e r e a r e a ny av a i l a b l e me t h od s ) t he

u s e r h as s e l e c t a me t h o d f r o m th e l i s t bo x o n th e l e f t h an d s i d e o f t h e

d i a l og b o x an d th e n c l i c ks o n th e ‘ O k ’ b u t t o n . I n o r d e r t o c r e a t e a n e w

t e s t me t h o d , t h e u s e r ha s t o t y p e in t h e n a me o f t h e n e w me t ho d a nd an

o p t io n a l de s c r i p t i on o n t he t ex t f i e ld s t h a t a r e av a i l ab l e o f t he r ig h t

h an d s id e o f t he d i a lo g b ox . W h en t h e u se r c l i ck s o n t h e ‘ O k B u t to n ’ ,

t h e d i a l o g b ox i s r e mo v e d a nd th e u s e r c an p r o ce ed . N o te th a t t h e u s e r

can a l s o s e l ec t an ex i s t i n g t e s t me t h od by ty p i ng th e n a me o f t h e t e s t

me t h od i n t h e ‘T es t M e th od Tex t F i e l d ’ i n t h e Re cor d T o o lb a r .

91

Figure 31: Screen shot of the Test Method Chooser Dialog Box

A.3.4 Test Case Recording O n ce th e A p p l e t t o be t e s t ed i s l o ad ed and th e t e s t c l a s s an d t e s t

me thod a r e s e l ec t ed , t he u s e r c an s t a r t o r e co rd t he t e s t c a s e s . No te

t h a t f r o m t h i s s t a g e o n w ard s , t h e u s e r can v i e w the co n ten t s o f t h e t e s t

me th od o r t e s t c l a s s by s i mp ly p l a c in g t h e mo us e p o in t e r o n t h e i r

r e s p e c t i v e t e x t f i e ld o n t h e r eco r d t o o lb a r . W h e n th e mo u s e p o in t e r i s

p l ac ed on t he se f i e l d s t he con t en t s o f t h e t e s t c l a s s o r t e s t me th o d a r e

d i s p l ay ed on a p o p up w in do w . N o te th a t o n c e th e u s e r r e mo v e s th e

mo u s e p o in t e r f r om t h i s w i n d ow , th e w in do w i s r e mo v ed . I n o r d e r t o

k eep th i s w in d ow ev en w h en th e mo us e p o i n t e r i s mo v ed to a d i f f e r en t

p os i t i o n , t h e u s e r has t o p r es s t h e k ey b o ar d F2 k ey . F i gu re 32 b e lo w

s h ow s a s c r e en s h o t o f s uch w i nd o w .

92

Figure 32: A screen shot of the window with the contents of a particular Test Method as displayed when the mouse pointer is displayed on the Test Method text field

I n o r d e r t o r e c o r d a t e s t a c t i o n , t h e u s e r h a s t o c l i c k o n t h e ‘ Recor d

I co n ’ . W he n t he u s e r c l i c k s o n th e r e co r d i co n , T A T J A sw i t ch es in t o

r eco r d in g mo de . W h en T A T JA i s i n r ec o r d i n g mo d e a n d th e u s e r mo v es

th e mo us e po in t e r on t h e A pp le t t o b e t e s t ed , t he co mp o n en t u n d e r ne a th

th e mo u s e p o in t e r h igh l i gh t s i t s e l f a nd a p op u p w in d ow i s d i s p l ay ed on

th e s c ree n w i t h a l l t h e p os s i b l e ac t i on s t h a t t h e t e s t e r can p e r fo r m o n

i t .

F ig u r e 33 b e lo w s h ow s t he w in do w t ha t i s d i s p l ay ed w h en th e u s e r

p l a c es t he mo u s e po in t e r o n a J S l i d er B a r co mp o n en t . A s i t i s

i l l u s t r a t e d i n t h e s c r e en s ho t , t h e c o mp o ne n t i s h ig h l i g h ted in p in k a n d

th e R eco r de r T oo l P an e l w i nd ow i s d i sp l ay ed o n th e s c r een . A t t h e t o p

p a r t o f t h e w in do w t h e d e t a i l s o f t h e co mp on e n t a r e d i s p l ay ed . A t t h e

b o t to m o f t h e co mp o n en t t h e p o s s ib l e a c t io n s to g e th e r w i t h th e i r

93

r e s p e c t i v e d es c r ip t io ns a r e d i s p l ay ed . I n o rd e r t o r e c o r d a p a r t i cu l a r

a c t io n , t h e u s e r h a s t o c l i ck o n on e o f t he s e a c t io n s .

Figure 33

Wh en th e u s e r c l i ck s on a p a r t i c u l a r ac t i on , a n ew d ia lo g bo x i s

d i s p l ay ed o n t he s c r e e n . F i gu r e 3 4 b e l ow s ho w s a s c r een s ho t o f t h e

d i a l og t h a t i s d i s p l ay ed w hen th e u s e r s e l e c t s t h e s e tPo s i t i o n ac t i on

f r o m th e a bo v e e x a mp l e o f F ig u r e 3 3 .

Figure 34

94

T h e p u r p os e o f t h e d i a lo g b o x i l l u s t r a t ed in F ig u r e 3 4 i s i n o r de r t o l e t

t h e u s e r t o i n pu t an y r eq u i r ed p a r a me t e r s . T he r e qu i r ed inp u t

p a r a me te r s a r e i n pu t t ed f r o m the t ex t f i e ld s gene ra t ed ‘ t a i l mad e ’ f o r

t h e s p e c i f i c a c t io n co mma nd a t t h e mi dd l e p a r t o f t h e d i a log b ox . A t

t h e b o t t o m p a r t o f t he d i a l og b o x th e a c tu a l g en e r a t ed Jav a c od e i s

d i s p l ay ed in a t ex t a r e a . T h e u s e r c an ad d a ny v a l i d j av a co de in t h e

t ex t a r e a in o r de r t o f u r th e r e nh an ce t he r e c o r d e d t e s t c a s es . W h e n t h e

u s e r c l i c k s o n th e ‘ O k’ bu t t on , t h e g en e r a t ed J a v a co d e i s ap p e n d ed t o

t h e t e s t me t h o d .

S o me t i me s i t i s r e qu i r ed th a t b e t w een an ac t i o n an d a no th e r t h e r e i s a

d e l a y . I n o r d e r t o i n c lu d e a d e l ay in t h e t e s t c a s es , t h e u s e r ha s t o

c l i ck o n t he ‘ D e l a y I con ’ f r o m th e R e c or d T o o lb a r . W h en the u s e r

c l i ck s o n th i s i co n , a d i a l o g b ox a s s h ow n in F ig u r e 35 b e l ow i s

d i s p l ay ed on th e s c reen . Th e us e r h as t o t y pe in t h e n u mber o f s eco n d s

to de l ay an d th en c l i ck s on t he ‘ O k’ b u t t on .

Figure 35

W i th T A T J A i t i s a l s o p os s ib l e t o i n c lu d e Asser t S ta t emen t s w i t h in th e

r eco rded t e s t c a se s . I n o rde r t o i n c lude an a s se r t s t a t e men t , t he u se r

h as t o c l i ck o n th e ‘ A ss e r t I co n ’ f ro m th e R eco r d To o lba r . A d i a l o g

b ox a s s h o w n in F ig u r e 3 6 i s d i s p l ay ed on t he s c r een . I n o r de r t o

co mp l e t e an a s s e r t s t a t e men t , t he u s e r ha s t o en t e r t h e r eq u i r ed

i n f o r ma t ion an d c l i cks on t he ‘ O k’ b u t ton .

95

Figure 36

A.3 TATJA in Playback Mode

A.3.1 The Playback Toolbar

F ig u r e 2 8 0 b e lo w i l l u s t r a t e s a s c r e e n s h o t o f t h e to o l b a r o f T A T J A in

P la y b ack Mo d e . T h i s s e c t io n o f t h i s u s e r manu a l ma k es r e f e r en ce t o

t h e to o l b a r i l l u s t r a t ed in F ig u r e 37 .

Figure 37

96

A.3.2 Loading Applet and Test Class

Th e A pp l e t t o b e t e s t ed an d th e t e s t c l a s s a r e lo ad ed in th e s a me w ay a s

t h ey a r e l oad ed d u r in g t he Recor d ing o pe ra t io n . Th e ‘ L oa d App le t

Bu t t on ’ i s c l i ck ed in o r d e r t o o p en t h e L o a d A p p l e t D ia lo g B ox w h i l e

t h e ‘ L o a dC la s s B u t t on ’ i s c l i ck ed in o r de r t o o p en th e L o ad T e s t C la s s

D ia lo g B o x .

A.3.2 Executing a Test Case I n T A T JA a t e s t c a s e i s eq u iv a l en t t o a J a v a me t h o d . I n o r d e r t o

ex ecu t e a p a r t i c u l a r t e s t c a s e , f i r s t t h e A p p l e t t o b e t e s t ed an d t h e t e s t

c l a s s has t o be l o aded . Once t hes e a r e l oaded , t he t e s t c a se ( me t hod ) t o

b e exe cu t ed i s s e l e c t ed th r o ug h th e ‘ S e l e c tM e t h o d Co m b o b o x ’ .

To p l ay back , t h e s e l ec t ed t e s t me t h od , t h e g r een ‘ P l a yb a c k I co n ’ i s

p r e s sed . W he n th i s i co n i s p r e s s ed th e J av a me th o d i s ex e cu t ed a nd

th u s t h e r e co rd ed t e s t c a s e i s p l ay back ed .

A.4 TATJA Test Suite Wi th TA T JA on e can c r ea t e t e s t s u i t e s . A t e s t s u i t e i s a co l l e c t io n o f

t e s t c a s es th a t can b e p l ay ba cked p r og r a mmat i c a l ly w i t ho u t t h e need o f

man u a l l y l o ad in g T A T J A an d t h e A p p le t t o b e t e s t ed . By u s in g T A T J A

Tes t S u i t s , t h e u s e r can p ro g ra mmat i ca l ly l oa d th e A p p le t t o b e t e s t ed

en caps u la t e d w i th i n a mi c r o v e r s ion o f T A T JA o n any w eb b r ow se r a nd

p l ay back th e r eco r d ed t e s t c a s es .

A.4.1 Creating a Test Suite

Wh en c r ea t in g a T es t Su i t e , a n ew A pp le t w ra pp e r c l a s s an d an H TM L

p ag e t h a t e x e c u t es t h i s c l a s s a r e c r e a t e d b y T A T J A . T o c r ea t e a T e s t

97

S u i t e , t h e P l a y T ab of T AT J A i s f i r s t s e l ec t ed . T hen th e A p p l e t t o b e

t e s t ed i s l o ad ed i n t h e t o o l . I n o r de r t o c r ea t e t h e Tes t S u i t e , t h e

‘ T es tS u i t e I co n ’ i s c l i ck ed . Wh en th i s i con i s c l i ck ed , t h e N ew T e s t

S u i t e D i a log Bo x i s d i sp l ay ed on t he s c r een a s sho w n in F ig u r e 38

b e lo w .

Figure 38

Th e na me o f t he pack ag e w her e to s t o r e t he t e s t s u i t e c l a s s i s s e l ec t ed

f ro m th e S e l e c t P a c k a g e co mb o b ox . O th e r w is e th e u s e r c an c r e a t e s a

n ew p a c k ag e by ty p i n g i n t he n a me o f t h e n e w p a ck a g e w h e r e t o s t o r e

th e n ew t e s t s u i t e c l a s s i n t h e N ew P ac k a g e t e x t f i e ld . T h e n a me o f t he

t e s t su i t e c l a s s i s en t e r ed i n t h e T es t C l a s s N a m e f i e ld an d th e n a me o f

t h e H T M L p ag e t h a t ex ecu te s t h e A p p le t i s en t e r ed in t h e H T M L Pa ge

Name t e x t f i e ld .

A.4.2 Editing/Programming a Test Suite

W h en a l l t h e r eq u i r e d in f o r ma t io n i s en t e r ed , a n ew J av a c l a s s a nd a

n ew H T M L d o cu me n t a r e c r ea t e d . T h e J a va c l a s s i s s to r e d in t h e

p ack ag e s e l ec t ed p r ev i ou s l y w h i l e t h e H TM L d ocu me n t i s s to r ed a t t h e

r oo t o f t h e p r o j ec t ’ s d i r ec t o ry . Th e g en e r a t ed J ava c l a s s co ns i s t s o f a

98

co n s t ru c t o r an d a n e mp t y me t h o d n a med t a t ja Su i t eT e s tM e th o d ( ) v e ry

s i mi l a r t o t h e co d e s n i pp e t s ho w n b e l o w .

public class SlopeTestSuite extends JApplet{ private RecorderHandler recorderHandler; private Class c; private JApplet test; private Map<String,Component> componentMapTable; public SlopeTestSuite(){ // Setting the windows look and feel try { UIManager.setLookAndFeel ("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); }catch(Exception e) { e.printStackTrace(); } try{ c = Class.forName("sloap.SloapApplet"); test = (JApplet)c.newInstance(); this.add(test); recorderHandler = new RecorderHandler(test); recorderHandler.disableRecorderMouseListener(); componentMapTable = recorderHandler.getComponentsMapTable(); }catch(Exception e){ JOptionPane.showMessageDialog(this,e.getMessage(), "Error Message",JOptionPane.ERROR_MESSAGE); } } public void tatjaSuiteTestMethod(){ // TATJA Generated tatjaSuiteTestMethod } // TATJA end of tatjaSuiteTestMethod }

The ca l l s t o t he r eco rded t e s t c as es s h o u l d b e ad d ed in t h e e mp ty

t a t j aS u i t e T es tM e t h o d as s ho w n in t he f o l l ow i n g c od e sn ip p e t ex a mp l e :

public void tatjaSuiteTestMethod(){ // TATJA Generated tatjaSuiteTestMethod SlopeTest s = new SlopeTest(test,componentMapTable); s.TestMethod1(); } // TATJA end of tatjaSuiteTestMethod

A.4.3 Executing a Test Suite W h e n t h e t a t ja S u i t e T es tM e t h o d i s r e ad y f r o m t h e r equ i r ed ad d end u ms

an d co mp i l ed , t h e t e s t s u i t e can b e ex ecu t ed by lo ad in g th e g en e ra t ed

99

H T M L p a g e in a ny w e b b r ow s er . T h i s c an b e do ne p r o g r a mma t i c a l l y by

u s in g th e T AT J ACon s o l e A P I t h r ou gh th e me t h o d : public static void runFileInWebBrowser(String browserConstant,String filePath)

T h e f i l e p a t h o f t h e H T M L d o cu men t s ho u l d b e pa s s ed a s p a r a me t e r

t h r ou gh a r g u men t f i l eP a th . T h e b r o w se r t o b e u s e d to r u n th e t e s t

s h ou ld b e i den t i f i e d b y p as s in g th e s t r i n g co n s t a n t g i v e n in t h e

W eb B r o w s er C o n f i g s . p r o p e r t i e s a s p a r a me t e r t h r ou g h t h e a r g u me n t

b r o w s er C o n s ta n t . I n t h e W eb Br ows er Con f ig s . p r o p er t i e s t h e s h e l l

co mman d s t ha t i nv ok es a nd lo a ds th e b r o w s er s ( O per a t ing S y s t e m

s p ec i f i c ) a r e s t o r ed .

100

Appendix B TatjaML Sample Document <?xml version="1.0" ?> <TatjaML> <component name="JLabel"> <commands> </commands> <events> <singleClick params="int,int" desc="Single Click on a JLabel"> <listener>MouseListener</listener> <invoke method="mouseClicked"> <pass_object object="MouseEvent"> <param type="java.awt.Component">^</param> <param type="int">500</param> <param type="long">0</param> <param type="int">16</param> <param type="int">&x</param> <param type="int">&y</param> <param type="int">1</param> <param type="boolean">true</param> </pass_object> </invoke> </singleClick> </events> </component> <component name="JPanel"> <commands> </commands> <events> <singleClick params="int,int" desc="Single Click on a JPanel"> <listener>MouseListener</listener> <invoke method="mouseClicked"> <pass_object object="MouseEvent"> <param type="java.awt.Component">^</param> <param type="int">500</param> <param type="long">0</param> <param type="int">16</param> <param type="int">&x</param> <param type="int">&y</param> <param type="int">1</param> <param type="boolean">true</param> </pass_object> </invoke> </singleClick> </events> </component> <component name="JTextField"> <commands> <type params="String" desc="Fill JTextField">

101

<return>null</return> <invoke method="setText"> <param type="java.lang.String">&text</param> </invoke> </type> <getText params="" desc="Get contents of JTextField"> <return>String</return> <invoke method="getText"> </invoke> </getText> </commands> <events> </events> </component> <component name="JTextArea"> <commands> <type params="String" desc="Fill JTextArea"> <return>null</return> <invoke method="setText"> <param type="java.lang.String">&text</param> </invoke> </type> <getText params="" desc="Get contents of JTextArea"> <return>String</return> <invoke method="getText"> </invoke> </getText> </commands> <events> </events> </component> <component name="JCheckBox"> <commands> <check params="boolean" desc="Set JCheckBox selected"> <return>null</return> <invoke method="setSelected"> <param type="boolean">true</param> </invoke> </check> <unCheck params="boolean" desc="Set JCheckBox not selected"> <return>null</return> <invoke method="setSelected"> <param type="boolean">false</param> </invoke> </unCheck> <click params="" desc="Click on JCheckBox"> <return>null</return> <invoke method="doClick"> </invoke> </click> </commands> <events> </events> </component> <component name="JRadioButton"> <commands> <check params="boolean" desc="Set JRadioButton selected"> <return>null</return> <invoke method="setSelected">

102

<param type="boolean">true</param> </invoke> </check> <unCheck params="boolean" desc="Set JRadioButton not selected"> <return>null</return> <invoke method="setSelected"> <param type="boolean">false</param> </invoke> </unCheck> <click params="" desc="Click on JRadioButton"> <return>null</return> <invoke method="doClick"> </invoke> </click> </commands> <events> </events> </component> <component name="JButton"> <commands> <getName params="" desc="Get the name of the JButton"> <return>String</return> <invoke method="getText"> </invoke> </getName> <isClickable params="" desc="Check if the JButton is enabled"> <return>boolean</return> <invoke method="isEnabled"> </invoke> </isClickable> </commands> <events> <click params="" desc="Generate a click event on a JButton"> <listener>ActionListener</listener> <invoke method="actionPerformed"> <pass_object object="ActionEvent"> <param type="java.lang.Object">^</param> <param type="int">3</param> <param type="java.lang.String">^getActionCommand</param> </pass_object> </invoke> </click> </events> </component> <component name="JToggleButton"> <commands> <getName params="" desc="Get the name of the JToggleButton"> <return>String</return> <invoke method="getText"> </invoke> </getName> </commands> <events> <click params="" desc="Generate a click event on a JToggleButton"> <listener>ActionListener</listener> <invoke method="actionPerformed"> <pass_object object="ActionEvent">

103

<param type="java.lang.Object">^</param> <param type="int">3</param> <param type="java.lang.String">^getActionCommand</param> </pass_object> </invoke> </click> </events> </component> <component name="JSlider"> <commands> <setMiddle params="int" desc="Set JSlider at middle position"> <return>null</return> <invoke method="setValue"> <param type="int">50</param> </invoke> </setMiddle> <setLeast params="int" desc="Set JSlider at least position"> <return>null</return> <invoke method="setValue"> <param type="int">0</param> </invoke> </setLeast> <setFull params="int" desc="Set JSlider at full position"> <return>null</return> <invoke method="setValue"> <param type="int">100</param> </invoke> </setFull> <setPosition params="int" desc="Set JSlider at i'th position"> <return>null</return> <invoke method="setValue"> <param type="int">&i</param> </invoke> </setPosition> </commands> <events> </events> </component> <component name="JComboBox"> <commands> <setIndex params="int" desc="Select JComboBox item at i'th index"> <return>null</return> <invoke method="setSelectedIndex"> <param type="int">&i</param> </invoke> </setIndex> <setItem params="java.lang.Object" desc="Select JComboBox s value"> <return>null</return> <invoke method="setSelectedItem"> <param type="java.lang.Object">&s</param> </invoke> </setItem> </commands> <events> </events> </component>

104

<component name="JList"> <commands> <setIndex params="int" desc="Select i'th JList index"> <return>null</return> <invoke method="setSelectedIndex"> <param type="int">&i</param> </invoke> </setIndex> <setIndices params="int[]" desc="Select JIten indices"> <return>null</return> <invoke method="setSelectedIndices"> <param type="int[]">&i</param> </invoke> </setIndices> <setItem params="java.lang.Object,boolean" desc="Select JItem value"> <return>null</return> <invoke method="setSelectedValue"> <param type="java.lang.Object">&i</param> <param type="boolean">true</param> </invoke> </setItem> </commands> <events> </events> </component> </TatjaML>

105

Appendix C Contents of the CD ROM \ \student.txt My D et a i l s

\TATJA Th e TA T J A p r o j ec t f o ld e r a nd T A TJ A .h t ml

\TATJA\src T h e S ou r c e C o d e o f t h e p r o j e c t

\TATJA\jar The j a r f i l e o f TA TJA

\TATJA\bin Th e co mp i l ed c l a s s es o f T A TJ A

\TATJA\recourses Th e r e s o u rce s f o l d e r o f T A TJ A

\TATJA\documentation Th e do cu men t a t io n

106

Appendix D Permissions and Clarifications

D.1 Permission to use working Applets I n Chap te r 6 – T es t i ng a n d E va lu a t i on , t h r ee w or k ing J ava A p p le t s a r e

u s ed a s t e s t ca s e s . Th e f i r s t A pp le t t h a t i s u s ed , t he Clu s t e r i ng

S im u la t io n A pp l e t , w as d ev e lo p ed b y th e a u t h o r o f t h i s d i s s e r t a t i o n a s

an a s s i gn me n t . T he o th e r tw o A pp le t s , t h e Ca r L o an A pp l e t and the

Fr i c t io n l e s s S lo pe S im u la t i o n Ap p le t a r e c an be do w nload ed f rom [ 2 4 ]

an d [2 5 ] r e s p e c t iv e ly . P e rmi s s ion s f ro m t h e i r r e s p ec t i ve au th o r s w er e

g iv en t o t h e a u t h o r o f t h i s d i s s e r t a t i on b y e ma i l . C o p ie s o f t he

r ece ived e ma i l s a r e i nc luded be low:

D.1.1 Permission email form Mr. Damien Martin Dear Matthew, I am pleased that my slope applet is useful to someone out there. Please feel free to use it as part of your BSc (Hons) dissertation. Best regards, Damien Martin > Dear Mr. Martin, > > I am a 4th Year student at "The University of Malta > (http://www.um.edu.mt)" reading a BSc IT (Hons.) degree. I am currently > working on my dissertation entitled "A Test Automation Tool For Java > Applets". The tool is ready and currently I am in the process of testing > it on working Applets. > > While I was browsing through the internet I came across your 'Slope > Applet' > which is a very good example of a working Applet. Can you kindly give me > permission to use you Applet for my dissertation demonstration? I will

107

> obviously reference it as appropriate. > > Regards > Matthew Xuereb > > P.S. Please note that my Applet testing tool is not a commercial tool and > if you give me permission to use your Applet it is going to be used purely > for academic purposes. >

D.1.2 Permission email form Profs. Deepak Kumar Hi Matthew: Feel free to use it as you wish. And, good luck with your dissertation. Best, Deepak. MATTHEW XUEREB wrote: > Dear Mr Kumar, > > I am a 4th Year student at "The University of Malta > (http://www.um.edu.mt)" reading a BSc IT (Hons.) degree. I am currently > working on my dissertation entitled "A Test Automation Tool For Java > Applets". The tool is ready and currently I am in the process of testing > it on working Applets. > > While I was browsing through the internet I came across your 'Car Loan > Applet' > which is a very good example of a working Applet. Can you kindly give me > permission to use you Applet for my dissertation demonstration? I will > obviously reference it as appropriate. > > Regards > Matthew Xuereb > > P.S. Please note that my Applet testing tool is not a commercial tool and > if you give me permission to use your Applet it is going to be used purely > for academic purposes. > > -- Deepak Kumar Professor of Computer Science Bryn Mawr College, Bryn Mawr, PA 19010 [email protected], [email protected] http://www.cs.brynmawr.edu/~dkumar

108

D.2 The TATJA Logo Th e au th o r o f t h i s d i s s e r t a t i o n w ou l d l i k e to c l a r i f y t h a t t h e l og o o f t h i s

t o o l i s i n s p i r e d b y th e J a va lo g o . H o w ev e r t h i s l o g o i s n o t co p i ed

d i r e c t l y f r o m t h e J av a lo g o .