+ All Categories
Home > Documents > Sommerville Chapter 8 (we will come back here later ...

Sommerville Chapter 8 (we will come back here later ...

Date post: 23-Feb-2022
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
27
Software Testing: Requirements Based (Black box) Sommerville Chapter 8 (we will come back here later) Fall 2013 CSci 5801 - Dr. Mats Heimdahl 1
Transcript
Page 1: Sommerville Chapter 8 (we will come back here later ...

Software Testing:Requirements Based(Black box)

Sommerville Chapter 8 (we will come back here later)

Fall 2013 CSci 5801 - Dr. Mats Heimdahl 1

Page 2: Sommerville Chapter 8 (we will come back here later ...

Topics for Today

Black-Box Tests

Selecting Black-Box Test Cases

Fall 2013CSci 5801 - Dr. Mats Heimdahl2

Page 3: Sommerville Chapter 8 (we will come back here later ...

Black and White Box

Fall 2013CSci 5801 - Dr. Mats Heimdahl3

Page 4: Sommerville Chapter 8 (we will come back here later ...

Black-Box Testing

Does passing this test case indicate that the system has correctly implemented the requirement?

If Switch is pressed or Clap is detected, then Light will turn on

1. Switch = Pressed, Light = On

Input

Expected Output

2. Clap_Detected = True, Light = On

3. Switch = Pressed, Clap_Detected = True, Light = On

4.. Switch = Not Pressed, Clap_Detected = False

Page 5: Sommerville Chapter 8 (we will come back here later ...

Black-Box Testing

Fall 2013CSci 5801 - Dr. Mats Heimdahl5

Input test data

Output results

Software

Ie

Input causing anomalous behavior

Oe

Output which reveal the presence of defects

Page 6: Sommerville Chapter 8 (we will come back here later ...

Independently Testable Feature

A well defined function that can be tested in (somewhat) isolation

Identified to “divide and conquer” the complexity of functionality

Described by all the inputs that form their execution environment

Fall 2013CSci 5801 - Dr. Mats Heimdahl6

Page 7: Sommerville Chapter 8 (we will come back here later ...

Examples

Class Registration

What are some independently testable features?

Fall 2013CSci 5801 - Dr. Mats Heimdahl7

Page 8: Sommerville Chapter 8 (we will come back here later ...

Fall 2013CSci 5801 - Dr. Mats Heimdahl8

Ie Ie

Equivalence Partitioning

Oe

Software

Page 9: Sommerville Chapter 8 (we will come back here later ...

Equivalence Class?

A group of tests form an equivalence class if

They all test the same thing

If one test reveals a fault, the other ones (probably) will too

If a test does not reveal a fault, the other ones (probably) will not either

Fall 2013CSci 5801 - Dr. Mats Heimdahl9

Page 10: Sommerville Chapter 8 (we will come back here later ...

What Goes in an Equivalence?

There must be a good reason to group tests in one equivalence class

They involve the same input variables

The result in similar (identical?) operations in the program

They affect the same output variable

None force the program to do error handling, or all of them do

Fall 2013CSci 5801 - Dr. Mats Heimdahl10

Page 11: Sommerville Chapter 8 (we will come back here later ...

Equivalence Partitioning—1

Partition system inputs and outputs into “equivalence sets”

If input is a 5-digit integer between 10,000 and 99,999, equivalence partitions are <10,000, 10,000-99, 999 and > 100, 000

Choose test cases in these partitions

5,000, 50,000, 150,000

Fall 2013CSci 5801 - Dr. Mats Heimdahl11

Page 12: Sommerville Chapter 8 (we will come back here later ...

Equivalence Partitions

Fall 2013CSci 5801 - Dr. Mats Heimdahl12

More than 10Between 4 and 10Less than 4

Number of input values

27

15

More than 99,999Between 10,000 and 99,999Less than 10,000

Input values

5,000150,000

50,000

Page 13: Sommerville Chapter 8 (we will come back here later ...

Fall 2013CSci 5801 - Dr. Mats Heimdahl13

Equivalence Classes for Max

FUNCTION Max(a IS INTEGER, b IS INTEGER): INTEGER

Page 14: Sommerville Chapter 8 (we will come back here later ...

Fall 2013CSci 5801 - Dr. Mats Heimdahl14

Equivalence Classes for Max

FUNCTION Max(a IS INTEGER, b IS INTEGER): INTEGER

FUNCTION Max(a IS INTEGER, b IS INTEGER): INTEGER EQUALS a IF a > b EQUALS b IF a < bEND FUNCTION

FUNCTION Max(a IS INTEGER, b IS INTEGER): INTEGER EQUALS a IF a > b and a != 4 EQUALS b IF a <= b and a != 4 EQUALS 0 IF a = 4END FUNCTION

Page 15: Sommerville Chapter 8 (we will come back here later ...

Equivalence Partitioning—2

Partition system inputs and outputs into “equivalence sets”

If input is a 5-digit integer between 10,000 and 99,999, equivalence partitions are <10,000, 10,000-99, 999 and > 100, 000

Choose test cases at the boundary of these sets also

00000, 5000, 9999, 10000, 10001, 50000, 99999, 100000, 100001, 100001, 150000

Fall 2013CSci 5801 - Dr. Mats Heimdahl15

Page 16: Sommerville Chapter 8 (we will come back here later ...

Fall 2013CSci 5801 - Dr. Mats Heimdahl16

Equivalence Partitions Revisited

More than 99,999Between 10,000 and 99,999Less than 10,000

Input values

9,999 10,000 99,999 100,00050,0000 5,000

150,000

More than 10Between 4 and 10Less than 4

Number of input values

437

10 112

0100

Page 17: Sommerville Chapter 8 (we will come back here later ...

Partition Testing

Basic idea: Divide program input space into (quasi-) equivalence classes

Underlying idea of specification-based, structural, and fault-based testing

Fall 2013CSci 5801 - Dr. Mats Heimdahl17

FSE’98 Tutorial: SW Testing and Analysis: Problems and Techniques (c) 1998 Mauro Pezzè & Michal Young

Page 18: Sommerville Chapter 8 (we will come back here later ...

Finding Equivalence Classes

Look for ranges of numbers

Look for membership in a group

Look for time dependent equivalence classes (pump accident)

Analyze responses to lists and menus

Look for equivalent output events

Look for equivalent operating environments

Do not forget equivalence classes for invalid inputs

Organize your classification

Fall 2013CSci 5801 - Dr. Mats Heimdahl18

Page 19: Sommerville Chapter 8 (we will come back here later ...

Look for Ranges of Numbers

If input is a 5-digit integer between 10,000 and 99,999, equivalence partitions are <10,000, 10,000-99, 999 and > 10, 000

May want to consider non-numbers as a special equivalence class

Fall 2013CSci 5801 - Dr. Mats Heimdahl19

Page 20: Sommerville Chapter 8 (we will come back here later ...

Look for Membership in a Group

Consider the following inputs to a program

A valid C++ identifier

A letter

A country name

All make up equivalence classes

All can then be subdivided further

How?

Fall 2013CSci 5801 - Dr. Mats Heimdahl20

Page 21: Sommerville Chapter 8 (we will come back here later ...

Time Dependent Classes

Push the “Esc” key before, during, and after the program is writing to (or reading from) disk

The timing and duration of an input may be as important as the value of the input

Very hard and also very critical

Fall 2013CSci 5801 - Dr. Mats Heimdahl21

Page 22: Sommerville Chapter 8 (we will come back here later ...

Look for Equivalent Outputs

It may be easier to find good tests by looking at the outputs (work backwards)

A graphics routine that draws lines on a canvas

No line

Thin short line

Thin long line

Thick short line

Etc.

Fall 2013CSci 5801 - Dr. Mats Heimdahl22

Page 23: Sommerville Chapter 8 (we will come back here later ...

Responses to Lists and Menus

Menu choices naturally partitions the input domain

Do you want to print? (Y, Yes, yes, y and N, No, no, n)

In graphical interfaces you have many combinations of things

Topic for a different day

Fall 2013CSci 5801 - Dr. Mats Heimdahl23

Page 24: Sommerville Chapter 8 (we will come back here later ...

Equivalent Operating Environments

The environment may effect the behavior of a program

Memory may effect the program

Try with different sized machines

Processor speed (race conditions)

Client server environments

No clients, some clients, many clients

PeopleSoft problems

Fall 2013CSci 5801 - Dr. Mats Heimdahl24

Page 25: Sommerville Chapter 8 (we will come back here later ...

Do Not Forget Invalid Inputs!

Most likely to cause problems Exception handling is a well know problem

area

People tend to think about what the program shall do, not what it shall protect itself against

Take this into account with all selection criteria we have discussed this far

Fall 2013CSci 5801 - Dr. Mats Heimdahl25

Page 26: Sommerville Chapter 8 (we will come back here later ...

Fall 2013 CSci 5801 - Dr. Mats Heimdahl

26

Organize the Classification

Input/Output Valid Classes Invalid Classes

Enter a number (n) 1<= n <= 99 n=0n>99n<0n not a number

Enter first letter of a name

character is capital lettercharacter is lower case letter

character is not a letter

Etc Etc Etc

Page 27: Sommerville Chapter 8 (we will come back here later ...

We Have Learned

Test definitions and language

Black box testing is concerned with the functional specification of the software

Equivalence partitions are sets of test cases where the program should behave in an equivalent way

Use guidelines to help you find good partitions

Next time

Sommerville Chapter 5

Web reading

Will It Work?

Fall 2013CSci 5801 - Dr. Mats Heimdahl27


Recommended