Sei sulla pagina 1di 32

Chapter 11:

Integration-
Chapter 16: Testingand
(2/2)
System Testing
Object-Oriented
SoftwareConstruction

Armin B. Cremers, Sascha Alda & Tobias Rho


(based on Bruegge & Dutoit)
Roadmap for lecture

♦ 4.7.2006 (Lecture “Testing” and “Agile Software


Development”)
♦ 6.7.2006 (Practice Talk “T-Mobile”)
♦ 11.7.2006 (Exercise, on demand)
♦ 18.7.2006 (Written Exam), 18:00

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 2
Software Lifecycle Activities ...and their models

Requirements System Object Implemen-


Analysis Testing
Elicitation Design Design tation

Expressed in Structured Realized Implemented Verified


Terms of by by by by

class...
class...
class... ?
class.... ?
Application Solution
Use Case Domain Sub- Domain Source Test
Model Objects systems Objects Code Cases
Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 3
Test Team
Organizational issues

Professional
Tester too familiar
Programmer with code
Analyst

Test System
User Team Designer

Configuration
Management
Specialist
Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 4
Types of Testing

♦ Unit Testing (last lecture):


- Individual subsystem
- Carried out by developers (of components)
- Goal: Confirm that subsystems is correctly coded and carries out
the intended functionality

♦ Integration Testing (mainly this lecture):


- Groups of subsystems (collection of classes) and eventually the
entire system
- Carried out by developers
- Goal: Test the interface and the interplay among the subsystem

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 5
Types of Testing

♦ System Testing:
Š The entire system
Š Carried out by developers (testers!)
Š Goal: Determine if the system meets the requirements (functional
and global)
Š Functional Testing: Test of functional requirements
Š Performance Testing: Test of non-functional requirements

Š Acceptance and Installation Testing:


Š Evaluates the system delivered by developers
Š Carried out by the client.
Š Goal: Demonstrate that the system meets customer
requirements and is ready to use

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 6
Integration Testing Strategy

♦ Test (sub-)systems (cluster) for problems that arise from subsystem


interactions
♦ Assumption:
Š The entire system is viewed as a collection of subsystems determined
during the system and object design.
Š System Decomposition is hierarchical
♦ The order in which the subsystems are selected for testing and
integration determines the testing strategy
Š Big bang integration (Nonincremental)
Š Bottom up integration
Š Top down integration
Š Sandwich testing
Š Variations of the above
♦ For the selection use the system decomposition from the System
Design

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 7
Example: Three Layer Call Hierarchy

User
Interface Layer III

Billing Event Layer II


Learning
System Service

Network Neural Layer I


Database Access Network

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 8
Integration Testing:
Big-Bang Approach

Unit Test
A
Don’t try this!
Unit Test
B
Unit Test
C
System Test
Unit Test
D

♦ All components (units) are first tested individually and then together as
a single and entire system:
♦ Pros:
Š No test stubs (mocks) and drivers are needed
♦ Cons:
Š Difficult to pinpoint the specific component responsible for the failure
Î Results in Strategies that integrate only a few components at the time
Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 9
Bottom-up Testing Strategy
♦ The subsystem in the lowest layer of the call hierarchy
are tested individually
Š Infrastructure is tested first
♦ Then the next subsystems are integrated and tested from
the next layer up that call the previously tested
subsystems
Š Increment one subsystem at a time
Š Order of integration depends on importance of subsystem etc.
♦ This is done repeatedly until all subsystems are included
in the testing
Š Regression Tests: Rerun previous tests
♦ Only Test Drivers are used to simulate the components of
higher layers
♦ No Test Stubs!

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 10
Bottom-up Integration
A
Layer III

Test E B C D Layer I

Test B, E, F E F G
Layer I

Test F

Test C Test
A, B, C, D,
E, F, G

