Tải bản đầy đủ (.pdf) (66 trang)

Software testing: Dynamic testing

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.03 MB, 66 trang )

Presented by
Ngo Thi Hoan


Contents
 What is a testing technique?
 How to choose that which testing technique is best?
 Black box test techniques
 White box test techniques
 Error Guessing



What is a testing technique?
 a procedure for selecting or designing tests
 based on a structural or functional model of the software
 successful at finding faults
 'best' practice
 a way of deriving good test cases
 a way of objectively measuring a test effort

Testing should be rigorous, thorough and systematic


How to choose that which testing
technique is best?
 This is the wrong question!
 Each technique is good in its own way in finding out the
certain kind of defect, and not as good for finding out the
other kind of defects
 Ex: Structure-based technique – find out the


defect/problem in the code. Specification-based
techniques find out missing specification of code.
 Each individual technique is aimed at particular types of
defect. For example, state transition testing is unlikely to find
boundary defects.


Three types of systematic technique
Static (non-execution)
• examination of documentation,
source code listings, etc.

Functional (Black Box)
• based on behaviour /
functionality of software

Structural (White Box)
• based on structure
of software


Some test techniques
Dynamic

Static
etc.

Reviews
Inspection
Walkthroughs


Structural

Desk-checking

Symbolic
Execution

Non-functional

Functional

etc.

etc.

Control
Flow

Data
Flow

etc.

Behavioural

Static Analysis

Performance


etc.

Statement
Branch/Decision

Definition
-Use

Branch Condition

Equivalence
Partitioning

Usability

Arcs
LCSAJ

Branch Condition
Combination

Boundary
Value Analysis
Cause-Effect Graphing
Random

State Transition


Black box versus white box?

Black box appropriate
at all levels but
dominates higher
levels of testing
White box used
predominately
at lower levels.

Acceptance

System

Integration

Component


Black box versus white box?


Black- box testing
 Black Box Testing is testing technique having
no knowledge of the internal
functionality/structure of the system
 Black-box Testing focuses on testing the
function of the program or application against
its specification
 Determines whether combinations of inputs
and operations produce expected results
 It is also called as behavioral testing and

closed box testing.


Black-Box Testing Techniques
 Techniques defined in BS 7925-2
 Equivalence partitioning
 Boundary value analysis
 Decision table testing
 Cause-effect graphing

 State transition testing


Equivalence partitioning (EP)
 Divide (partition) the inputs, outputs, etc. into areas which are the same
(equivalent)
 Assumption: if one value works, all will work
 One from each partition better than all from one
 Ex: Login page, user field can accept 1 to 100 character:

invalid

valid
0

1

100

invalid

101


Equivalence partitioning (EP)
Conditions
Valid Equivalence class
1) 1<= VP <= 100

Invalid Equivalence Class
2) IP<1
3) IP>100

4) null
Result

Test cases

5. True

1) 1,5

6. False

2) 2,6

7. Error message

3) 3,6
4) 4,7



Boundary value analysis (BVA)
 This technique consists of developing test cases and data that focus on the
input and output boundaries of a given function

 faults tend to lurk near boundaries
 good place to look for faults
 test values on both sides of boundaries
 Ex: Login page: user field accepts 6 to 55 character.
 Test cases: Invalid test case (5, 56, null), Valid test case (6, 55, 7, 54).

invalid

valid
5

6

invalid
55

56


Example: Loan application
Customer Name

2-64 chars.

Account number


6 digits, 1st
non-zero

Loan amount requested
Term of loan

Monthly repayment

£500 to £9000
1 to 30 years

Term:
Repayment:
Interest rate:
Total paid back:

Minimum £10


Customer name
Number of characters:

invalid
Valid characters:

Conditions
Customer
name


Valid
Partitions
2 to 64 chars
valid chars

1

2

valid

A-Z
-’ a-z
space
Invalid
Partitions
< 2 chars
> 64 chars
invalid chars

