Professional Documents
Culture Documents
Chapter 3 - Testing Throughout The Software Life Cycle Part 1
Chapter 3 - Testing Throughout The Software Life Cycle Part 1
(ITS 64704)
Testing Throughout the Software Life Cycle
(Part 1)
Topics
Testing Levels
Testing Levels
Construction phase:
Requirement Definition
Construction phase:
Technical System Design
Component Specification
Programming
Component Testing
Integration testing
System testing
Acceptance testing
Validation
Validation
Validation
Validation
Verification in V Model
n
tio
ca
rifi
n Ve
tio
ca
rifi
Ve
n
tio
ca n
rifi tio
Ve ca
rifi
Ve
V Model: Summary
• Construction and test levels activities are separated but equal (left side/ right side)
• “V” illustrates the testing aspects of verification and validation.
• V-Model gives the impression that testing starts relatively late after implementation.
THIS IS WRONG.
• The test steps in the right branch of the model are to be understood as phases of test
execution
• The associated test preparation (test planning, test specification) starts earlier and is
performed in parallel with the development steps (in the left branch)
Iterative-Incremental Development Models
• Prototyping
• Rapid Application Development (RAD)
• Rational Unified Process (RUP)
• Agile Development Method
Tips for Good Testing
Testing Levels
• The distinction between different levels of testing is more than just a time-
based subdivision of testing activities.
• Test levels are distinguished from each other by:
different test objects
different test basis
different testing strategy
application of different test methods
using different testing tools
different goals and results
different responsibilities
different specialized test personnel required
• If configuration data is part of the system, the test of these data should also
be taken into account in the test planning.
BREAK FOR 10 MINUTES
Testing Levels
Top down
Test Levels
Bottom up
Integration Test
Ad-hoc
System Test
Big bang
Testing Levels
Top down
Test Levels
Bottom up
Integration Test
Ad-hoc
System Test
Big bang
Component Testing
• Component testing (unit testing) is the first test level, following directly after
the programming phase
• The created software modules are subjected to a systematic test for the first
time.
• Depending on the programming language used, these smallest units of
software are called differently
• modules, units or classes (in case of object oriented programming).
• the corresponding tests are called module, unit, and class testing.
• Abstracted from the programming language the terms components or
software modules are used.
Component Testing Test Harness
• If the testing exposes a defect, the cause can be assigned clearly to the tested
component.
• The component that is tested can also be made up of several modules which
are assembled into a unit. The objective of component testing is to test the
internal component aspects but not the interaction with neighbouring
components.
• The test basis for component testing is primarily the specification of the
component (created at the design stage) and their program code. In addition,
all other documents which are related to the tested component also could be
considered as test basis.
Component Testing: Test Harness
Drivers Stubs
Stubs and drivers are software replacement simulators required for modules not available
when performing a unit or an integration test.
Component Testing Test Harness: Stub & Driver
Driver
Driver
Drive
• Drivers are basically called in BOTTOM UP of M9
testing approach.
• In bottom up testing approach the bottom
level modules are prepared but the top level
modules are not prepared. M8 Module
on test
• Testing of the bottom level modules is not
possible with the help of main program.
Modules
• Hence, we prepare a dummy program or tested in an
driver to call the bottom level modules and M1 M2 earlier
perform its testing. stage
Driver: Example
Stubs
1. Stubs are created in the integration testing that is following Top-down
approach.
2. Stub is a piece of code emulating a called function. Stub is created by the
tester when high level modules are being tested and the other modules
are not yet created.
3. Overall testing is only possible when all the modules are present and
dummy modules have to be created to replicate basic functionality of
modules under construction.
4. A stub is basically a piece of code that simulates the activity of missing
modules. It just accepts the value from calling module and returns null
value.
Component Testing Test Harness: Stub & Driver
Stubs
• Stubs are basically used in TOP-DOWN
approach of integration testing.
• The upper modules are prepared first and Module
are ready for testing while the bottom tested in an
M9 earlier
modules are not yet prepared by the stage
developers.
• So in order to form the complete
application we create dummy programs M8 Module
on test
for the lower modules in the application
so that all the functionalities can be
tested.
Stub Stub
of M1 of M2
Component Testing Test Harness: Stub & Driver
Efficiency
• How economically the component handles the available computer resources. E.g memory
consumption in kilobytes, response time in milliseconds, etc
Maintainability
• includes properties of a program that will determine how easy or difficult it is going to be
to change or enhance the program.
• e.g code structure, modularity, commenting the code, understandability, currentness of
documents etc.
Component testing: Test Strategy
• The component test can therefore be carried out using white-box test techniques.
• The tester can create test cases by taking advantage of his/her knowledge of
component-internal program structures, methods and variables.
In practice, in many cases the component test is "only" carried out as a black-box test i.e.,
the inner structure is not used to design the test cases.
Top down
Test Levels
Bottom up
Integration Test
Ad-hoc
System Test
Big bang
Test-Driven Development (TDD) or
“Test First’ Approach: component level
Principle:
Primary goal:
• Let’s say that you want to write a program that will say,
“Hello, [name]!”, where name is whatever name you give it.
• (Ex. If your name was Hidayah, and you wanted your program
to say hello to you using your name: “Hello, Hidayah!”)
• If you don’t give your program a name, then you want it to
say, “Hello, world!” Write test first
before write
code
TDD Example
Pass
This example is using testing framework Jasmine
and test runner Test’em
Test-Driven Development (TDD) or
“Test First’ Approach: component level
run your tests and make sure that your new test fails
Top down
Test Levels
Bottom up
Integration Test
Ad-hoc
System Test
Big bang
Integration testing
• Each sub-system can be the basis for further integration of larger units.
• In practice
• a software system is rarely developed on a greenfield, but an existing
system is modified, extended or linked with other systems.
• many system components are standard products which are purchased on
the market.
• In component testing, those old or standard components probably go
unnoticed. In integration testing, these system parts need to be taken into
account and their interaction with other parts needs to be controlled.
Integration Testing Test Harness
• During integration testing, drivers are required, that provide the test objects
with test data, accept the test results, and record them.
• Any existing drivers from the component testing can normally be reused.
• As interface calls and data traffic needs to be tested via the driver interfaces,
integration testing often needs additional diagnostic tools called monitors to
read and record the data passed between the components.
Integration testing: Test Objectives
The objectives of integration testing are clear:
• detect defects in the interfaces.
• detect defects in the interaction between components.
• test non-functional characteristics (e.g. performance) if possible
Problems can occur even when trying to integrate two components, when they cannot be
built
• because their interface formats are incompatible
• because some data is missing
• because the developers have split the system into different components than
specified.
Other issues:
• Can be difficult to find problems affecting the performance of the interacting program
parts.
• These are defects in the data exchange between the components which can only be
detected by a dynamic test.
Integration testing: Test Objectives
Most failures that will occur in such tests are caused by functional defects of individual
components. So an implicit component test has to be executed in an unsuitable test
environment, which complicates the access to the single component.
As no suitable access to the single component is possible, some failures cannot be provoked
and therefore defects can not be found.
If a failure occurs in the test, it may be difficult or even impossible to narrow down its cause.
Integration strategy: Top down
• The test sequence begins with the component that calls other components, but (except
the operating system) is not called itself.
• The lower unavailable components are replaced by stubs.
• Successively, the components of lower system layers are integrated.
• Each tested higher layer serves as a driver.
Example of hierarchy
Integration strategy: Top down
Advantage
Disadvantage
• The test begins with the elementary components of the system that do not call other
components (except the functions of the operating system).
• Successively larger subsystems are assembled from tested components, followed by a
test of this integration.
Example of hierarchy
Integration strategy: Bottom up
Advantage
Disadvantage
• Both strategies can only be used in their pure form if the system to be tested
is programmed in a strictly hierarchical manner. This is rarely found in practice.
• The components are integrated, for example in the (random) order of their
completion.
• Once a component has completed its testing, it is checked whether it belongs
to an already existing and previously tested component, or it fits into a semi-
integrated subsystem.
• If so, both elements are integrated and the integration test is executed
between the two.
Advantage
• Time saved, as each component is integrated in its proper environment as
early as possible.
Disadvantage
• Stubs as well as drivers are needed.
Big – bang Integration testing
• The integration waits until all software components have been developed.
• Then, everything is thrown together at once.
• In the worst case, upstream component tests are abandoned
Example of hierarchy
Big – bang Integration testing
Disadvantage
• The waiting time for the big-bang to finish is a lost in test execution time.
• Since testing often suffers from a lack of time anyway, not one day of testing
should be given away.
• All failures are concentrated on one build; it will be difficult or impossible to
get the system to work at all.
• The localization and correction of defects is difficult and time consuming
Integration testing: Choosing a strategy
An optimal integration strategy (time and cost saving) depends on conditions that
must be analysed individually in each project :
The system architecture
• determines which and on how many components the whole system consist of and how they
depend on one another.
• defines when single components are to be developed and when they are ready for testing.
• determines how intensive the system aspects must be tested and at what specific test level.
• must establish an integration strategy from these conditions which is suitable for the project.
• This is done in consultation with the project manager.
To be continued…