integrating customized test requirements with traditional

29
Integrating Customized Test Requirements with Traditional Requirements in Web Application Testing Sreedevi Sampath, Sara Sprenkle Emily Gibson and Lori Pollock University of Delaware July 17, 2006 Workshop on Testing, Analysis and Verification of Web Applications and Services (TAV-WEB)

Upload: others

Post on 12-Sep-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Integrating Customized Test Requirements with Traditional

Integrating Customized Test Requirements with Traditional

Requirements in Web Application Testing

Sreedevi Sampath, Sara SprenkleEmily Gibson and Lori Pollock

University of DelawareJuly 17, 2006

Workshop on Testing, Analysis and Verification of Web Applications and Services (TAV-WEB)

Page 2: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 2/29

Need for Reliable Web Applications

• Expedia sells more than $35 million in tickets every week1

• In 1999 KBKids.com $10 off 30 • Huge losses on web site failure3

Financial services: $6.5 million per hourCredit card sales applications: $2.4 million per hourMedia companies: $150,000 per hour

• Large number of failures during maintenance4

1. e-Business 2.0: Roadmap for Success (2nd Edition) by M. Robinson, D. Tapscott, R. Kalakota . 2000

dollars or cents?2

2. More Web sites turn to test tools by Carol Sliwa in CNN.com. 19993. Web Application Development - Bridging the Gap between QA and Development by Michal Blumenstyk4. Causes of Failures in Web Applications by Solia Pertet and Priya Narsimhan. December 2005

Page 3: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 3/29

User-session-based Testing Process

Oracle Pass/ Fail

ActualResults

ExpectedResults

Log UserRequests

User 1:register.jsp?name=ss&pass=tstlogin.jsp?name=ss&pass=tstlogout.jsp

Beta Web Application (v.0.9) Deployment

Users

TestCases

Web Application Implementation (v.1.0)

UserSessions

Replay ToolTest Cases

Create testcases

User-session-based

Page 4: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 4/29

Measure Quality of Test Suites

• Test requirement coverageWhen to stop testingWhich test cases to selectHow to reduce a test suite

• Coverage and data flow-based requirementsStatementMethodBranchDef-use

• Covering all the statement requirements ensures the statement coverage criterion is satisfied

Page 5: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 5/29

Program Coverage-based Test Requirement

Original Test Suite(set of test cases)

Reduced Test Suite

Reduce

Requirement: statementCreate reduced suite that covers all statements in code covered by original suite

Advantage+ Guaranteed program coverage by reduced suiteDisadvantage- Expensive to execute the original test suite prior to reduction

Page 6: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 6/29

Measure Quality of Test Suites

• Test requirement coverageWhen to stop testingWhich test cases to selectHow to reduce a test suite

• Coverage and data flow-based requirements• We proposed usage-based test requirements

Derived from usage-database, name, seq2, namevalue, seq2name

User 1:register.jsp?name=ss&pass=tstlogin.jsp?name=ss&pass=tstlogout.jspbase request

name-value pairs

Page 7: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 7/29

Usage-based Test Requirement

Requirement: base requestCreate reduced suite that covers all base requests covered by original suite

Original set of user sessions

Reduced set ofuser sessions

User 1:register.jsplogin.jsplogout.jsp

Advantages+ Information present in the user session itself + No need to execute original suite, cost-effective

Reduce

Page 8: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 8/29

register.jsp withServlet 1 Servlet 2

Servlet 3Servlet 4response touser

register.jsp

Servlet 1response to

user

How much code are we guaranteed to cover by covering requirementregister.jsp?

Disadvantage of Usage-based Test Requirements

name-value pairs

Page 9: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 9/29

Integrate Program-based and Usage-based Requirements

Cost of generatingreduced suite and size of reduced suite

Program coverage and fault detection effectiveness of reduced suite

We want to achieve a balance between

Page 10: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 10/29

Our Research: Strategies for Integration

Integrate program coverage-based and usage-based test requirements to1. Compare test suites to identify the better suite2. Combine test requirements for reduction3. Augment existing reduction algorithm

Page 11: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 11/29

Our Research: Strategies for Integration

Integrate program coverage-based and usage-based test requirements to1. Compare test suites to identify the better suite2. Combine test requirements for reduction3. Augment existing reduction algorithm

Focus of this talk

Page 12: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 12/29

Usage-based Test Requirement: seqk

• Example test case< GET login.jsp?name=xxx&pass=yyy,

GETshop.jsp?item_no=aaa&book_name=ccc&price=60 >

• seqk: cover all size k sequences of base requestsfor k=2,<{GET login.jsp, GET shop.jsp}>

Page 13: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 13/29

Usage-based Test Requirement: name

• Example test case< GET login.jsp?name=xxx&pass=yyy,

GETshop.jsp?item_no=aaa&book_name=ccc&price=60 >

• name: cover all base requests and names{GET login.jsp?name&pass, GET shop.jsp?item_no&book_name&price}

Page 14: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 14/29

Usage-based Test Requirement: namevalue

• Example test case< GET login.jsp?name=xxx&pass=yyy,

GETshop.jsp?item_no=aaa&book_name=ccc&price=60 >

• namevalue: cover all base requests and name and value pairs

{GET login.jsp?name=xxx&pass=yyy, GET shop.jsp?item_no=aaa&book_name=ccc&price=60}

Page 15: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 15/29

Usage-based Test Requirement: seqkname

• Example test case< GET login.jsp?name=xxx&pass=yyy,

GETshop.jsp?item_no=aaa&book_name=ccc&price=60 >

