0% found this document useful (0 votes)
13 views

Software Engineering-Lecture 08

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Software Engineering-Lecture 08

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

CS/SE/IT1211 - Software Engineering

Lecture 08
Software Testing and Maintenance
BSc (Hons) Computer Science|Software Engineering|Information
Technology
Department of Computer Science
Faculty of Computing & Technology
Saegis Campus
Nugegoda.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) Seagis Campus 1


Software Testing and Maintenance
Lecture 08
Ms. Chathurangi D. Weerasinghe
MSc(UCSC, Col), BSc(Ruh)

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


3

Session
Outcomes
• Testing
– V&V
– Types of testing
• Black Box testing
• White box testing
– Software Testing Strategies
• Unit testing
• Integration Testing
• System Testing
• Acceptance Testing
• Maintenance
Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)
4

Story So Far …
• You have already learned how to carry out
– Feasibility Study
– Requirements Gathering, Analysis and Specification
– Design
– Implementation
• Now you have an implemented system with
you to start testing…..

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


5

What is Software Testing?

• “Software Testing is the process of executing a


program or system with the intent of finding errors”
[Myers, 79].
• “Program testing can be a very effective way to
show the presence of bugs, but it is hopelessly
inadequate for showing their absence” [Dijkstra, 1972]

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


6

Verification vs validation

• Verification:
"Are we building the product right"
–The software should conform to its specification – functional
and non-functional requirements

• Validation:
"Are we building the right product"
–The software should do what the user really requires which
might be different from specification

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


7

V & V Techniques
 Software inspections - Concerned with analysis of the static
system representation to discover problems (static
verification)
 No need to execute a software to verify it.
 Software testing - Concerned with exercising and observing
product behaviour (dynamic verification)
 The system is executed with test data and its operational
behaviour is observed

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


8

Inspections and testing

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


9

Think…

• Can we have a 100% error free


s/w?
– It is not possible to prove that there
are no faults in the software using
testing
• Why?

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


10

Why Can’t Every Defect be Found?

• Too many possible paths.


• Too many possible inputs.
• Too many possible user environments.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


11

Too Many Possible Paths

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


12

Too Many Possible Inputs

• Programs take input in a variety of ways:


mouse, keyboard, and other devices.
• Must test Valid and Invalid inputs.
• Most importantly, there are an infinite amount of
sequences of inputs to be tested.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


13

Too Many Possible User Environments


• Difficult to replicate the user’s combination of
hardware, peripherals, OS, and applications.
• Impossible to replicate a thousand-node network to test
networking software.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


14

Types of Testing

• Exhaustively testing of all possible input/output


combinations is too expensive
• There are 2 types of testing.
– Black box testing (Functional testing)
– Structural testing (White box testing)

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


15

Black Box Testing


• Testing focus on the software functional
requirements, and input/output.

Inputs Outputs

Module under test is


treated as a Black Box

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


16

White box testing

• Testing is based on the


structure of the program.
 In white box testing internal
structure of the program is
taken into account
 The test data is derived from the
structure of the software

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


17

Activity 1

• What are the differences between Black Box and


White box Testing ?

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


18

A model of the software testing process

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


19

Black box testing strategies

• Equivalence Class Testing:


– It is used to minimize the number of possible test cases to a
best level while maintaining reasonable test coverage.
• Boundary Value Testing:
– Boundary value testing is focused on the values at boundaries.
– This technique determines whether a certain range of values are
acceptable by the system or not. It is very useful in reducing the
number of test cases.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


20

Equivalence partitioning Example

• Example of a function which takes a parameter


“month”.
• The valid range for the month is 1 to 12, representing
January to December. This valid range is called a
partition.
• In this example there are two further partitions of invalid
ranges.
x<1 1 ≤ x ≤ 12 12 < x
Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)
21

Equivalence partitioning Example

• Test cases are chosen so that each partition


would be tested.

-2 5 17

x<1 1 ≤ x ≤ 12 12 < x

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


22

Equivalence partitions
• In equivalence-partitioning technique we need to test
only one condition from each partition.
– This is because we are assuming that all the conditions in
one partition will be treated in the same way by the
software.
• Equivalence partitioning is an effective approach to
testing because it helps to reduce the number of tests.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


23

Equivalence partitioning Example


• In company XYZ, to become a staff member one
has to be 18 years old. The retirement age is 57.
– Find the test values for the employment age.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


24

