• No results found

Using XML to Test Web Software Services. Modern Web Sites

N/A
N/A
Protected

Academic year: 2021

Share "Using XML to Test Web Software Services. Modern Web Sites"

Copied!
17
0
0

Loading.... (view fulltext now)

Full text

(1)

Using XML to Test

Web Software Services

Joint research with Suet Chun Lee, GMU PhD student Thanks in part to Dick Lipton

Jeff Offutt

Information & Software Engineering George Mason University

Fairfax, VA USA www.ise.gmu.edu/faculty/ofut/

Supported by NIST and NASA.

Modern Web Sites

We have moved from:

– ftp/email … – to gopher … – to simple html pages … – to web sites … – to dynamic html … – to web commerce …

with amazing speed!

Web sites have continuously evolved in the last

decade

(2)

© Offutt & Lee 3

Modern Web Sites

• Web sites are now too complicated for individuals to manage. • They need to be engineered by teams of people with diverse

talents:

– Programming skills – Graphics design – Usability

– Information layout and engineering – Data communications

– Data base

We need web site engineering

Web Sites and Software

• Web Page : Data that fits in one browser screen. • Web Site : A number of connected web pages.

• Web Site Software : Software that makes web sites dynamic.

network

Client Server Web

(3)

© Offutt & Lee 5 Client Web Server Application Server DB Server Browser Javascripts H T M L C G I JSP, etc J a v a network middleware middleware

Client-server … 3-tier … N-tier …

Multi-tiered Web Software Systems

Important Web Software

Quality Attributes

1.

Reliability

2.

Usability

3.

Security

Customers have little “site loyalty”

and will switch quickly, thus time to market is much less important than in other application areas.

(but still important!)

4.

Availability

5.

Scalability

6.

Maintainability

(4)

© Offutt & Lee 7

Web Sites are Much More Complex

• 1995: Web sites were 100% interface • 1998: Web sites were about 90% interface • 2001: Web sites are about 50% interface

There is a shortage of knowledgeable, skilled web

programmers and software engineers.

Summary

Changes in Web Technologies

1998-1999 n Dynamic HTML n Programs (poorly written) n Confused webmasters n ASP, CSS, … 2000-2001 n Functional websites n ECommerce + n WebManager + programmers, DB, network, UI, graphics designers, … n Java J2EE (JSP, Servlets, beans), {HT,U,X}ML, Component-based 1997

n Static web pages

n “Soft brochures”

n Webmasters

n HTML, CGI, JavaScript

(5)

© Offutt & Lee 9

Summary

Concerns of Software

Traditional 1. Efficiency of process (time to market) 2. Efficiency of execution Web Software 1. Reliability 2. Usability 3. Scalability 4. Security 5. Availability 6. Maintainability 7. Performance 50. Reliability 51. Safety 52. Maintainability 53. Security

Complexities of Web Site Software

• Heterogeneous

– Multiple hardware platforms – Multiple software platforms – Multiple software languages

– Multiple software models (imperative, declarative, functional, …) – Multiple organizations building the software

• Concurrent and distributed • High quality requirements

• High degree of reuse and third party components • Loosely coupled …

(6)

© Offutt & Lee 11

Complexities of Web Site Software

Loosely coupled

How can we ensure the reliability of this type of system? Traditional systems

Connected by calls and message passing High and moderate coupling

Web-based systems

Connected with network protocols Loose and extremely loose coupling

Communicating in Loosely Coupled

Systems

In traditional software, components and component authors negotiate details about structure of data that is exchanged

– Types – Formats – Order

This is difficult in extremely loosely coupled software

– Authors cannot communicate

– Components may not know who they interact with until execution time

XML is a standard that allows data items to be exchanged:

– Independent of type – Without regard to format – In arbitrary order

XML tags allow components to infer information about type, format and order

(7)

© Offutt & Lee 13

The Problem Context

• Heterogeneous web software interactions

• Components communicate by using an agreed upon standard for data exchange – XML

Testing: A technique to check the functional correctness of the interaction:

Interaction Mutation (IM)

W e b C o m p o n e n t A R e q u e s t X M L m e s s a g e f r o m A R e s p o n s e X M L m e s s a g e f r o m B H T T P W e b C o m p o n e n t B

Background

• Web Components

• eXtensible Markup Language (XML) • Testing and Mutation Analysis

(8)

© Offutt & Lee 15

Web Components

• Web component: A software module or collection of modules that execute on the world wide web

• Examples:

– Java server pages – Java servlets – JavaScripts

– Active server pages

– Java beans and non-bean classes – Databases

eXtensible Markup Language (XML)

• A universal format for structured documents and data on the web

• A recommendation of the World Wide Web Consortium (W3C)

• Enables data to be exchanged among heterogeneous software and hardware platforms

(9)

© Offutt & Lee 17

Example XML Document and its DTD

