software testing

32
SOFTWARE TESTING

Upload: aman-adhikari

Post on 06-Aug-2015

61 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Software testing

SOFTWARE TESTING

Page 2: Software testing

Software Testing: An Introduction

Testing is the process of exercising a program with the specific intent of finding errors prior to delivery to the end user.

Testing is intended to show that a program does what it is intended to do and to discover program defects before it is put into use.

When you test software, you execute a program using artificial data.

You check the results of the test run for errors, anomalies or information about the program’s non-functional attributes.

Can reveal the presence of errors NOT their absence. Testing is part of a more general verification and validation

process, which also includes static validation techniques.

Page 3: Software testing

Objectives

To uncover errors. 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, undesirable or does not conform to its specification. Defect testing is concerned with rooting out undesirable system

behavior such as system crashes, unwanted interactions with other systems, incorrect computations and data corruption.

Page 4: Software testing

Testability

Operability—it operates cleanly Observability—the results of each test case

are readily observed Controlability—the degree to which testing

can be automated and optimized Decomposability—testing can be targeted Simplicity—reduce complex architecture and

logic to simplify tests Stability—few changes are requested during

testing Understandability—of the design

Page 5: Software testing

What Testing Shows

errors

requirements conformance

performance

an indicationof quality

Page 6: Software testing

developer independent testerUnderstands the system but, will test "gently"

and, is driven by "delivery"

Must learn about the system,but, will attempt to break itand, is driven by quality

Who Tests the Software?

Page 7: Software testing

Testing Principles

These are the basic principles that guide software testing: All tests should be traceable to customer

requirements Tests should be planned long before testing begins The Pareto principle applies to software testing

Pareto principle implies that 80% of all errors uncovered during testing will likely be traceable to 20% of all program components. The problem of course, is to isolate these suspect components and to thoroughly test them.

Testing should begin ‘in the small’ and progress toward testing ‘in the large’.

Page 8: Software testing

Testing Principles Continue…

Exhaustive testing is not possible To be more effective, testing should be

conducted by an independent third party

Page 9: Software testing

Types of Testing

Methods

Strategies

white-boxmethods

black-box

methods

Page 10: Software testing

White-Box Testing

White-Box testing is a test case design method that uses the control structure of the procedural design to derive test cases.

Using white-box testing methods, the software engineer can derive test cases that Guarantee that all independent paths within a

module have been exercised at least once Exercise all logical decisions on their operational

bounds Execute all loops at their boundaries and within

their operational bounds Exercise internal data structures to ensure their

validity

Page 11: Software testing

White-Box Testing

... our goal is to ensure that all statements and conditions have been executed at least once ...

Page 12: Software testing

Why Cover?logic errors and incorrect assumptions are inversely proportional to a path's

execution probability

we often believe that a path is not likely to be executed; in fact, reality is often counter intuitive

typographical errors are random; it's likely that untested paths will contain

some

Page 13: Software testing

Basic Path Testing

First, we compute the cyclomatic complexity:

number of simple decisions + 1

or

number of enclosed areas + 1

In this case, V(G) = 4

Page 14: Software testing

Cyclomatic Complexity

A number of industry studies have indicated that the higher V(G), the higher the probability

or errors.

V(G)

modules

modules in this range are more error prone

Page 15: Software testing

Basis Path Testing

Next, we derive the independent paths:

Since V(G) = 4,there are four paths

Path 1: 1,2,3,6,7,8Path 2: 1,2,3,5,7,8Path 3: 1,2,4,7,8Path 4: 1,2,4,7,2,4,...7,8

Finally, we derive testcases to exercise these paths.

1

2

34

5 6

7

8

Page 16: Software testing

Loop Testing

Nested Loops

Concatenated Loops

Simple loop

Page 17: Software testing

Black-Box Testing

requirements

eventsinput

output

Page 18: Software testing

Equivalence Partitioning

userqueries mouse

picks

outputformats

prompts

FKinput data

Page 19: Software testing

Sample Equivalence Classes

user supplied commandsresponses to system promptsfile namescomputational data physical parameters bounding values initiation valuesoutput data formattingresponses to error messagesgraphical data (e.g., mouse picks)

data outside bounds of the program physically impossible dataproper value supplied in wrong place

Valid data

Invalid data

Page 20: Software testing

Boundary Value Analysis

outputdomain

userqueries mouse

picks

outputformats

prompts

FKinput data

input domain

Page 21: Software testing

Other Black Box Techniques

error guessing methods

decision table techniques

cause effect graphing

Page 22: Software testing

Validation and defect testing

The first goal leads to validation testing You expect the system to perform correctly

using a given set of test cases that reflect the system’s expected use.

The second goal leads to defect testing The test cases are designed to expose

defects. The test cases in defect testing can be deliberately obscure and need not reflect how the system is normally used.

Page 23: Software testing

Testing process goals

Validation testing To demonstrate to the developer and the system

customer that the software meets its requirements A successful test shows that the system operates as

intended. Defect testing

To discover faults or defects in the software where its behaviour is incorrect or not in conformance with its specification

A successful test is a test that makes the system perform incorrectly and so exposes a defect in the system.

Page 24: Software testing

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.

Page 25: Software testing

V & V confidence

Aim of V & V is to establish confidence that the system is ‘fit for purpose’.

Depends on system’s purpose, user expectations and marketing environment Software purpose

The level of confidence depends on how critical the software is to an organisation.

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.

Page 26: Software testing

Stages of testing

Development testing, where the system is tested during development to discover bugs and defects.

Release testing, where a separate testing team test a complete version of the system before it is released to users.

User testing, where users or potential users of a system test the system in their own environment.

Page 27: Software testing

Development testing

Development testing includes all testing activities that are carried out by the team developing the system. Unit testing, where individual program units or object

classes are tested. Unit testing should focus on testing the functionality of objects or methods.

Component testing, where several individual units are integrated to create composite components. Component testing should focus on testing component interfaces.

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.

Page 28: Software 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 or methods within an object

Object classes with several attributes and methods

Composite components with defined interfaces used to access their functionality.

Page 29: Software 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.

Page 30: Software testing

System and component testing

During system testing, reusable components that have been separately developed and off-the-shelf systems may be integrated with newly developed components. The complete system is then tested.

Components developed by different team members or sub-teams may be integrated at this stage. System testing is a collective rather than an individual process. In some companies, system testing may involve a

separate testing team with no involvement from designers and programmers.

Page 31: Software 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.

Page 32: Software testing

The acceptance testing process