64 65

invalid

Any
other
Valid
Boundaries
2 chars
64 chars


Invalid
Boundaries
1 chars
65 chars
0 chars


Account number
first character:

valid: non-zero
invalid: zero

number of digits:
invalid

Conditions
Account
number

Valid
Partitions
6 digits
1st non-zero

Invalid
Partitions
< 6 digits
> 6 digits

1st digit = 0
non-digit

5

6

7

valid

Valid
Boundaries
100000
999999

invalid

Invalid
Boundaries
5 digits
7 digits
0 digits


Loan amount
499
invalid

Conditions

Loan
amount

Valid
Partitions
500 - 9000

500

9000
valid

Invalid
Partitions
< 500
>9000
0
non-numeric
null

9001
invalid

Valid
Boundaries
500
9000

Invalid
Boundaries

499
9001


Condition template
Conditions

Valid
Partitions

Tag

Customer 2 - 64 chars
valid chars
name

V1
V2

Account
number

6 digits
1st non-zero

V3
V4

Loan
amount


500 - 9000

V5

Invalid
Valid
Tag
Tag
Boundaries
Boundaries
< 2 chars
D1
B1 1 char
X1 2 chars
> 64 chars
D2
B2 65 chars
X2 64 chars
0 chars
invalid char X3
D3
< 6 digits
D4
B3 5 digits
X4 100000
> 6 digits
D5
B4 7 digits
X5 999999

st
0 digits
1 digit = 0 X6
D6
non-digit
X7
< 500
D7
B5 499
X8 500
>9000
D8
B6 9001
X9 9000
0
X10
non-integer X11
null
X12
Invalid
Partitions

Tag


Design test cases
Customer
name
V1
V2

X1
X2
X3
B1
B2
D1
D2
D3

Account
number
V3
V4
X4
X5
X6
X7
B3
B4
D4
D5
D6

Loan
account
V5
X8
X9
X10
X11

X12
B5
B6
D7
D8

Valid test
cases
v1,v3,v5
v1,v4,v5
v1,b3,b5
v1,b5,b6
v2,v3,v5
....

Invalid test
cases
X1, X4, X8
X1,X5,X9
X1,X6,X10
....
....
...


Design test cases
Test
Case

Description


Expected Outcome

New Tags
Covered

1

Name:
Acc no:
Loan:
Term:

John Smith
123456
2500
3 years

Term:
Repayment:
Interest rate:
Total paid:

3 years
79.86
10%
2874.96

V1, V2,
V3, V4,

V5 .....

2

Name:
Acc no:
Loan:
Term:

AB
100000
500
1 year

Term:
Repayment:
Interest rate:
Total paid:

1 year
44.80
7.5%
537.60

B1, B3,
B5, .....


Test objectives?
Condition





Valid
Partition

Tag Invalid
Partition

Tag Valid
Boundary

Tag Invalid
Boundary

Tag

For a thorough approach: VP, IP, VB, IB
Under time pressure, depends on your test objective
- minimal user-confidence: VP only?
- maximum fault finding: VB first (plus IB?)


Decision tables
 A decision table is a good way to deal with combinations of things.
 Sometimes also referred as “Cause-effect” table.
 Cause – effect graphing was used to help derive the decision table.
 Explore combinations of inputs, situations or events,
 it is very easy to overlook specific combinations of input

 Start by expressing the input conditions of interest so that they are
either TRUE or FALSE


Example: student access
A university computer system allows students an allocation of
disc space depending on their projects.
If they have used all their allotted space, they are only allowed
restricted access, i.e. to delete files, not to create them. This is
assuming they have logged on with a valid username and
password.

What are the input and output conditions?


List the input and output conditions
• list the ‘input
conditions’ in the first
column of the table

• list the ‘output
conditions’ under the
input conditions

Input Conditions
Valid username
Valid password
Account in credit
Output Conditions
Login accepted

Restricted access


×