Introduction to Software Testing Chapter 7.1 Engineering Criteria for Technologies Paul Ammann & Jeff Offutt www.introsoftwaretesting.com.

Slides:



Advertisements
Similar presentations
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Introduction to Software Testing Chapter 9.2 Challenges in Testing Software – Software Testability Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 5.5 Input Space Grammars Paul Ammann & Jeff Offutt
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
15 Chapter 15 Web Database Development Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
CS 290C: Formal Models for Web Software Lecture 10: Language Based Modeling and Analysis of Navigation Errors Instructor: Tevfik Bultan.
XP Tutorial 9 New Perspectives on JavaScript, Comprehensive1 Working with Cookies Managing Data in a Web Site Using JavaScript Cookies.
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Introducing HTML & XHTML:. Goals  Understand hyperlinking  Understand how tags are formed and used.  Understand HTML as a markup language  Understand.
Aug. 2, 2005Vasileios Papadimitriou1 Automating Bypass Testing for Web Applications Vasileios Papadimitriou The Volgenau School of Information.
UNIT-V The MVC architecture and Struts Framework.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
INTRODUCTION TO WEB DATABASE PROGRAMMING
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Introduction to Software Testing Chapter 7.2 Engineering Criteria for Technologies Paul Ammann & Jeff Offutt
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
A Scalable Application Architecture for composing News Portals on the Internet Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta Famagusta.
Introduction to Software Testing Chapter 5.2 Program-based Grammars Paul Ammann & Jeff Offutt
Introduction to Software Testing Chapter 5.5 Input Space Grammars Paul Ammann & Jeff Offutt
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Testing Dynamic Aspects of Web Applications Jeff Offutt Professor, Software Engineering George Mason University Fairfax, VA USA
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
JavaScript, Fourth Edition
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
1 A Static Analysis Approach for Automatically Generating Test Cases for Web Applications Presented by: Beverly Leung Fahim Rahman.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Software Testing and Quality Assurance Web Applications Testing 1.
RELATIONAL FAULT TOLERANT INTERFACE TO HETEROGENEOUS DISTRIBUTED DATABASES Prof. Osama Abulnaja Afraa Khalifah
XRules An XML Business Rules Language Introduction Copyright © Waleed Abdulla All rights reserved. August 2004.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Website Development with PHP and MySQL Saving Data.
12 Developing a Web Site Section 12.1 Discuss the functions of a Web site Compare and contrast style sheets Apply cascading style sheets (CSS) to a Web.
Chapter 6 Server-side Programming: Java Servlets
1 Welcome to CSC 301 Web Programming Charles Frank.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
1 Introduction to Software Testing. Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Chapter 1 2.
Chapter 4: Working with ASP.NET Server Controls OUTLINE  What ASP.NET Server Controls are  How the ASP.NET run time processes the server controls on.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
Introduction to Software Testing Chapter 9.2 Program-based Grammars Paul Ammann & Jeff Offutt
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Slide 1 Service-centric Software Engineering. Slide 2 Objectives To explain the notion of a reusable service, based on web service standards, that provides.
1 State and Session Management HTTP is a stateless protocol – it has no memory of prior connections and cannot distinguish one request from another. The.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Testing Web Services by XML Perturbation Joint research with Wuzhi Xu and Juan Luo Jeff Offutt Information & Software Engineering George Mason University.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
PHP: Further Skills 02 By Trevor Adams. Topics covered Persistence What is it? Why do we need it? Basic Persistence Hidden form fields Query strings Cookies.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
Testing Web Applications (Adapted from Introduction to Software Testing Chapter 7.2 Engineering Criteria for Technologies) By Paul Ammann & Jeff Offutt.
Software Testing and Quality Assurance Syntax-Based Testing (2) 1.
Introduction to Software Testing (2nd edition) Chapter 5 Criteria-Based Test Design Paul Ammann & Jeff Offutt
12. DISTRIBUTED WEB-BASED SYSTEMS Nov SUSMITHA KOTA KRANTHI KOYA LIANG YI.
Teaching slides Chapter 6. Chapter 6 Software user interface design & construction Contents Introduction Graphical user interface – Rich window based.
Bypass Testing of Web Applications
Web Development Web Servers.
Paul Ammann & Jeff Offutt
Web Software Model CS 4640 Programming Languages for Web Applications
The Atomic Section Model
PHP / MySQL Introduction
Service-centric Software Engineering
Chapter 27 WWW and HTTP.
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Input Data Validation for Web Applications
Presentation transcript:

Introduction to Software Testing Chapter 7.1 Engineering Criteria for Technologies Paul Ammann & Jeff Offutt

Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 2 The Technologies n Chapters 1-5 emphasize criteria on four models of software n Emphasis in each chapter was first on the criteria, then on how to construct the models from different software artifacts n This chapter discusses how to apply the criteria to specific technologies –Most of the ideas in this chapter were developed after the year 2000 –Thus they are still evolving

Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 3 Chapter 7 Outline 1.Object-Oriented Software 2.Web Applications and Web Services 3.Graphical User Interfaces 4.Real-Time and Embedded Software Web Applications and Web Services

Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 4 Section 7.2 Outline 1.Overview 2.Static Hyper Text Web Sites 3.Dynamic Web Applications 1.Client-side testing 2.Server-side testing 4.Web Services Overview Most of these ideas were developed after 2000 Few are widely used Most adapt graph-based testing from Chapter 2

Issues in Testing Web Software n A web application is a program that is deployed on the web –Usually uses HTML as the user interface –Web-deployment means they are available worldwide –They accept requests through HTTP and return responses –HTTP is stateless – each request/response pair is independent n Web applications are usually very competitive n A web service is a web-deployed program that accepts XML messages wrapped in SOAP –Usually no UI with humans –Service must be published so other services and applications can discover them Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 5

Web Software n Composed of independent, loosely coupled software components –All communication is through messages –Web application messages always go through clients –The only shared memory is through the session object – which is very restricted –The definition of state is quite different n Inherently concurrent and often distributed n Most components are relatively small n Uses numerous new technologies, often mixed together Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 6

7 Deploying Software n Bundled : Pre-installed on computer n Shrink-wrap : Bought and installed by end-users n Contract : Purchaser pays developer to develop and install, usually for a fixed price n Embedded : Installed on a hardware device, usually with no direct communication with user  Web : Executed across the Internet through HTTP Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 8 General Problem n Web applications are heterogeneous, dynamic and must satisfy very high quality attributes n Use of the Web is hindered by low quality Web sites and applications n Web applications need to be built better and tested more Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 9 Problem Parameters n HTTP is a stateless protocol –Each request is independent of previous request n Servers have little information about where a request comes from n Web site software is extremely loosely coupled –Coupled through the Internet – separated by space –Coupled to diverse hardware devices –Written in diverse software languages Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 10 Separation of Concerns in Web Apps n Presentation layer n Data content layer n Data representation layer n Data storage layer Permanent data storageHTML, output and UIComputation, data accessIn-memory data storage Introduction to Software Testing (Ch 7.2),

Differences in Testing Web Software n Traditional graphs do not apply –Control flow graph –Call graph n State behavior is hard to model and describe n All inputs go through the HTML UI – low controllability n Hard to get access to server-side state (memory, files, database) – low observability n Not clear what logic predicates can be effectively used n No model for mutation operators on web software Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 11