• seqkname: cover all size k sequences of base requests and names for k = 2,

{<GET login.jsp?name&pass, GET shop.jsp?item_no&book_name&price>}

Page 16: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 16/29

Traditional HGS• Augment HGS [Harrold et al.] with usage-

based requirements as tie breakers• Select next test case to cover the least-

covered requirement

Cardinality: number of test cases that cover each requirement

3

4

3

2

1

3

Test Cases

T5

•••R6

•••R5

•••R4

••R3

•R2

•••R1

•••

T4T3T2T1T0Req

uire

men

tscard

4R0

Page 17: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 17/29

Traditional HGS

3

4

3

2

1

3

4

Test Cases

T5

•••R6

•••R5

•••R4

••R3

•R2

•••R1

•••R0

T4T3T2T1T0Req

uire

men

tscard

Start with requirement with least cardinalityOnly T3 covers R2

Page 18: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 18/29

Traditional HGS

Choosing T3 covers R2, R4, R5, R6

3

4

3

2

1

3

4

Test Cases

T5

••R6

••R5

••R4

••R3

R2

•••R1

•••R0

T4T3T2T1T0Req

uire

men

tscard

Page 19: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 19/29

Traditional HGS

• R3 is covered by two test cases, T0 and T4• Choose test case that covers most uncovered requirements

• Tie between T0 and T4, Go to next higher cardinality• Eventually, select randomly from tied test cases

3

4

3

2

1

3

4

Test Cases

T5

••R6

••R5

•R4

••R3

R2

•••R1

••••R0

T4T3T2T1T0

Req

uire

men

ts

card

Page 20: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 20/29

Modified HGS

3

4

3

2

1

3

4

Test Cases

T5

••R6

••R5

•R4

••R3

R2

•••R1

••••R0

T4T3T2T1T0

Req

uire

men

ts

cardUsage-based requirement coverage

GET login.jspGET shop.jsp

T0

GET login.jsp

T4

• Select T0 for the reduced suite• More effective when large number of ties encountered

Page 21: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 21/29

Case Study

• Compare reduced suites fromTraditional HGS with program coverage-based requirementsTraditional HGS with usage-based requirementsModified HGS with program coverage-based requirement (method) and usage-based tie breakers

• MetricsReduced suite sizeProgram coverageFault detection

Page 22: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 22/29

Subject Application

12,352Total number of URLs

890Number of user sessions

135Number of seeded faults

8947Non-commented LOC

172Number of methods

75Number of classes

Course Project Manager (CPM)

Page 23: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 23/29

Case Study: Methodology (1)

Web Application

Web Application

User requests code

Logged requestsLogged requests

Parse requests…

User sessions(original test suite)

Users

Page 24: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 24/29

Case Study: Methodology (2)

…HGS Programreduce

HGS Usage reduce

Modified HGSProg + Usage

reduce

Original test suite

……

replay

Reduced suites

replay

replay

Generate coverage, fault detection reports

Page 25: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 25/29

0

5

10

15

20

25

30

35

40

45

M-nvNVM-s2nS2NM-s2S2M-nNM-s1S1MCS 0

1000

2000

3000

4000

5000

6000

7000

8000

9000

Per

cent

of O

rigin

al T

est C

ases

Tot

al U

RLs

Req

uest

ed

Reduced Suite

Percent of Original Test Cases Total URLs Requested

Results: Reduced Test Suite Size

stmt brn meth

Modified HGS

method

method

method

method

method

Prog cvg req.

seq2nameM-s2n

namevalueM-nv

seq2M-s2

nameM-n

base requestM-s1

Tie breakerLabel in graph

Page 26: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 26/29

Results: Program Coverage Effectiveness

4800

4900

5000

5100

5200

5300

5400

5500

M-nvNVM-s2nS2NM-s2S2M-nNM-s1S1MCS

# of

Cov

ered

Sta

tem

ents

Reduced Suite

HGS-Method

Total Number of statements in CPM: 6966Number of statements covered by original suite: 5468

stmt brn meth

Modified HGS

method

method

method

method

method

Prog cvg req.

seq2nameM-s2n

namevalueM-nv

seq2M-s2

nameM-n

base requestM-s1

Tie breakerLabel in graph

HGS-method

Page 27: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 27/29

Results: Fault Detection Effectiveness

50

60

70

80

90

100

M-nvNVM-s2nS2NM-s2S2M-nNM-s1S1MCS

Per

cent

Fau

lts D

etec

ted

Reduced Suite

HGS-Method

stmt brn meth

Modified HGS

method

method

method

method

method

Prog cvg req.

seq2nameM-s2n

namevalueM-nv

seq2M-s2

nameM-n

base requestM-s1

Tie breakerLabel in graph

Page 28: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 28/29

Results: Summary

• Fault detection of Modified HGS better than Traditional HGS for same suite size and generation cost

• Usage-based requirement alone more effective than using Modified HGS with program-based and usage-based tie breakers but test suite size increases

• Type of usage-based requirement -- no effect on effectiveness of Modified HGS reduced suites

Page 29: Integrating Customized Test Requirements with Traditional

TAV-WEB, July 2006 Sreedevi Sampath . University of Delaware 29/29

Conclusions and Future Work

• Presented three strategies to integrate usage-based and program-based requirements in paper

• Experimentally evaluated the strategiesInstead of using method requirement, use customized requirement aloneCombining requirements better than HGS-methodModified HGS better than traditional HGS

• Future WorkExtend study to other applicationsAugment test cases from models of application with usage-based requirements