Activity
• In a Library, students can borrow books. There is a limit
given for students on the number of books they can
borrow at one time. A student can borrow 2-5 books at
one time.
• With equivalence partitioning identify the test values to
check the borrowing limit of a student at one time.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


25

Boundary value analysis


• Equivalence partitioning is not a stand alone method to
determine test cases. It is usually supplemented by
boundary value analysis.

• Boundary value analysis focuses on values on the edge


of an equivalence partition or at the smallest value on
either side of an edge.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


26

Equivalence partitioning with boundary value analysis

• Example of a function which takes a


parameter “month”.
• Test cases are supplemented with boundary values.

-2 1 5 12 17
0 2 11 13
x<1 1 ≤ x ≤ 12 12 < x

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


27

Activity
An online Movie ticket booking system lets users book movie tickets for currently
playing movies and newly releasing movies. When a user is going to make a
booking, he/she must select type of movie (English/Tamil/Hindi) and enter Type
of ticket (Full/Half). Also must enter No of Tickets wanted (1 to 10) and if taking
any children (age 3 to 12) must fill as “Yes” if not “No”. The maximum no of tickets
allowed for a booking is 10. The system interface shows multiple text boxes for
the user to enter the needed values.

Write 8 Sample test data to check the format and correctness of user- entered
data to the above system using equivalence partitioning and Boundary Value
Analysis. Use the Format given below.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


28

Software Testing Levels


– Unit testing : Individual program units or object classes are tested. Unit testing
should focus on testing the functionality of objects or methods.
– Integration testing : Several individual units are integrated to create
composite components. Component testing should focus on testing
component interfaces.
– System testing: Some or all of the components in a system are integrated and
the system is tested as a whole. System testing should focus on testing
component interactions.
– Acceptance Testing: Customers test a system to decide whether or not it is
ready to be accepted from the system developers and deployed in the
customer environment. Primarily for custom systems.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


29

Unit testing
• Unit testing is the process of testing individual
components in isolation.
• Unit testing can be automated, but may still be
performed manually.
• Units may be:
– Individual functions or methods within an object
– Object classes with several attributes and methods

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


30

Unit Testing
Method Used for unit testing: White Box Testing method is used for executing the unit test.

When should Unit testing be done?


Unit testing should be done before Integration testing.

By whom should unit testing be done?


Unit testing should be done by the developers.

Advantages of Unit testing:


1.Issues are found at early stage. Since unit testing are carried out by developers where they
test their individual code before the integration. Hence the issues can be found very early and
can be resolved then and there without impacting the other piece of codes.
2. Unit testing helps in maintaining and changing the code.
3.Since the bugs are found early in unit testing it also helps in reducing the cost of bug fixes.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


31

Integration Testing

• Integration testing is the phase in software testing in which


individual software modules are combined and tested as a
group.
• It occurs after unit testing and before system testing.
• Integration Testing
– Big Bang Testing
– Top Down Testing
– Bottom Up Testing
Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)
32

System testing

• System testing is the testing of a


complete and fully integrated
software product.
• System testing is actually a series
of different tests whose sole
purpose is to exercise the full
computer based system.

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


33

Acceptance testing
• Alpha testing
– Users of the software work with the development team to
test the software at the developer’s site.
• Beta testing
– A release of the software is made available to users to allow
them to experiment and to raise problems that they discover.
– tested by users in an uncontrolled environment

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


34

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


35

Life cycle model for testing


DEVELOPMENT TESTING

Requirements Acceptance

High-level design System

Detailed design Integration

Implementation Unit

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


Software Maintenance

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) 36


37

Software Maintenance
“Managing the processes of system change”

• Modifying a program after it has been put into use.


• Software Maintenance results in a service being delivered to
the customer.
• The change may be simple changes to correct coding errors,
more extensive changes to correct design errors or significant
enhancement to correct specification error or accommodate
new requirements

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


38
Development/Maintenance
Costs

System1

System2

0 50 100 150 200 250 300 350 400 450 500 $

Development costs Maintenance costs

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


39

Types of Maintenance

• Perfective maintenance
–Changing a system to make it meet its requirements more
effective. Adding Functionality.
• Adaptive maintenance
–Maintenance due to changes in environment. New Operating
Systems, new hardware
• Corrective maintenance
–Correct newly found bugs

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh)


Questions?

Ms. Chathurangi D. Weerasinghe, MSc(UCSC Col), BSc(Ruh) 40

You might also like