© Ammann and Offutt 12 New Essential Problems of Web Apps 1. Web site applications feature distributed integration and are extremely loosely coupled Internet and diverse hardware / software 2.HTML forms are created dynamically by web applications UI created on demand and can vary by user and time 3.Users can change the flow of control arbitrarily back button, forward button, URL rewriting, refresh 4.Dynamic integration of new software components new components can be added during execution Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 13 Problem 1: Loosely Coupled How can we ensure the reliability of this type of software? Traditional software Connected by calls and message passing High and moderate coupling server client server Web-based software Connected with HTTP and XML Loose, extremely loose, distributed coupling Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 14 Extremely Loose Coupling n Tight Coupling : Dependencies among the methods are encoded in their logic –Changes in A may require changing logic in B n Loose Coupling : Dependencies among the methods are encoded in the structure and data flows –Changes in A may require changing data uses in B n Extremely Loose Coupling (ELC) : Dependencies are encoded only in the data contents –Changes in A only affects the contents of B’s data Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 15 WebPics How you’ns doin’ Jeff Offutt! Search Recommended Movies XXXXXX Examine queue View account (Warning: Queue empty) WebPics Huan ying guang ling, Wang Shuang! Search Recommended Movies ACDB Examine queue View account Frequent customer bonus Problem 2: Dynamic Flow of Control How can we ensure the reliability of this type of system? Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 16 Dynamic Execution of Web Apps n Parts of the program are generated dynamically n Dynamic web pages are created when users make requests n Different users will see different programs ! n The potential control, ala the traditional control flow graph, cannot be known ahead of time The potential flow of control cannot be known statically Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 17 Problem 3: User Control Flow How can we ensure the reliability of this type of software? n Users can make unexpected changes to the flow of control –Back buttons, refreshing, caching, forward button, URL hacking n State is stored in the server and in the HTML in the client’s browser n Operational transitions : Transitions NOT based on an HTML link: back, forward, URL rewriting, refresh n These transitions can cause unanticipated changes to the state of the web application Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 18 Problem 4: Dynamic Integration n Software modules can dynamically integrate with others if they use the same data structures n EJBs can be inserted into web applications, which can immediately start using them n Web services find and bind to other web services dynamically Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 19 Section 7.2 Outline 1.Overview 2.Static Hyper Text Web Sites 3.Dynamic Web Applications 1.Client-side testing 2.Server-side testing 4.Testing Web Services Static Hyper Text Web Sites

Testing Static Hyper Text Web Sites n This is not program testing, but checking that all the HTML connections are valid n The main issue to test for is dead links n We should also evaluate –Load testing –Performance evaluation –Access control issues n The usual model is that of a graph –Nodes are web pages –Edges are HTML links Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 20

Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 21 Section 7.2 Outline 1.Overview 2.Static Hyper Text Web Sites 3.Dynamic Web Applications 1.Client-side testing 2.Server-side testing 4.Testing Web Services Dynamic Web Applications

Testing Dynamic Hyper Text Web Sites n The user interface is on the client n Some software is on the client (scripts such as Javascript) n Most software is on the server n Client-side testing does not access source or state on the server n Server-side testing can use the source or the server state Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 22

Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 23 Section 7.2 Outline 1.Overview 2.Testing Static Hyper Text Web Sites 3.Testing Dynamic Web Applications 1.Client-side testing 2.Server-side testing 4.Testing Web Services Client-side testing

Client-Side (Black-Box) Testing n The UI and the software are on separate computers n The inputs to web software are defined by the HTML form elements –Text boxes, buttons, dropdown lists, links, etc n Techniques for generating values –Supplied by the tester –Generated randomly –User session data – data collected from previous users of the software n Choosing values –Bypass testing – values that violate constraints on the inputs, as defined by client-side information n The problem of finding all screens in a web application is undecidable Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 24

Test Value Selection n Challenge –How to automatically provide effective test values ? n Semantic Domain Problem (SDP) –Values within the application domain are needed –Enumeration of all possible test values is inefficient n Possible solutions –Random values (ineffective) –Automatically generated values (very hard!) –User data (incomplete) –Study application and construct a set of values (feasible) –Tester-supplied inputs (feasible but expensive) Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 25

Web Application Input Validation Sensitive Data Bad Data Corrupts data base Crashes server Security violations Check data Malicious Data Can “bypass” data checking Client Server Introduction to Software Testing (Ch 7.2), 26 © Ammann and Offutt

