a technique for reducing user session data sets in web application testing

20
1 A Technique for Reducing User A Technique for Reducing User Session Data Sets Session Data Sets in Web Application Testing in Web Application Testing Porfirio Tramontana Porfirio Tramontana Anna Rita Fasolino Anna Rita Fasolino Dipartimento di Informatica e Dipartimento di Informatica e Sistemistica Sistemistica University of University of Naples Federico II, Italy Naples Federico II, Italy Giuseppe A. Di Lucca Giuseppe A. Di Lucca RCOST – Research Centre on Software Technology RCOST – Research Centre on Software Technology University of Sannio, Benevento, Italy University of Sannio, Benevento, Italy

Upload: porfirio-tramontana

Post on 21-Jun-2015

816 views

Category:

Technology


1 download

DESCRIPTION

Exploiting user session data is a promising approach for testing a Web application. However, the effectiveness of user session testing techniques depends on the set of collected user session data: the wider this set, the greater the capability of the approach to detect failures, but the wider the user session data set, the greater the cost of collecting, analysing and storing data. In this paper, a technique for reducing a set of user sessions into an equivalent smaller one will be proposed. This technique allows equivalent user behaviours included in user sessions to be identified and classified, and produces a reduced set of user sessions that can be used to design test suites with a reduced effort. Some preliminary case studies were carried out to validate the proposed technique and to evaluate its effectiveness. Results of a case study will be presented in the paper.

TRANSCRIPT

Page 1: A Technique for Reducing User Session Data Sets in Web Application Testing

11

A Technique for Reducing User A Technique for Reducing User Session Data Sets Session Data Sets

in Web Application Testingin Web Application Testing

Porfirio Tramontana Porfirio Tramontana

Anna Rita FasolinoAnna Rita Fasolino Dipartimento di Informatica e SistemisticaDipartimento di Informatica e Sistemistica

University of Naples Federico II, ItalyUniversity of Naples Federico II, Italy

Giuseppe A. Di LuccaGiuseppe A. Di LuccaRCOST – Research Centre on Software TechnologyRCOST – Research Centre on Software Technology

University of Sannio, Benevento, ItalyUniversity of Sannio, Benevento, Italy

Page 2: A Technique for Reducing User Session Data Sets in Web Application Testing

22

Testing Existing Web ApplicationsTesting Existing Web Applications

Open issue:Open issue: Automatic generation of a minimal test suite Automatic generation of a minimal test suite

for exercising functionalities of an existing Web for exercising functionalities of an existing Web ApplicationApplication

Possible solutions:Possible solutions: White Box testing techniquesWhite Box testing techniques, based on the , based on the

analysis of the source code of Web Application analysis of the source code of Web Application artifacts (i.e. server pages and components)artifacts (i.e. server pages and components)

Black Box testing techniquesBlack Box testing techniques, based on the , based on the analysis of the user interactions (returned analysis of the user interactions (returned client pages and user actions)client pages and user actions)

Page 3: A Technique for Reducing User Session Data Sets in Web Application Testing

33

Black Box testing techniquesBlack Box testing techniques

Based on the analysis of interactions between user and system:

Collection and analysis of the traces of the interactions between the user and the Web Application:

User session data based techniques Recently adopted in the Web Applications testing field by:

S. Elbaum, G. Rothermel, S. Karre, M.Fisher: “Leveraging User-Session Data to support Web Application Testing”, IEEE TSE 2005

S. Sampath, V. Mihaylov, A. Souter, L. Pollock: “Composing a framework to automate testing of operational Web-based software”, ICSM 2004

……

Page 4: A Technique for Reducing User Session Data Sets in Web Application Testing

44

User-session data based User-session data based techniquestechniques

A set of user sessions are collected by monitoring real Web Application executions;

Each user session covers a subset of the execution scenarios of the Web Application;

Any user session is associated with a candidate test case;

A test suite is a set of user sessions.

Page 5: A Technique for Reducing User Session Data Sets in Web Application Testing

55

User-session data based User-session data based techniquestechniques

The effectiveness of a test suite obtained by collecting user sessions depends on the ability to test any execution scenario of the application

Wider the user session set, greater the effectiveness of the test suite

But … Wider the test suite size, greater the testing effort !

So … Reduction techniques are needed in order to have

minimal test suites reproducing any execution scenario

Page 6: A Technique for Reducing User Session Data Sets in Web Application Testing

66

The proposed testing strategyThe proposed testing strategy

Three steps:Three steps:

1.1. User Session collection and analysisUser Session collection and analysis

2.2. User Session reductionUser Session reduction

3.3. Test Suite GenerationTest Suite Generation

