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

6 - Software Testing Edited

The document discusses software testing including the goals of testing to verify that software meets requirements and finds defects, different stages of testing like unit, component, and system testing, and the importance of inspections and regression testing.

Uploaded by

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

6 - Software Testing Edited

The document discusses software testing including the goals of testing to verify that software meets requirements and finds defects, different stages of testing like unit, component, and system testing, and the importance of inspections and regression testing.

Uploaded by

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

COSC 316

Software Testing

2/19/2024 Software testing 1


Program Testing

DUAL PURPOSE

1. Shows that a program runs as it is intended to do.


2. Helps to discover program defects.
- Reveals the presence of errors NOT their absence.

2/19/2024 Software testing 2


Program testing goals

 To demonstrate to the developer and the customer that


the software meets its requirements.
 For custom software, this means that there should be at least
one test for every requirement in the requirements document.
 For generic software products, it means that there should be
tests for all of the system features, plus combinations of these
features, that will be incorporated in the product release.
 To discover situations in which the behavior of the
software is incorrect or undesirable.
 Defect testing is concerned with rooting out undesirable system
behavior such as system crashes, unwanted interactions with
other systems, incorrect computations and data corruption.

2/19/2024 Software testing 3


Verification vs validation

 Verification:
"Are we building the product right?”
 The software should conform to its specification.
 Validation:
"Are we building the right product?”
 The software should do what the user really requires.

2/19/2024 Software testing 4


Stages of Testing

1. Development testing - the system is tested during


development to discover bugs and defects.
2. Release testing – the product test group tests a
complete version of the system before it is released to
users.
3. User testing – potential future users of a system test it in
their own environment. Beta testing.

2/19/2024 Software testing 5


Stages of Testing
… Development Testing

 Development testing includes all testing activities that


are carried out by the team developing the system.
1. Unit testing, where individual program units are tested. Unit
testing should focus on testing the functionality of system
functions/procedures.
2. Component testing, where several individual units are
integrated to create composite components. Component
testing should focus on testing component interfaces.
3. System testing, where 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.
4. Inspections & reviews – engineer review the code developed
by other engineers.

2/19/2024 Software testing 6


Stages of Testing
…Development Testing
…… Unit testing

 Unit testing is the process of testing individual


components in isolation.
 It is a defect testing process.
 Units may be:
 Individual functions

2/19/2024 Software testing 7


Stages of Testing
…Development Testing
…… Unit testing

EXAMPLE
1. Implement Math function “Square Root”.
2. Function returns -1 for negative input.
3. Function rounds to nearest integer.
int sqrt_fnc(int number);

Test program:

test_sqrt_fnc();

2/19/2024 Software testing 8
Stages of Testing
…Development Testing
…… Unit testing

test_sqrt_fnc()
{
if (sqrt_fnc(0) != 0)
printf(“sqrt_fnc FAILED!\n”);
else if (sqrt_fnc(101) != 10)
printf(“sqrt_fnc FAILED!\n”);
else if (sqrt_fnc(-100) != -1)
printf(“sqrt_fnc FAILED!\n”);
else
printf(“sqrt_fnc PASSED!\n”);
}

2/19/2024 Software testing 9


Stages of Testing
…Development Testing
……Unit testing
……… Unit test effectiveness
 The test cases should show that, when used as
expected, the unit that you are testing does what it is
supposed to do.
 If there are defects in the component, these should be
revealed by test cases.
 This leads to 2 types of unit test cases:
 The first of these should reflect normal operation of a program
and should show that the component works as expected.
 The other kind of test case should be based on testing
experience of where common problems arise. It should use
abnormal inputs to check that these are properly processed and
do not crash the component.
2/19/2024 Software testing 10
Stages of Testing
…Development Testing
……Unit Testing
……… Regression testing
 Regression testing is testing the system to check that
changes have not ‘broken’ previously working code.
 In a manual testing process, regression testing is
expensive but, with automated testing, it is simple and
straightforward. All tests are rerun every time a change is
made to the program.
 Tests must run ‘successfully’ before the change is
committed.

2/19/2024 Software testing 11


Stages of Testing
…Development Testing
…… Component testing

 Software components are often composite components


that are made up of several interacting parts of the
system.
 You access the functionality of these parts through the
defined component interface.
 Testing composite components should therefore focus
on showing that the component interface behaves
according to its specification.
 You can assume that unit tests on the individual parts within the
component have been completed.

