N this chapter, we will introduce you to the fundamentals of testing: why testing is


partition at least once. So for example, we might choose to calculate the interest



tải về 6.34 Mb.
Chế độ xem pdf
trang11/25
Chuyển đổi dữ liệu03.04.2023
Kích6.34 Mb.
#54490
1   ...   7   8   9   10   11   12   13   14   ...   25
Foundations of Software Testing ISTQB Certification 3rd ed


partition at least once. So for example, we might choose to calculate the interest
on balances of
−$10.00, $50.00, $260.00 and $1348.00. If we hadn’t specifically
Equivalence partition
A portion of an input
or output domain for
which the behaviour of a
component or system is
assumed to be the same,
based on the specification.
82
Chapter 4 Test design techniques


identified these partitions, it is possible that at least one of them could have been
missed at the expense of testing another one several times over. Note that we could
also apply equivalence partitioning to outputs as well. In this case we have three
interest rates: 3%, 5% and 7%, plus the error message for the invalid partition (or
partitions). In this example, the output partitions line up exactly with the input
partitions.
How would someone test this without thinking about the partitions? A naïve
tester (let
’s call him Robbie) might have thought that a good set of tests would be to
test every $50. That would give the following tests: $50.00, $100.00, $150.00,
$200.00, $250.00,
… say up to $800.00 (then Robbie would have got tired of it and
thought that enough tests had been carried out). But look at what Robbie has tested:
only two out of four partitions! So if the system does not correctly handle a negative
balance or a balance of $1000 or more, he would not have found these defects
– so
the naïve approach is less effective than equivalence partitioning. At the same time,
Robbie has four times more tests (16 tests versus our four tests using equivalence
partitions), so he is also much less efficient! This is why we say that using
techniques such as this makes testing both more effective and more efficient.
Note that when we say a partition is
‘invalid’, it doesn’t mean that it represents a
value that cannot be entered by a user or a value that the user isn
’t supposed to enter.
It just means that it is not one of the expected inputs for this particular field. The
software should correctly handle values from the invalid partition, by replying with
an error message such as
‘Balance must be at least $0.00’.
Note also that the invalid partition may be invalid only in the context of crediting
interest payments. An account that is overdrawn will require some different action.
Boundary value analysis
Boundary value analysis (BVA) is based on testing at the boundaries between
partitions. It is essentially an enhancement or extension of equivalence partitioning,
and can also be used to extend other black-box (and white-box) test design techniques.
If you have ever done
‘range checking’, you were probably using the boundary value
analysis technique, even if you weren
’t aware of it. Note that we have both valid
boundaries (in the valid partitions) and invalid boundaries (in the invalid partitions).
As an example, consider a printer that has an input option of the number of
copies to be made, from 1 to 99.
Invalid
Valid
Invalid
0 1
99 100
To apply boundary value analysis, we will take the minimum and maximum
(boundary) values from the valid partition (1 and 99 in this case) together with
the first or last value respectively in each of the invalid partitions adjacent to the
valid partition (0 and 100 in this case). In this example we would have three
equivalence partitioning tests (one from each of the three partitions) and four
boundary value tests.
Consider the bank system described in the section about equivalence partitioning.
Invalid partition
Valid (for 3% interest)
Valid (for 5%)
Valid (for 7%)
–$0.01 $0.00
$100.00 $100.01
$999.99 $1000.00
Boundary value
analysis A black box
test design technique in
which test cases are
designed based on
boundary values.
Boundary value An
input value or output
value which is on the
edge of an equivalence
tải về 6.34 Mb.

Chia sẻ với bạn bè của bạn:
1   ...   7   8   9   10   11   12   13   14   ...   25




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương