Software Testing Web
Software Testing Web
Shilpi Narula
M.Sc. Mathematics Dayalbagh Educational Institute Dayalbagh, Agra
Cont..
Modern Web applications are sophisticated, interactive programs with complex GUIs and numerous back-end software components that are integrated in novel and interesting ways. Web applications are much more complicated than simple HTML Web pages, and consist of more than just the front-end graphical user interfaces that users see.
Problems in Testing
In traditional client-server systems, the respective roles of the clients and servers and their interactions are predefined and static. In web applications, however, client side programs and contents may be generated dynamically. Compatibility and interoperability are urgent and cause problems that are more serious than with traditional programs.
Cont..
Web applications also have much faster maintenance requirements than most traditional software. Web technologies evolve more rapidly than traditional software technologies. Web applications also have features that are not present in client-server and distributed systems. These include session control, cookies, and the stateless aspect of HTTP.
Cont..
There are a wide number of users distributed all over the world & accessing the application services in a concurrent and global way. There is a possibility to generate software components at run time. The components may be executed on different server platforms . Different browsers may be used.
Effective testing of web based applications has to rely on [5]: Test Models Test Strategies Testing Levels Testing Processes
Static page
Dynamic-page Use:Set<var>
10
p3:static
11
Testing
There are two types of testing techniques: Static Verification. Dynamic Validation.
12
Static Verification.
These techniques do not require execution. They work on artifacts such as design documents and HTML source. Static analyzers can be employed to scan the HTML pages in a Web site & detect possible faults.
13
Cont
The model of the site can be analyzed to determine the presence of unreachable pages. Ghost pages are associated with pending links, which reference of a non existing frame. The analyses of a reaching frames is a specialization of the flow analysis framework, which computes the set of frames in which each page can appear . The outcome of the reaching frames is useful to understand the assignment of pages to frames.
14
Cont
Flow analyses can be employed in a more traditional fashion to determine the data dependences. Data dependences may reveal the presence of undesirable possibilities, such as use of a variable not yet defined. These are also important for dynamic validation.
15
Cont
While traversing the web pages it is impossible to reach a given document without traversing a set of other pages, called its dominators. Information about the shortest path is an indicator of potential troubles for the user searching a given document.
16
f1
f2
p2
p3
p4
p5
17
Dynamic validation
The internal structure of a Web application is accessed to measure the coverage that a given test suite reaches, with respect to a given test criterion. A test case for a Web application is a sequence of pages to be visited plus the input values to be provided to pages containing them. Execution consists of requesting the Web server for the URLs in the sequence and storing the output pages
18
Testing Criteria
Page testing: every page is visited at least once in some test case. Hyperlink testing: every hyperlink from every page in the site is traversed at least once. All-paths testing: every path in the site is traversed in some test case at least once.
19
Cont
Definition-use testing : all navigation paths from every definition of a variable to every use of it is exercised. All-uses testing: at least one navigation path from every definition of a variable to every use of it ,is exercised.
Static Page:p1 e1 Form Input={x1,x2} e2 submit p2:Dynm.page use = {x1} Conditional edge e=(x1=books) e3 link p3:static link p4:static e4 Conditional edge e=(x1=movies) include
20
Cont
These criteria are often impractical, since there are infinite paths in a site. They can be satisfied if additional constraints are imposed ,for example k-limiting and path independence. In the k-limiting case , loops are traversed at least k times.
In the second case only independent paths are considered. When designing & executing test cases for a web application not all pages are equally of interest, Static pages can be ignored.
21
Applicability
Two tools ReWeb and TestWeb have been developed by Ricca and Tonella [2, 3, 4 ] to support analysis and testing of Web applications.
ReWeb downloads and analyzes the pages of a Web application with the purpose of building a UML model of it. TestWeb generates and executes a set of test cases for a Web application whose model was computed by ReWeb.
The Analysis and Testing approach has been applied to several real world web applications, e.g., Amazon
22
Definitions
Cluster : Collections of software modules and Web pages that implement some logical function. At the highest level, clusters may be abstractions that implement functions that can be identified by users. At the bottom level, clusters may be individual Web pages and software modules that represent single major functions. Web pages are modeled as multiple Logical Web Pages (LWP). An LWP is either an entire physical Web page or the portion of a Web page that accepts data from the user through an HTML form and then sends the data to a specific software module.
24
FSMs
Partitioning results in a hierarchical collection of finite state machines.
At the lowest level, logical Web pages are represented by nodes in FSMs that model behavior of software modules and Web pages. Edges represent transitions among logical Web pages and software modules. At the higher levels, each cluster forms a node in a FSM that models behavior of clusters. Edges in both levels of FSMs are annotated with inputs and constraints that may be associated with the transition.
25
Testing Approach
Phase 1: Build a model of the Web application.
Partition the Web application into clusters, Define logical Web Pages, Build FSMs for each cluster, Build an FSM to represent the entire Web application.
26
Professor
View Student Information Post Grades Email Grades Email Student Email TA Post Course Information.
Teaching assistant
Post Grades Email Class Email Student Email Professor View Course Information
27
Grades
G eta H ep
28
ss
ps
ts
off
29
Student Services
Node Cluster Explanation
SS1: Select Service 1 - Menu of named services SS2: Select Service 2 - List of navigation buttons for services at the bottom of student service pages I: Info Form - Physical Info Form page without service navigation buttons at bottom G: Grades - View Grades and Grades pages ETA: Email TA EP: Email Prof H: Submit homework C: View course info Pages
ss1 G eta ep h c
ss2
30
View Grades
From SS1/2 to SS2 From Select Service 1/2 To Select Service 2 Connection from either service selection facility Connection to list of navigation buttons for services at the bottom of student service pages Authentication for viewing grades Grade display
V G
from SS1/2
to SS1/2
31
Input Types
Text digit line email phone URL multi-line file Non-text links buttons radio button drop-down list check boxes
Constraints on Inputs
Input Choice Required (R) Required Value (R(parm=value)) Optional (O) Single Choice (C1) Multiple Choice (Cn) Order Sequence (S) Any (A)
32
GRADES
S I G E H c
from SS!/2
To SSI/2
33
34
35
w0 t S x off P T I G h o m eta
SS1
ep S
ss2 e V f G e to ss2
From ss1/2
t; h; e; f; e; m; o; e; f; e; m; x
36
Transition Symbol h e f e m o e f e m
Constraint R(G) none R(Lname, PIN, Submit) S(A(Lname, PIN), Submit) none continue-use (Lname, PIN) R(G) none R(Lname, PIN, Submit) S(A(Lname, PIN), Submit) none continue-use (Lname, PIN)
37
Problems
The oracle" problem, that is, of deciding if the results are correct. This is a problem because
of low observability tracking outputs is difficult
38
Conclusions
Web Application Testing is important Two different approaches to modelling and testing have been discussed
UML based FSM based
39
References
1. F. Ricca and P. Tonella, 'Web Site Analysis: Structure and Evolution', Proc. of ICSM'2000, International Conference on Software Maintenance, pp. 76-86, San Jose, California, USA, October 11-14, 2000. F. Ricca and P. Tonella, 'Analysis and Testing of Web Applications', Proc. of ICSE'2001, International Conference on Software Engineering, pp. 2534, Toronto, Ontario, Canada, May 12-19, 2001. F. Ricca, P. Tonella. Detecting Anomaly and Failure in Web Applications, IEEE MultiMedia magazine , Vol. 13, n. 2, pp. 44-51. April-June 2006. A. Andrews, J. Offutt and R. Alexander, Testing Web Applications by Modeling with FSMs, Software Systems and Modeling, Vol.4, No.3, pp.326-345, July 2005. G. A. Di Lucca, Testing Web Applications: The State of Art and the Future Trends, 29th Annual International Computer Software and Applications Conference (COMPSAC'05), Vol. 2, pp.25, July 2005.
2.
3. 4.
5.
40