2/19/2024 Software testing 12


Stages of Testing
…Development Testing
…… System testing

 System testing during development involves integrating


components to create a version of the system and then
testing the integrated system.
 The focus in system testing is testing the interactions
between components.
 System testing checks that components are compatible,
interact correctly and transfer the right data at the right
time across their interfaces.
 System testing tests the emergent behaviour of a
system.

2/19/2024 Software testing 13


Stages of Testing
…Development Testing
…… Inspections and testing

 Software inspections Concerned with analysis of


the static system representation to discover problems
(static verification)
 May be supplemented by tool-based document and code
analysis.
 Software testing Concerned with exercising and
observing product behaviour (dynamic verification)
 The system is executed with test data and its operational
behaviour is observed.

2/19/2024 Software testing 14


Stages of Testing
…Development Testing
…… Software Inspections

 These involve people examining the source


representation with the aim of discovering anomalies and
defects.
 Inspections do not require execution of a system so may
be used before implementation.
 They may be applied to any representation of the system
(requirements, design, configuration data, test data, etc.)
 They have been shown to be an effective technique for
discovering program errors.

2/19/2024 Software testing 15


Stages of Testing
…Development Testing
……Software Inspections
……… Advantages of inspections
 During testing, errors can mask (hide) other errors.
Because inspection is a static process, you don’t have to
be concerned with interactions between errors.
 Incomplete versions of a system can be inspected
without additional costs. If a program is incomplete, then
you need to develop specialized test harnesses to test
the parts that are available.
 As well as searching for program defects, an inspection
can also consider broader quality attributes of a
program, such as compliance with standards, portability
and maintainability.

2/19/2024 Software testing 16


Stages of Testing
…Development Testing
……Software Inspections
……… Inspections and testing
 Inspections and testing are complementary and not
opposing verification techniques.
 Inspections can check conformance with a specification
but not conformance with the customer’s real
requirements.
 Inspections cannot check non-functional characteristics
such as performance, usability, etc.

2/19/2024 Software testing 17


Stages of Testing
…Development Testing
…… An input-output model of program testing

2/19/2024 Software testing 18


Stages of Testing
… Test Levels

 Software testing aims to establish confidence that the


system is ‘fit for purpose’.
 How much to test depends on:
 Software purpose
• The level of confidence depends on how critical the software is to
an organization.
 User expectations
• Users may have low expectations of certain kinds of software.
 Marketing environment
• Getting a product to market early may be more important than
finding defects in the program.

2/19/2024 Software testing 19


Stages of Testing
…Development Testing
…… General testing guidelines

 Choose inputs that force the system to generate all error


messages
 Design inputs that cause input buffers to overflow
 Repeat the same input or series of inputs numerous
times
 Force invalid outputs to be generated
 Force computation results to be too large or too small.

2/19/2024 Software testing 20


Stages of Testing
…Development Testing
…… Testing policies

 Exhaustive system testing is impossible so testing


policies which define the required system test coverage
may be developed.
 Examples of testing policies:
 All system functions that are accessed through menus should be
tested.
 Combinations of functions (e.g. text formatting) that are
accessed through the same menu must be tested.
 Where user input is provided, all functions must be tested with
both correct and incorrect input.

2/19/2024 Software testing 21


Stages of Testing
… Release testing

 Release testing is the process of testing a particular release


of a system that is intended for use outside of the
development team.
 The primary goal of the release testing process is to
convince the supplier of the system that it is good enough
for use.
 Release testing, therefore, has to show that the system delivers its
specified functionality, performance and dependability, and that it
does not fail during normal use.
 Release testing is usually a black-box testing process
where tests are only derived from the system specification.

2/19/2024 Software testing 22


Stages of Testing
… User testing

 User or customer testing is a stage in the testing process


in which users or customers provide input and advice on
system testing.
 User testing is essential, even when comprehensive
system and release testing have been carried out.
 The reason for this is that influences from the user’s working
environment have a major effect on the reliability, performance,
usability and robustness of a system. These cannot be replicated
in a testing environment.

2/19/2024 Software testing 23


Stages of Testing
… Types of user 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 with
the system developers.
 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.

2/19/2024 Software testing 24


Key points

 Testing can only show the presence of errors in a


program. It cannot demonstrate that there are no
remaining faults.
 Development testing is the responsibility of the software
development team. A separate team should be
responsible for testing a system before it is released to
customers.

2/19/2024 Software testing 25

You might also like