27 Bypass Testing n “bypass” client-side constraint enforcement n Bypass testing constructs tests to intentionally violate constraints : –Eases test automation –Validates input validation –Checks robustness –Evaluates security Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 28 User Name: Small $150 Version to purchase: Age: Large $500 Medium $250 Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 29 User Name: Small $150 Version to purchase: Age: Large $500 Medium $250 Username should be plain text only. Age should be between 18 and 150. Invalid data, please correct … Alan<Turing500 Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 30 Abbreviated HTML Version to purchase: … Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 31 Bypass Behavior n Extremely loose coupling … n combined with the stateless protocol … n allows users to easily bypass client-side checking : Users can save and modify the HTML Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 32 Saved & Modified HTML Version to purchase: … Allows an input with arbitrary age, no checking, cost=$25 … ‘<‘ can crash an XML parser Text fields can have SQL statements 25 yes Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 33 SQL Injection User Name:Password: turingenigma Original SQL: SELECT username FROM adminuser WHERE username='turing' AND password ='enigma' “injected” SQL: SELECT username FROM adminuser WHERE username='turing‘ OR ‘1’ = ‘1’ AND password ='enigma‘ OR ‘1’ = ‘1’ ’ OR ‘1’=‘1 Introduction to Software Testing (Ch 7.2),

Bypass Testing n This example illustrates how users can “bypass” client- side constraint enforcement n Bypass testing constructs tests to intentionally violate constraints –Eases test automation –Checks robustness –Evaluates security n Preliminary results –Rules for constructing tests –Successfully found errors in numerous Web apps Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 34

© Ammann and Offutt 35 Applying Bypass Testing n Analyze HTML to extract each form element n Model constraints imposed by HTML and JavaScript n Rules for data generation : –From client-side constraints –Typical security violations –Common input mistakes Introduction to Software Testing (Ch 7.2), Validating input data on the client is like asking your opponent to hold your shield in a sword fight