Test D,G
Test G

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 11
Pros and Cons of bottom up
integration testing
♦ Pros:
Š Interface faults can be more easily found (the usage of test
drivers accomplishes a clear intention of the underlying
interfaces of the lower layer)
Š No Stubs are necessary
♦ Cons:
Š Components of the User Interface are tested last
Š Test cases often hard to derive
Š Faults found in the top layer may lead to changes in the
subsystems of lower layers, invalidating previous tests.

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 12
Top-down Testing Strategy

♦ Test the top layer of the controlling subsystem first


Š The skeleton of the program is tested
♦ Then combine all the subsystems that are called by the
tested subsystems and test the resulting collection of
subsystems
Š Increment one subsystem at a time
♦ Do this until all subsystems are incorporated into the test
♦ Test Stubs are used to simulate the components of lower
layers that have not yet been integrated.
♦ No drivers are needed

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 13
Top-down Integration Testing
A
Layer III

B C D Layer I

E F G
Layer I

Test
Test A Test A, B, C, D A, B, C, D,
E, F, G

Layer III
Layer III + II
All Layers

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 14
Pros and Cons of top-down
integration testing

♦ Pros:
Š Test cases can be defined in terms of the functionality of the
system (functional requirements)
Š More effective for finding faults that are visible to the user
♦ Cons:
Š Writing stubs can be difficult: Stubs must allow all possible
conditions to be tested.
Š Possibly a very large number of stubs may be required

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 15
Sandwich Testing Strategy

♦ Combines top-down strategy with bottom-up strategy


(parallel testing is possible)
♦ The system is view as having three layers
Š A target layer in the middle
Š A layer above the target (top layer)
Š A layer below the target (bottom layer)
Š Testing converges towards the target layer
♦ No Test Stubs and Drivers are necessary for bottom and
top layer

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 16
Sandwich Testing Strategy
A
Layer III

B C D Layer I

Test E
E F G
Layer I

Bottom Test B, E, F
Layer Test F
Tests
Test
A, B, C, D,
Test D,G E, F, G
Test G

Test A,B,C, D
Top
Layer
Tests Test A
Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 17
Pros and Cons of Sandwich Testing

♦ Pros:
Š Top and Bottom Layer Tests can be done in parallel
Š No Stubs and Drivers (saves development time)
♦ Cons:
Š System implementation needs to be finished
Š Does not test the individual subsystems on the target layer
thoroughly before integration (C in the example)
♦ Solution: Modified sandwich testing strategy

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 18
Modified Sandwich Testing Strategy

♦ Tests the three layers individually before combining them


in incremental tests with one another

♦ The individual layer tests consists of three tests:


Š Target layer test with drivers and stubs
Š Top layer test with stubs
Š Bottom layer test with drivers

♦ The combined Layer Tests consist of two tests:


Š Top layer accessing target layer (top layer replaces drivers)
Š Bottom accessed by target layer (bottom layer replaces stubs)

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 19
Modified Sandwich Testing Strategy
A
Layer III

Test A Test A,B B C D Layer II

E F G
Test A,C Layer I

Test B Test
Test A,D
A, B, C, D
Test C

Test D

Test E Test D,G

Test F Test
Test B, E, F A, B, C, D,
Test G E, F, G

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 20
Using the Bridge Pattern to enable
early Integration Testing

♦ Usage of Design Patterns supports testing


♦ Use the bridge pattern to provide multiple
implementations under the same interface.

Client DBInterface DBImplementation

Stub Code Oracle MySQL

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 21
Summary

♦♦ Testing
Testing isis still
still aa black
black art,
art, but
but many
many rules
rules and
and heuristics
heuristics
are
are available
available
♦♦ Testing
Testing consists
consists of component-testing ((unit
of component-testing unit testing,
testing,
integration
integration testing)
testing) and
and system
system testing
testing
♦♦ Design
Design Patterns
Patterns can
can bebe used
used for
for integration
integration testing
testing
♦♦ Testing
Testing has
has its
its own
own lifecycle
lifecycle

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 22
Excurse: Agile Development