Page 7: A Technique for Reducing User Session Data Sets in Web Application Testing

77

1. User Session Collection1. User Session Collection

A User Session is a A User Session is a representation of a representation of a sequence of interactions sequence of interactions between an user and a between an user and a Web Application. It can Web Application. It can be composed of:be composed of: Server pages directly Server pages directly

called by the user;called by the user; Static Client pages Static Client pages

directly called by the user;directly called by the user; Client pages built on Client pages built on

request by server pagesrequest by server pages

Static Client Page

Client Page

Parameter

namevalue

Parameter Set

User Session Trace

Web Page

+starting page

+target page

Built Cl ient Page

Built Cl ient Page Equivalence Class**

Server Page

**

Page 8: A Technique for Reducing User Session Data Sets in Web Application Testing

88

Built Client Pages AnalysisBuilt Client Pages Analysis

Any Built Client Page Any Built Client Page experienced by a user is experienced by a user is assumed as an assumed as an istantiation of a basic istantiation of a basic scenarioscenario

Login Successful

Incorrect Login

Login Request

Similar Built Client Pages Similar Built Client Pages correspond to the correspond to the execution of equivalent execution of equivalent scenariosscenarios

Page 9: A Technique for Reducing User Session Data Sets in Web Application Testing

99

Built Client Pages and Use Case Built Client Pages and Use Case ScenrariosScenrarios

For each Server Page, the set of Built Client For each Server Page, the set of Built Client Pages can be partitioned in Equivalent Built Pages can be partitioned in Equivalent Built Client Pages (EBCP) classesClient Pages (EBCP) classes

Assumption:Assumption: Built Client Pages belonging to the same EBCP class Built Client Pages belonging to the same EBCP class

correspond to executions of the same basic use correspond to executions of the same basic use case scenariocase scenario

A user session can be collapsed into the sequence of corresponding A user session can be collapsed into the sequence of corresponding EBCPsEBCPs

The coverage of the User Session is the set of EBCPs visited at least once The coverage of the User Session is the set of EBCPs visited at least once during the sessionduring the session

User Session Sequence of EBCPs

US4 1 3 4 17 18 17 17 11 15 15 16 11 19 20 19 20 19 19 19 1

Covered EBCPs {1,3,4,11,15,16,17,18,19,20}

EBCP ClassBuil t Cl ient Page **

Server Page

1..*

1

1..*

11

*

1

*

Page 10: A Technique for Reducing User Session Data Sets in Web Application Testing

1010

Built Client Pages ClassificationBuilt Client Pages Classification

How can be classified the Built Client Pages into EBCPs?How can be classified the Built Client Pages into EBCPs?

By comparing HTML code of Built Client PagesBy comparing HTML code of Built Client Pages Clone detection techniquesClone detection techniques

oror

By Analysing the execution paths of server pages By Analysing the execution paths of server pages generating Built Client Pagesgenerating Built Client Pages BCPs belong to the same EBCP class if they are generated by BCPs belong to the same EBCP class if they are generated by

Linear Dependent Execution pathsLinear Dependent Execution paths This technique has been presented by Di Lucca and Di Penta in This technique has been presented by Di Lucca and Di Penta in

“Integrating static and dynamic analysis to improve the “Integrating static and dynamic analysis to improve the comprehension of existing Web applications”, WSE 2005comprehension of existing Web applications”, WSE 2005

An expert has to validate the partitioning obtained by applying An expert has to validate the partitioning obtained by applying these techniquesthese techniques

Page 11: A Technique for Reducing User Session Data Sets in Web Application Testing

1111

2. User Session Reduction 2. User Session Reduction TechniqueTechnique

The goal of the User The goal of the User Session reduction Session reduction technique is to obtain a technique is to obtain a reduced set of user reduced set of user sessions, including all the sessions, including all the EBCPs of the Web EBCPs of the Web Application Application

Each row is a User Session;Each row is a User Session; Each column is an EBCP classEach column is an EBCP class Each cell is 1 if the Each cell is 1 if the

corresponding User Session corresponding User Session contains at least an contains at least an instantiation of a BCP belonging instantiation of a BCP belonging to the corresponding EBCP classto the corresponding EBCP class

User Sequence CoveredSession of EBCPs EBCPs

US1 2 4 3 4 {2,3,4}US2 1 4 1 3 {1,3,4}US3 1 2 3 {1,2,3}US4 6 6 {6}US5 6 4 6 {4,6}US6 5 {5}Coverage Coverage

MatrixMatrix

Page 12: A Technique for Reducing User Session Data Sets in Web Application Testing

1212

The Reduction TechniqueThe Reduction Technique