Types of Client Input Validation n Client side input validation is performed by HTML form controls, their attributes, and client side scripts that access DOM n Validation types are categorized as HTML and scripting –HTML supports syntactic validation –Client scripting can perform both syntactic and semantic validation Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 36 HTML ConstraintsScripting Constraints Length (max input characters) Value (preset values) Transfer Mode (GET or POST) Field Element (preset fields) Target URL (links with values) Data Type (e.g. integer check) Data Format (e.g. ZIP code format) Data Value (e.g. age value range) Inter-Value (e.g. credit # + exp. date) Invalid Characters (e.g. <,../,&)

© Ammann and Offutt 37 Example Client-Side Constraint Rules n Violate size restrictions on strings n Introduce values not included in static choices –Radio boxes –Select (drop-down) lists n Violate hard-coded values n Use values that JavaScripts flag as errors n Change “transfer mode” (get, post, …) n Change destination URLs Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 38 Example Server-Side Constraint Rules n Data type conversion n Data format validation n Inter-field constraint validation n Inter-request data fields (cookies, hidden) Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 39 Example Security Violation Rules Potential Illegal CharacterSymbol Empty String Commas, Single and double quotes’ or ” Tag symbols Directory paths..../ Strings starting with forward slash/ Strings starting with a period. Ampersands& Control characterNIL, newline Characters with high bit set254 and 255 Script symbols or Introduction to Software Testing (Ch 7.2),

Test Value Selection n Challenge: –How to automatically provide effective test values? n Semantic Domain Problem (SDP) –Values within the application domain are needed –Enumeration of all possible test values is inefficient n Possible Solutions –Random Values (ineffective – lots of junk) –Automatically generated values (very hard) –Taking values from session log files (feasible but incomplete) –Tester input (feasible) n Our tool used an input domain created by parsing the interface and tester input Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 40

Real-World Examples Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 41 atutor.ca Atalker demo.joomla.or Poll, Users phpMyAdmin Main page, Set Theme, SQL Query, DB Stats brainbench.com Submit Request Info, New user myspace.com Events & Music Search bankofamerica.com ATM locator, Site search comcast.com Service availability ecost.com Detail submit, Shopping cart control google.com Froogle, Language tools pageflakes.com Registration wellsfargolife.com Quote search nytimes.com Us-markets mutex.gmu.edu Login form yahoo.com Notepad, Composer, Search reminder, Weather Search barnesandnoble.com Cart manager, Book search/results amazon.com Item dispatch, Handle buy Pure black-box testing means no source (or permission) needed !

Output Checking n (V) Valid Responses : invalid inputs are adequately processed by the server n (F) Faults & Failures : invalid inputs that cause abnormal server behavior (typically caught by web server when application fails to handle the error) n (E) Exposure : invalid input is not recognized by the server and abnormal software behavior is exposed to the users n These do not capture whether the valid responses corrupted data on the server Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 42 (V1)Server acknowledges the invalid request and provides an explicit message regarding the violation (V2)Server produces a generic error message (V3)Server apparently ignores the invalid request and produces an appropriate response (V4)Server apparently ignores the request completely

Results Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 43 v

Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 44 Section 7.2 Outline 1.Overview 2.Testing Static Hyper Text Web Sites 3.Testing Dynamic Web Applications 1.Client-side testing 2.Server-side testing 4.Testing Web Services Server-side testing

Server-Side (White-Box) Testing n If we have access to the source on the server, we can try to model the web software n Many testing criteria on non-web software rely on a static control flow graph –Edge testing, data flow, logic coverage, … –Also slicing, change impact analysis, … n The standard control flow graph cannot be computed for web applications ! n But all the pieces of the web pages and the programs are contained in the software presentation layer … Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 45

© Ammann and Offutt 46 Atomic Sections : HTML with static structure and content variables PrintWriter out = response.getWriter(); out.println (" ") out.println (" " + title + " )" out.println (" ") P1 = if (isUser) { out.println (“ Welcome! "); P2 = for (int i=0; i<myVector.size(); i++) if (myVector.elementAt(i).size > 10) out.println (“ " + myVector.elementAt(i) + " "); P3 = else out.println (“ " + myVector.elementAt(i) + " "); P4 = } else { } P5 = out.println (“ "); P6 = Empty atomic section Atomic sections Introduction to Software Testing (Ch 7.2), out.close (); title myVector.elementAt(i) Content variables myVector.elementAt(i)

© Ammann and Offutt 47 Atomic Sections n A section of HTML with the property that if any part of the section is sent to a client, the entire section is –May include JavaScript –All or nothing property n An HTML file is an atomic section n Content variable : A program variable that provides data to an atomic section n Atomic sections may be empty Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 48 Modeling Web Applications n Restricted to the presentation layer only n Two levels of abstraction 1.Component Interaction Model (CIM) –Models individual components –Combines atomic sections –Intra-component 2.Application Transition Graph (ATG) –Each node is one CIM –Edges are transitions among CIMs –Inter-component Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 49 Component Expressions n Atomic sections are combined to model dynamically generated web pages n Four ways to combine: 1.Sequence : p1  p2 2.Selection : (p1 | p2) 3.Iteration : p1 * 4.Aggregation : p1 {p2} –p2 is included inside of p1 n The previous example produces: p  p1  (p2  (p3 | p4)* | p5)  p6 n Composite sections can be produced automatically Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 50 Modeling Component Transitions Five types of transitions 1.Simple Link Transition : An HTML link ( tag) 2.Form Link Transition : Form submission link 3.Component Expression Transition : Execution of a software component causes a component expression to be sent to the client 4.Operational Transition : A transition out of the software’s control Back button, Forward button, Refresh button, User edits the URL, Browser reloads from cache 5.Redirect Transition : Server side transition, invisible to user Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 51 Component Interaction Model : gradeServlet ID = request.getParameter ("Id"); passWord = request.getParameter ("Password"); retry = request.getParameter ("Retry"); PrintWriter out = response.getWriter(); out.println (“ " + title + " )"P1 =if ((Validate (ID, passWord)) { out.println (“ Grade Report ");P2 = out.println(“ " + courseName (I) + " “ + courseGrade (I) + “ ”);P3 =} else if (retry < 3) { retry++; out.println ("Wrong ID or wrong password"); out.println (" ); out.println (" "); out.println (" Send mail to the professor "); P4 = out.println (“ Wrong ID or password, retry limit reached. Good bye.") }P5 = for (int I=0; I < numberOfCourse; I++)} else if (retry < 3) { Introduction to Software Testing (Ch 7.2), out.println(“ ");P6 =

© Ammann and Offutt 52 CIM for gradeServlet n S = login.html n A = {p 1, p 2, p 3, p 4, p 5, p 6 } n CE = gradeServlet = p 1 ((p 2 p 3 * ) | p 4 | p 5 ) p 6 n T = { login.html gradeServlet [get, (Id, Password, Retry)], gradeServlet.p 4 sendMail [get, ()], gradeServlet.p 4 gradeServlet [get, (Retry)] } Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 53 Application Transition Graph n Γ : Finite set of web components n Θ : Set of transitions among web software components –Includes type of HTTP request and data n Σ : Set of variables that define the web application state n α : Set of start pages Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 54 ATG for gradeServlet n Γ = { login.html, gradeServlet, sendMail, syllabus.html } n Θ = { login.html syllabus.html [get, ()], login.html gradeServlet [get, (Id, Password, Retry)], gradeServlet.p 4 sendMail [get, ()], gradeServlet.p 4 gradeServlet [get, (Retry)] } n Σ = { Id, Password, Retry } n α = { login.html } Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 55 get (Id, Password, Retry) gradeServlet p1 p4p5 p6 p2 p3 ATG for gradeServlet get (Id, Password, Retry) sendMail get () syllabus.html get () login.html get () Introduction to Software Testing (Ch 7.2),

Atomic Section Modeling n Atomic sections provide a fundamental mechanism to model Web applications presentation layer n Can handle : –Distributed integration –Dynamically created HTML pages –Operational transitions n Requires deep analysis of software source Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 56

Some Current Open Questions n How to define data flow? –DU-pairs cannot be determined statically – uses cannot always be found n Automatically generating ATG n Issues not handled: –Session data –Multiple users –Concurrency –Input data –Output validation –Dynamic integration Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 57

Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 58 Section 7.2 Outline 1.Overview 2.Static Hyper Text Web Sites 3.Dynamic Web Applications 1.Client-side testing 2.Server-side testing 4.Testing Web Services Testing Web Services

© Ammann and Offutt 59 Web Services n A Web Service is a program that offers services over the Internet to other software programs –Internet-based –Uses SOAP and XML –Peer-to-peer communication n Web service components can integrate dynamically, by finding other services during execution n Web services transmit data that are formatted in XML Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 60 Web Service Architecture Web Services server Laptop PDA Work- station Cell phone Web-based internet servers clients Client-server server clients Introduction to Software Testing (Ch 7.2),

© Ammann and Offutt 61 Web Service Technologies WSDL Specification Specification Components Legacy System Wrapped Specification UDDI Registr y Services Wrapped Applications SOAP / XML Points to URL SOAP / XML Publish Find Bind Introduction to Software Testing (Ch 7.2),

Difficulties of Testing Web Services n Web services are always distributed n Most “peer-to-peer” communication is between services published by different organizations –Trust is a major issue holding back the adoption of web services ! n Design and implementation are almost never available n Structured messages are transmitted n Most testing research so far has focused on messages –Syntax-based test criteria have been proposed for Web services Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 62

Introduction to Software Testing (Ch 7.2), © Ammann and Offutt 63 Conclusions n The Web provides a new way to deploy software Web applications: –offer many advantages –use many new technologies –introduce fascinating new problems Web software engineering is just starting Two very useful techniques: –Atomic sections : A fundamental model –Bypass testing : Easy to automate – no source needed n This is a very active research area