♦ Agile Development
♦ Extreme Programming (XP)

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 23
Agile Software Development:
Different Methods and Approaches

♦ Overall problem in software production:


Š Rapidly changing requirements
Š Complexity (software, models, notations)

♦ Dissatisfaction with the overheads involved in design


methods led to the creation of agile methods. Core
issues:
Š Focus on the code rather than the design;
Š Are based on an iterative approach to software development;
Š Are intended to deliver working software quickly and evolve this
quickly to meet changing requirements.

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 24
Agile Software Development:
The Agile Software Development Manifesto

♦ Permanent Customer Involvement


Š Role: Provide and prioriterize new system requirements
♦ Incremental delivery
Š Software is developed in increments
♦ People not process
Š Skills of team (members) should be appreciated
Š Should be left to work with their own methods, tools etc.
♦ Embrace change
Š Expect system requirements to change, so design the system to
accommodate these
♦ Maintain simplicity
Š Focus on simplicity in both software and development process
Š Work together in eliminate complexity

Æ http://agilemanifesto.org/
Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 25
Problems with agile methods

z It can be difficult to keep the interest of customers who are


involved in the process.
z Team members may be unsuited to the intense involvement
that characterizes agile methods.
- In particular shy and reserved people (“nerds”?)
z Prioritizing requirements can be difficult when there are
multiple stakeholders.
z Maintaining simplicity requires extra work.

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 26
Extreme Programming (Beck, 2000)

♦ Perhaps the best-known and most widely used agile


method.
♦ Extreme Programming (XP) takes an ‘extreme’ approach
to iterative development.
Š New versions may be built several times per day;
Š Increments are delivered to customers every 2 weeks;
Š All tests must be run for every build and the build is only accepted
if tests run successfully.
♦ Programming in pairs
♦ Continuously re-prioritizing of requirements (client,
customer, users)
♦ Client is part of development team and in charge

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 27
Life Cycle of XP

♦ In XP, user requirements are expressed as scenarios or user


stories.
♦ These are written on cards and the development team break
them down into implementation tasks. These tasks are the basis
of schedule and cost estimates.
♦ The customer chooses the stories for inclusion in the next
release based on their priorities and the schedule estimates.
Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 28
How does XP work? (1)
♦ The planning game
Š long-term plans only diffuse
Š Details in short-terms (some days)
Š customer is involved in every development cycle (some weeks)
Š tasks are handed out according to skills
♦ Short development cycles
Š enforce decomposition into small tasks
Š minimize risk
Š better integration of customer
♦ Simple Design
Š Design takes into account only short-term goals
Š Æ complexity is low
♦ Sustainable amount of time
Š Large amounts of overtime are not considered acceptable (reduce
quality)
Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 29
How does XP work? (2)
♦ Tests
Š Unit tests: For implementation details, are developed by the
developers themselves, are designed before development
Š “Test-first development”
Š enhances trust in system
♦ Refactoring
Š allow for continuous changes in design
Š Keep code simple and maintainable
♦ Programming in pairs
Š always pair-programming
Š changing pairs (daily)
Š distributes knowledge within the team

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 30
How does XP work? (3)
♦ Collective ownership: Source code belongs to the team
Š everybody can make changes (consultation)
Š no fixed responsibilities
Š pairs work on all areas, no islands of expertise
♦ Continuous integration
Š integration several times a day
Š system is error-free every evening
♦ Standards (Coding)
Š is commonly accepted
♦ Customer agent is part of the team
Š available (in case of questions)
Š works out feature tests

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 31
Conclusions (XP)

♦ Advantages
Š Flexible
Š Quick
Š Customer-centered
Š Team-oriented

♦ Disadvantages
Š little documentation (only tests und code)
Š Scalability problems (only small and medium projects)
Š Depends strongly on team members

Armin B. Cremers, Sascha Alda & Tobias Rho (based on Bruegge & Dutoit) Object-Oriented Software Construction 32

Potrebbero piacerti anche