testing components in the context of a system cmsc 737 fall 2006 sharath srinivas

27
Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Post on 21-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Testing Components in the Context of a System

CMSC 737

Fall 2006

Sharath Srinivas

Page 2: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Outline Introduction to COTS

Advantages of COTS

Challenges in testing Components

Techniques for building testable components

Regression Testing of Component Systems

Conclusions

Page 3: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Introduction

What is Component Based Software Engineering (CBSE)?

This approach is based on the idea to develop software systems by selecting appropriate off-the-shelf components and then assemble them with a well-defined software architecture.

CBSE has three major functions: Developing software from prefabricated, reusable

parts. The ability to use those parts in other applications. Easily maintaining and customizing those parts to

produce new functions and features.

Page 4: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Introduction…

What is a Commercial Off the shelf (COTS) component: A component is an independent and replaceable part of a system

that fulfills a clear function. A component works in the context of a well defined architecture. A component communicates with other components by its

interfaces. Can be developed by different developers, using different

languages and different platforms.

Component

repository

Component 1

Component 2

Component n

Software system

select assemble

Page 5: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Advantages of COTS

Development cost is reduced

Development time is reduced

Complex systems can be built by reusing pre-existing components

Testing effort is reduced.

Page 6: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Component Based Systems: Architecture

Layman’s interpretation of Component Based System:

Developer Builds

Component

Developer Tests

Component

Component Repository with adequately tested

components

Component User uses the components

Final Software Product

Page 7: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Component Based Systems: A cautionary Tale-Ariane example Ariane Flight 501 crashed 30 sec after take-0ff

One of the reasons for the failure of the first Ariane 5 was that a conversion to integer its software failed (overflow)

This code was taken from Ariane 4, and had been successfully tested for Ariane 4.

But Ariane 5 had a higher initial velocity and was heavier than Ariane 4.

The story learnt: Even adequately tested components can fail when the context in which it is used changes.

Page 8: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Testing Components: Challenges

Testing is done by the developer.

System Requirements not available. Instead the developer has to use Component specifications.

Unpredictable Environment.

Unpredictable interaction with other components.

Page 9: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Context Sensitive Component Testing: Challenges

Testing is done by the Component User.

Unavailability of source code.

Source code in various languages.

Dependencies and interactions among components is complex.

Page 10: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Coverage Notions for Context Sensitive Component Testing

Component Services are accessible through interfaces.

Page 11: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Coverage Notions for Context Sensitive Component Testing… Interface Coverage criterion: Requires that all

interfaces for a component should be exercised at least once.

Similar to Black box testing.

Interface 1 Interface 2

Test these 2 interfaces

Page 12: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Coverage Notions for Context Sensitive Component Testing… Event Coverage Criterion:

Test an interface against all its possible invocations

Component 3

Interface 1 Interface 2

Component 2

Interface 1 Interface 2

Component 1

Interface 1 Interface 2

Test Interface 1 of component 3 invocated by Interface1 of Component1.

Test Interface 1 of Component 3 invocated by Interface 2 of component 2

Page 13: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Coverage Notions for Context Sensitive Component Testing… Context Dependency Test Coverage criterion:

Sometimes events can have sequential dependencies on each other and the order in which they are triggered can result in different program behavior.

Such dependencies are called context dependencies.

Component 3Interface 1 Interface 2

Component 2Interface 1 Interface 2

Component 1Interface 1 Interface 2

•Test all possible operational sequences in the in the component

•Similar to path Coverage

Page 14: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Coverage Notions for Context Sensitive Component Testing… Content Dependency test criterion

A content dependency exists between 2 interfaces I1 and I2 if an operation of I2 modifies the value of a variable used in an operation of I1.

In this case I2 is said to be content dependent on I1.

Test all the content dependencies in the software.

Similar to All Def-Use criterion

Page 15: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Coverage Notions for Context Sensitive Component Testing…

Page 16: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Testable COTS components Techniques for building testable components

Built In tests Interface Probing Traceable Components Self testing components State Machine Models….

All these techniques involve the efforts of both the Component developer and Component User

Page 17: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Built In tests The developer Packages components with the test

cases.

These test cases may be executed on the component by using a test executor.

Using built in test cases a component user can validate the behavior of the COTS functionalities.

Page 18: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Interface Probing

Component users might employ this technique to understand the component functionalities.

The functionality can then be used as the basis for creating test oracles.

The component developer can reduce the effort required to determine component properties by automating certain aspects of interface probing.

Page 19: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Traceable Components

Tractability is a facility that a component provides to track its internal and external behavior.

Tractability can be used to create test oracles.

Page 20: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Self Testing Components

Augment the component with functionality of analysis and testing tools.

A component augmented accordingly is capable of performing some or all activities of the component user’s testing process.

Component can run in 2 modes: Normal mode Maintenance mode

Page 21: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

State Machine Models

Techniques discussed in the previous slides are techniques for better exchange of information between Component developer and user.

Based on the knowledge gained the component user has to write test cases to validate if the component will work in its context.

An automated technique to check if a component will work in its context is needed

Page 22: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

State Machine Model

Test cases generated for testing components in their context.

This component considers each component as a FSM.

For representing a system and its context all the Finite State Machines are combined together to form a Component Based Flow Graph (CBFG)

Page 23: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

State Machine Models…

Page 24: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

State Machine Model

Based on the CBFG test cases that are context adequate and content adequate are generated.

Problem in State Machine Models: The testing effort of a component can be greater than the re-development effort of the same component!

Page 25: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Modified CBS Architecture

Developer Builds

Testable Components

Developer Tests

Components

Component Repository with adequately tested

components

Component User validates the components

Final Software Product

User tests the COTS in their Context

Page 26: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Regression Testing of Component Systems

Software built using components have system components and COTS.

New challenges: System components might evolve while COTS

components remain static. COTS components might evolve while the system

components remain static. Both COTS and system components can evolve.

Page 27: Testing Components in the Context of a System CMSC 737 Fall 2006 Sharath Srinivas

Conclusions Testing components in the context of their system is not

trivial!

Current research is focusing on 'building testable components' than 'testing components in their context'

This gives an indication that if a component is not testable it is difficult/ impossible to test it in it in the context of its system.

Future research in this field might focus on making use of the ‘testable components’ to automate testing components in the context of their system.