29
Software Testing: Overview CS6407

Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

  • Upload
    others

  • View
    15

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Software Testing: Overview

CS6407

Page 2: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Objectives

• Overview of Software Testing Principles

• Test Planning

• Types of Software Tests

• Test Execution and Reporting

• Real-Time Testing

Page 3: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Software Testing and Debugging

• Testing Applying tests to a program to find its faults • Verification Proving the program’s correctness. • Validation Finding errors by executing the program in a real

environment • Debugging Diagnosing the error and correcting it

Page 4: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Test Planning Define the functions, roles and methods for all

test phases. Test planning usually starts during the

requirements phase. Major test plan elements are:

1. Objectives for each test phase 2. Schedules and responsibilities for each test activity 3. Availability of tools, facilities and test libraries. 4. Set the criteria for test completion

Page 5: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Test Planning (cont.)

• Need to specify a clear plan – E.g., Gantt chart

• Test plan incorporated within overall software development plan

• Must adopt a clear software process framework – Waterfall method: testing done at end

– Agile methods: testing done with each build

Page 6: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Types of Software Tests

• Integration Testing – Interface testing

• Function Testing (Black Box)

• Unit Testing (White Box)

• Regression Testing

• System Test

• Acceptance and Installation Tests

Page 7: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Integration Testing

• Top-down

• Bottom-up

Page 8: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Top-down Integration Testing

• The control program is tested first.

• Modules are integrated one at a time

• Emphasize interface testing

• Advantages: – No test drivers needed

– Interface errors are discovered early

– Modular features aid debugging

• Disadvantages:

– Test stubs are needed

– Errors in critical modules at low levels are found late.

Page 9: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

A

B

T1

T2

T3

A

B

C

T4

T3

T2

T1

Top-down Testing

Page 10: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Bottom-up Integration Test

• Allow early testing aimed at proving feasibility

Emphasize module functionality and performance

• Advantages:

– No test stubs are needed – Errors in critical modules are found early

• Disadvantages:

– Test drivers are needed – Interface errors are discovered late

Page 11: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Test Drivers

Level N

Level N-1 Level N-1

Level N Level N

Test Drivers

Test Drivers

Test Drivers

Test Drivers

Bottom-up testing

Page 12: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Testing Process

• Define testing procedure

• Run tests

• Collect results

• Analyse results

12

Page 13: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Test case/data

A test case is a pair consisting of • test data to be input to the program

• The test data is a set of values, one for each input variable.

• expected output • Derived from an oracle

A test set is a collection of zero or more test cases.

Sample test case for sort:

Test data: <'A' 12 -29 32 >

Expected output: -29 12 32

Page 14: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Example: Data Center

Optimisation Thermal

Ascending Temp array[floats] Rate: every 5 minutes

sort Criticality

analysis

Page 15: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Test plan

A test cycle is often guided by a test plan.

Example: The sort program is to be tested to meet the

requirements given earlier. Specifically, the following

needs to be done.

• Execute sort on at least two input

sequences, one with ``A'' and the other

with ``D'' as request characters.

Page 16: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Test plan (contd.)

• Execute the program on an empty input

sequence.

• Test the program for robustness against

erroneous inputs such as ``R'' typed in as the

request character.

• All failures of the test program should be

recorded in a suitable file using the Company

Failure Report Form.

Page 17: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

• Takes place when modules or sub-systems are

integrated to create larger systems

• Objective

– detect faults due to interface errors or invalid

assumptions about interfaces

• Particularly important for object-oriented

development as objects are defined by their

interfaces

Interface testing

Page 18: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Interface testing

Testcases

BA

C

Page 19: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Dummy Stubs for Interfaces

T e s t c a s e s

Dummy Stubs

Dummy Stubs

Page 20: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Interfaces types

• Parameter interfaces

– Data passed from one procedure to another

• Shared memory interfaces

– Block of memory is shared between procedures

• Procedural interfaces

– Sub-system encapsulates a set of procedures to be called by

other sub-systems

• Message passing interfaces

– Sub-systems request services from other sub-systems

Page 21: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Interface errors

• Interface misuse

– A calling component calls another component and makes an

error in its use of its interface

– e.g. parameters in the wrong order

• Interface misunderstanding

– A calling component embeds incorrect assumptions about the

behaviour of the called component

• Timing errors

– The called and the calling component operate at different

speeds and out-of-date information is accessed

Page 22: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Interface testing guidelines

• Design tests so that parameters to a called procedure

are at the extreme ends of their ranges

• Always test pointer parameters with null pointers

• Design tests that cause the component to fail

• Use stress testing in message passing systems

• In shared memory systems, vary the order in which

components are activated

Page 23: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Stress testing

• Exercises the system beyond its maximum design load.

– Stressing the system often causes defects to

come to light

• Stressing the system tests failure behaviour

– Systems should not fail catastrophically.

– Stress testing checks for unacceptable loss of service or data

• Particularly relevant to distributed systems

– can exhibit severe degradation as a network becomes

overloaded

Page 24: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Function Testing (Black Box)

• Designed to exercise the to its external specifications

• Testers not biased by knowledge of the program’s design.

• Disadvantages: 1. The need for explicitly stated requirements 2. Only cover a small portion of the possible test

conditions.

Page 25: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Unit Testing (White Box)

• Individual components are tested. – Many different approaches possible

– Control-flow/data-flow/etc.

• To focus on a relatively small segment of code and execute its properties

• Disadvantage: – the tester may be biased by previous experience.

And the test value may not cover all possible values.

Page 26: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Regression Testing • Test the effects of the newly introduced

changes on all the previously integrated code.

• The common strategy is to accumulate a comprehensive regression bucket but also to define a subset.

• The full bucket is run only occasionally, but the subset is run against every spin.

• Disadvantages: 1. To decide how much of a subset to use and which tests to

select.

Page 27: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Test Execution & Reporting • Testing should be treated like an experiment.

• Testing require that all anomalous behavior be noted and investigated.

• Big companies keep a special library with all copies of test reports, incident forms, and test plans

Page 28: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

Real-Time Testing Real-Time testing is necessary because the

deployment system is usually more complicate than development system

Rules apply for testing real time system 1. Evaluate possible deadlocks, thrashing to special timing

conditions 2. Use tests to simulate hardware faults. 3. Use hardware simulation to stress the software design. 4. Design ways to simulate modules missing in the

development system.

Page 29: Software Testing: Overview - University College Corkgprovan/CS6407/L2-Testing-Overview.pdf · Software Testing: Overview CS6407 . Objectives •Overview of Software Testing Principles

References

• DeMillo, Software Testing and Evaluation Benjamin/Cummings Publishing Company, Inc California, 1987.

• Sommerville, Software Engineering Addison-Wesley Publishing Company, 1996

• Humphrey, Managing the Software Process, Addison-Wesley Publishing Company, 1990.