22
1 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 Sistemistica Dipartimento di Informatica e Sistemistica University of Naples Federico II, Italy University of Naples Federico II, Italy Giuseppe A. Di Lucca Giuseppe A. Di Lucca RCOST RCOST Research Centre on Software Technology Research Centre on Software Technology University of Sannio, Benevento, Italy University of Sannio, Benevento, Italy

A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 SistemisticaUniversity of Naples Federico II, ItalyUniversity of Naples Federico II, Italy

Giuseppe A. Di LuccaGiuseppe A. Di LuccaRCOST RCOST –– Research Centre on Software TechnologyResearch 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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 for exercising functionalities of an existing Web ApplicationWeb Application

Possible solutions:Possible solutions:White Box testing techniquesWhite Box testing techniques, based on the , based on the analysis of the source code of Web analysis of the source code of Web Application artifacts (i.e. server pages and Application artifacts (i.e. server pages and components)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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 2005S. 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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

44

UserUser--session data based techniquessession data based techniques

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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

55

UserUser--session data based techniquessession data based techniques

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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 Web between an user and a Web Application. It can be Application. It can be composed of:composed of:

Server pages directly called Server pages directly called by the user;by the user;Static Client pages directly Static Client pages directly called by the user;called by the user;Client pages built on request Client pages built on request by server pagesby 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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 istantiationistantiationof a basic scenarioof a basic scenario

Login Successful

Incorrect Login

Login Request

Similar Built Client Pages Similar Built Client Pages correspond to the execution correspond to the execution of equivalent scenariosof equivalent scenarios

Page 9: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 correspondiA user session can be collapsed into the sequence of corresponding ng EBCPsEBCPsThe coverage of the User Session is the set of The coverage of the User Session is the set of EBCPsEBCPs visited at least once during visited at least once during the sessionthe 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 ie nt Page **

Server Page

1..*

1

1..*

11

*

1

*

Page 10: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

1010

Built Client Pages ClassificationBuilt Client Pages Classification

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

By comparing HTML code of Built Client PagesBy comparing HTML code of Built Client PagesClone detection techniquesClone detection techniques

oror

By Analysing the execution paths of server pages generating BuilBy Analysing the execution paths of server pages generating Built t Client PagesClient Pages

BCPs belong to the same EBCP class if they are generated by LineBCPs belong to the same EBCP class if they are generated by Linear ar Dependent Execution pathsDependent Execution paths

This technique has been presented by This technique has been presented by DiDi LuccaLucca and and DiDi PentaPenta in “Integrating in “Integrating static and dynamic analysis to improve the comprehension of exisstatic and dynamic analysis to improve the comprehension of existing Web ting Web applications”, WSE 2005applications”, WSE 2005

An expert has to validate the partitioning obtained by applying An expert has to validate the partitioning obtained by applying these these techniquestechniques

Page 11: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

1111

2. User Session Reduction Technique2. User Session Reduction Technique

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

Each row is a User Session;Each row is a User Session;Each column is an EBCP classEach column is an EBCP classEach cell is 1 if the corresponding Each cell is 1 if the corresponding User Session contains at least an User Session contains at least an instantiation of a BCP belonging to instantiation of a BCP belonging to the corresponding EBCP classthe 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 MatrixCoverage Matrix

Page 12: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

1212

The Reduction TechniqueThe Reduction Technique

Essentiality criterion: Essentiality criterion: a user session a user session USiUSi is essential if it is is essential if it is the only user session containing a the only user session containing a certain EBCP;certain EBCP;

Row dominance criterion: Row dominance criterion: a user session a user session USiUSi is dominated by a is dominated by a user session user session USjUSj if all if all EBCPsEBCPs contained contained in in USiUSi are contained in are contained in USjUSj too;too;

Column dominance criterion: Column dominance criterion: an EBCP Pi dominates a EBCP an EBCP Pi dominates a EBCP PjPj if Pi is if Pi is contained in all user sessions contained in all user sessions containing containing PjPj..

Three Criteria:Three Criteria:

US6 is essential because it is the US6 is essential because it is the unique User Session containing unique User Session containing P5P5US4 is dominated by US5 US4 is dominated by US5 because all the because all the EBCPsEBCPs contained contained in US4 are also contained in US5in US4 are also contained in US5

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

Page 13: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 Sessions Dominated User Sessions are deletedare deleted

Dominant Pages are Dominant Pages are deleteddeleted

EBCPsEBCPs covered by covered by Essential User Essential User Sessions are deletedSessions are deleted EssentialEssential

DominatedDominated

Dominant

Page 14: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

1515

Case StudyCase Study

Based on the open source Web Application BookstoreThe 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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

1616

Equivalent Built Client PagesEquivalent Built Client Pages

An incremental analysis has been carried out in order to identify the set of EBCPsWe concluded our experimentation after 63 User Session, when 33 different EBCPs was discoveredWe 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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

1818

Conclusions and Future WorksConclusions and Future Works

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

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

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

Page 19: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

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 aImplementation of a complete framework that is able to collect and nd analyse User Sessions, to generate the reduced test suite and toanalyse User Sessions, to generate the reduced test suite and to be be able to replay tests belonging to the reduced setable to replay tests belonging to the reduced set

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

Evaluation of testing effectiveness, by checking different coverEvaluation of testing effectiveness, by checking different coverage age criteriacriteria

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 ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

2020

Page 21: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

2121

A comparison with A comparison with SampathSampath et al. techniqueet al. technique

Our technique is quite similar with the technique adopted by Sampath et al., that is based on Concept AnalysisAnyway the two techniques cannot be compared because:

Our technique is based on the analysis of visited EBCPs, while the Sampath technique is based on the analysis of visited server pagesOur technique does not take into account the visiting order

Page 22: A Technique for Reducing User Session Data Sets in Web ...wpage.unina.it/ptramont/Download/Tramontana-wse2006.pdf · 3 Black Box testing techniques Based on the analysis of interactions

2222

Concept LatticeConcept Lattice

Reduced Set