Essentiality criterion: Essentiality criterion: a user session USi is essential if it a user session USi is essential if it

is the only user session containing is the only user session containing a certain EBCP;a certain EBCP;

Row dominance criterion: Row dominance criterion: a user session USi is dominated a user session USi is dominated

by a user session USj if all EBCPs by a user session USj if all EBCPs contained in USi are contained in contained in USi are contained in USj too;USj too;

Column dominance criterion: Column dominance criterion: an EBCP Pi dominates a EBCP Pj if an EBCP Pi dominates a EBCP Pj if

Pi is contained in all user sessions Pi is contained in all user sessions containing Pj.containing Pj.

Three Criteria:Three Criteria:

US6 is essential because it is US6 is essential because it is the unique User Session the unique User Session containing P5containing P5

US4 is dominated by US5 US4 is dominated by US5 because all the EBCPs because all the EBCPs contained in US4 are also contained in US4 are also contained in US5contained in US5

P3 dominates P1 and P2 P3 dominates P1 and P2 because P3 is contained in because P3 is contained in all the User Sessions all the User Sessions containing US1 or US2containing US1 or US2

Page 13: A Technique for Reducing User Session Data Sets in Web Application Testing

1313

The Reduction TechniqueThe Reduction Technique

Essential User Sessions Essential User Sessions belongs to the Reduced belongs to the Reduced Set;Set;

Reduced Set: US3, US5, US6

Dominated User Dominated User Sessions are deletedSessions are deleted

Dominant Pages are Dominant Pages are deleteddeleted

EBCPs covered by EBCPs covered by Essential User Essential User Sessions are Sessions are deleteddeleted

EssentiaEssentiall

DominateDominatedd

Dominant

Page 14: A Technique for Reducing User Session Data Sets in Web Application Testing

1414

3. Test Suite Generation3. Test Suite Generation

For each User Session belonging to the reduced set, a test case may be obtained, also taking into account:

Pre-conditions (Web Application state before starting the User Session)

Data exchanged between the user and the web pages

Page 15: A Technique for Reducing User Session Data Sets in Web Application Testing

1515

Case StudyCase Study

Based on the open source Web Application Bookstore

The version under exam is realised in PHP4, supported by a Microsoft Access database.

28 Server Pages, three of which just included library functions and were not able to build any client page.

The application was hosted by the Apache web server

Page 16: A Technique for Reducing User Session Data Sets in Web Application Testing

1616

Equivalent Built Client PagesEquivalent Built Client Pages

An incremental analysis has been carried out in order to identify the set of EBCPs

We concluded our experimentation after 63 User Session, when 33 different EBCPs was discovered

We experienced that no new EBCPs was discovered by increasing the User Session Set

Page 17: A Technique for Reducing User Session Data Sets in Web Application Testing

1717

Applying the Reduction Technique …Applying the Reduction Technique …

Applying the presented reduction technique 8 User Sessions were selected

Any of the 33 discovered EBCPs are actually covered by at least an User Session of the reduced set

A test suite containing 8 test cases, that is able to replay the user sessions belonging to the reduced set is generable

Reduced Set

Page 18: A Technique for Reducing User Session Data Sets in Web Application Testing

1818

Conclusions and Future WorksConclusions and Future Works

A technique for the extraction of a reduced test A technique for the extraction of a reduced test suite from User Session data has been presentedsuite from User Session data has been presented

This technique is based on an analysis and This technique is based on an analysis and classification of Built Client Pages and on the classification of Built Client Pages and on the reduction of the User Session setreduction of the User Session set

Case studies showed the effectiveness of the Case studies showed the effectiveness of the technique in reducing the size of the set of user technique in reducing the size of the set of user sessions to be considered for testingsessions to be considered for testing

Page 19: A Technique for Reducing User Session Data Sets in Web Application Testing

1919

Future WorksFuture Works

Some proposals:Some proposals: Experimentation with larger Web ApplicationsExperimentation with larger Web Applications

Implementation of a complete framework that is able to collect Implementation of a complete framework that is able to collect and analyse User Sessions, to generate the reduced test suite and analyse User Sessions, to generate the reduced test suite and to be able to replay tests belonging to the reduced setand to be able to replay tests belonging to the reduced set

Combination with reverse engineering approaches that are Combination with reverse engineering approaches that are able to identify use case scenarios on Web Applicationsable to identify use case scenarios on Web Applications

Evaluation of testing effectiveness, by checking different Evaluation of testing effectiveness, by checking different coverage criteriacoverage criteria

Application to regression testingApplication to regression testing

Comparison with other reduction techniquesComparison with other reduction techniques

Page 20: A Technique for Reducing User Session Data Sets in Web Application Testing

2020