< ! E L E M E N T A U T H O R I Z E D _ U S E R S ( A U T H O R I Z E D _ U S E R ) * > < ! E L E M E N T A U T H O R I Z E D _ U S E R ( U S E R _ I D , P A S S W O R D ) > < ! E L E M E N T U S E R _ I D ( # P C D A T A ) > < ! E L E M E N T P A S S W O R D ( # P C D A T A ) > <?XML version = "1.0"> < A U T H O R I Z E D _ U S E R S > < A U T H O R I Z E D _ U S E R > < U S E R _ I D > j e n n y < / U S E R _ I D > < P A S S W O R D > j e n < / P A S S W O R D > < / A U T H O R I Z E D _ U S E R > < / A U T H O R I Z E D _ U S E R S >

Background: Software Testing

• Unit and Module Testing: Testing individual procedures and groups of related procedures

• Integration Testing: Testing for interface problems and incompatibilities between objects

• System Testing: Testing a complete system from an external perspective

(10)

© Offutt & Lee 19

Testing Criteria

• Test requirement

– Something in the software that needs to be tested

• Test specification

– Description of input needed to satisfy a requirement

• Test criterion

– Imposes a collection of test requirements

Informal Definition: A goal or stopping rule for testing

Testing and Mutation Analysis

Mutation testing

1. Modifies the source code 2. Produces mutants

3. Guides testers to create effective tests 4. Test cases that kill mutants also find faults

Fundamental mutation premise: If a fault exists, there is usually a mutant that will only be killed by a test case that also detects the fault

Mutation testing is computationally expensiveIt is practical for small software components …

(11)

© Offutt & Lee 21

Interaction Mutation (IM) Analysis

• Traditional mutation analysis:

– modifies the program source

– is primarily used for unit and module testing – uses test cases that are input values to program units

• Interaction mutation analysis:

– mutates the of web service data interactions (the messages) – is used for integration testing of web software components

– uses test cases that are XML messages between web software components

• IM creates test cases as XML messages from the XML grammar description (DTDs)

A Model for Web Service Interactions

• A formal model of web service interactions is needed to automate testing

• Model uses:

– formally defined DTDs – messaging interfaces – constraints

• Extends Fan and Simeon’s DTD structure and integrity constraints

(12)

© Offutt & Lee 23

Definition

Interaction Specification Model (ISM)

DTD structure S = (E, P, R), where: – E are the elements

– P maps elements to element definitions

– R maps attributes of elements to the attribute type • Lm = constraint language

– Two constraints currently defined in Lm: membership and length

M = (request, response), request and response are defined in SΣ = a set of basic XML constraints expressed in LmΣ

• ISM = (S, M, Σ)

ISM Example

<-- D T D f o r C o m p u t e r A c c o u n t s - - > < ! E L E M E N T U S E R _ I D( # P C D A T A ) > < ! E L E M E N T P A S S W O R D( # P C D A T A ) >

<! -- Collection of authorized users - - >

< ! E L E M E N T A U T H O R I Z E D _ U S E R S( A U T H O R I Z E D _ U S E R ) * > < ! E L E M E N T A U T H O R I Z E D _ U S E R( U S E R _ I D , P A S S W O R D ) >

<! -- XML request sent, SignOn A -- >

< ! E L E M E N T S I G N O N _ R E Q U E S T( U S E R _ I D , P A S S W O R D ) >

<! -- XML response sent, Authenticate B - - > < ! E L E M E N T S I G N O N _ R E S P O N S E( U S E R _ I D ) >

(13)

© Offutt & Lee 25

ISM Example (2)

S = (E, P, R)

E = {USER_ID, PASSWORD, AUTHORIZED_USERS, AUTHORIZED_USER, SIGNON_REQUEST, SIGNON_RESPONSE}

P (SIGNON REQUEST) = (USER ID, PASSWORD) P (SIGNON_RESPONSE AUTHENTICATION)= string values

M = (request, response)

request = {P (SIGNON REQUEST)} response = {P (SIGNON RESPONSE)} Σconsists of memberOf and lenOf constraints: Σ= { SIGNON REQUEST (USER ID, PASSWORD)

⊆AUTHORIZED USER (USER ID,PASSWORD), | PASSWORD [String Value S] | = 3

}

Interaction Mutation Test Process

Applying interaction mutation operator class

on constraints of ISM Mutant of

Interaction Specification Model (ISM)

Generate Mutant Interaction I1, I2, I3, …

Interaction Mutation System

Members of Test Set T

(14)

© Offutt & Lee 27

IM Illustration

E x e c u t e T Interaction I response request Web Component C2 Web Component C1 request response Web Component C1 Web Component C2 M u t a n t Interactions I1, I2, … M u t a n t Interactions I1, I2, … M u t a n t Interactions I1, I2, … Interaction Mutation System (IMS) Interaction Mutation Operators (IMOs) E x e c u t e T Generates

Example: Authentication

A web component A requires users to loginAuthentication for A is provided by B

A sends an XML message requesting B to authenticate a user

B does the verification and responds to A with an XML message that

allows or denies the user access

W e b C o m p o n e n t A R e q u e s t X M L m e s s a g e f r o m A

R e s p o n s e X M L m e s s a g e f r o m B

H T T P

(15)

© Offutt & Lee 29

Request and Response Messages

Request Message

<? xml version=1.0?> < S I G N O N R E Q U E S T > < U S E R I D > J e n n y < / U S E R I D > < P A S S W O R D > j e n < / P A S S W O R D > < / S I G N O N R E Q U E S T >

Response Message

<? xml version=1.0?> < S I G N O N R E S P O N S E A U T H E N T I C A T I O N = " A L L O W " > < U S E R I D > J e n n y < / U S E R I D > < / S I G N O N R E S P O N S E >

Use NOT MemberOf IMO to Mutate

Request Message

Mutated Request Message

<? xml version=1.0?> < S I G N O N R E Q U E S T >

< U S E R I D >J e f f</USER ID> < P A S S W O R D > j e n < / P A S S W O R D > < / S I G N O N R E Q U E S T >

Assumed: The pair "Jeff, jen" is not in the authorized user database.

Response Message

<? xml version=1.0?> < S I G N O N R E S P O N S E A U T H E N T I C A T I O N = " D E N Y " > < U S E R I D > J e f f < / U S E R I D > < / S I G N O N R E S P O N S E >

(16)

© Offutt & Lee 31

Use NOT lenOf IMO to Mutate

Request Message

Mutated Request Message

<? xml version=1.0?> < S I G N O N R E Q U E S T >

< U S E R I D > J e n n y < / U S E R I D > < P A S S W O R D >jenXXX< / P A S S W O R D > < / S I G N O N R E Q U E S T >

Given: Jenny’s password is of length 3.

Response Message

<? xml version=1.0?> < S I G N O N R E S P O N S E A U T H E N T I C A T I O N = " D E N Y " > < U S E R I D > J e n n y < / U S E R I D > < / S I G N O N R E S P O N S E >

Response is different from that of original message, so mutant is “killed”

Applications

• Can be used anywhere that XML is used

• Useful when third-party software components whose source is not available

• Most newer web applications use XML for communication

– Between tiers

– Between software and database

– Between heterogeneous software components

(17)

© Offutt & Lee 33

Conclusions

• New testing technique for validating functional correctness of web component interactions àà IM

– Source code is not needed (allowing third party vendors) – Create mutants of XML message

• Interaction Specification Model • Test criteria àà constraints • IMO classes, IMOs

Future Work

• Define additional classes of interaction mutation operators • DTD àà schema language

• Apply the technique to composite multilateral interactions • Construct a test environment

References

Related documents

Lennik &amp; Kiel ﻊﻤﺟ ﻩﺪﺷ ﻱﺭﻭﺁ ﻡﺮﻧ ﻂﺳﻮﺗ ﺲﭙﺳ ﻭ ﺭﺍﺰﻓﺍ SPSS ﻪﺨﺴﻧ ﻱ ۱۶ ﺖﺴﺗ ﺯﺍ ﻩﺩﺎﻔﺘﺳﺍ ﺎﺑ ﻭ ﺎﻫ ﺪﻨﺘﻓﺮﮔ ﺭﺍﺮﻗ ﻞﻴﻠﺤﺗ ﻭ ﻪﻳﺰﺠﺗ ﺩﺭﻮﻣ ﻲﻠﻴﻠﺤﺗ ﻭ ﻲﻔﻴﺻﻮﺗ ﻱﺭﺎﻣﺁ ﻱ. ﻢـﻫ

Summary Plan Descriptions are contained in the Health and Life Benefits Guide for Retirees of Participating AMR Corporation Subsidiaries (“RBG”)).. These changes are effective on

För att förmedla stöd till familjer där barnet har en långvarig sjukdom använde sig BVC-sjuksköterskan av en rad strategier.. Det kunde röra sig om att avsätta mer tid, att

By using a fixed-effect gravity model to estimate the effects of these integration processes on bilateral FDI activity with the UK, the empirical results suggest that, on

The positive results of the just-described clinical trial appear to be in conflict with a prior study that also used a metronomic schedule for 28 GBM patients with recurrent tumors

1998 Stanford University, Ph. in Economics, Dissertation title: “Essays in Strategic Learning”. Advisors: Robert Hall, Thomas Sargent, Mike Horvath. 1996

• Involving young people as creative producers and leaders in diverse projects and programmes in partnership with key North West partners (including Youth Music Power Play

Guided Reading Notes Aunt Agatha, Space Traveller · Chapter 5 · Quite a Stretch?. Using