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


partitioning, with three-value boundaries. He makes a distinction between open



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


partitioning, with three-value boundaries. He makes a distinction between open
and closed boundaries, where a closed boundary is one where the point is included
in the domain. So the convention is for the valid partition to have closed boundaries.
You may be pleased to know that you don
’t have to know this for the exam! British
Standard 7925
–2 Standard for Software Component Testing also defines a three-
value approach to boundary value analysis.
So which approach is best? If you use the two-value approach together with
equivalence partitioning, you are equally effective and slightly more efficient than
the three-value approach. (We won
’t go into the details here but this can be
demonstrated.) In this book we will use the two-value approach. In the exam, you
may have a question based on either the two-value or the three-value approach, but
it should be clear what the correct choice is in either case.
Designing test cases
Having identified the conditions that you wish to test, in this case by using
equivalence partitioning and boundary value analysis, the next step is to design
the test cases. The more test conditions that can be covered in a single test case, the
fewer test cases will be needed in order to cover all the conditions. This is usually
the best approach to take for positive tests and for tests that you are reasonably
confident will pass. However if a test fails, then we need to find out why it failed

which test condition was handled incorrectly? We need to get a good balance
between covering too many and too few test conditions in our tests.
Section 3 Specification-Based or Black-Box Techniques 87


Let
’s look at how one test case can cover one or more test conditions. Using the
bank balance example, our first test could be of a new customer with a balance of
$500. This would cover a balance in the partition from $100.01 to $999.99 and an
output partition of a 5% interest rate. We would also be covering other partitions
that we haven
’t discussed yet, for example a valid customer, a new customer, a
customer with only one account, etc. All of the partitions covered in this test are
valid partitions.
When we come to test invalid partitions, the safest option is probably to try to
cover only one invalid test condition per test case. This is because programs may
stop processing input as soon as they encounter the first problem. So if you have an
invalid customer name, invalid address, and invalid balance, you may get an error
message saying
‘invalid input’ and you don’t know whether the test has detected
only one invalid input or all of them. (This is also why specific error messages are
much better than general ones!)
However, if it is known that the software under test is required to process all
input regardless of its validity, then it is sensible to continue as before and
design test cases that cover as many invalid conditions in one go as possible.
For example, if every invalid field in a form has some red text above or below
the field saying that this field is invalid and why, then you know that each field
has been checked, so you have tested all of the error processing in one test case.
In either case, there should be separate test cases covering valid and invalid
conditions.
To cover the boundary test cases, it may be possible to combine all of the
minimum valid boundaries for a group of fields into one test case and also the
maximum boundary values. The invalid boundaries could be tested together if
the validation is done on every field; otherwise they should be tested separately,
as with the invalid partitions.
Why do both equivalence partitioning and boundary
value analysis?
Technically, because every boundary is in some partition, if you did only boundary
value analysis you would also have tested every equivalence partition. However,
this approach may cause problems if that value fails
– was it only the boundary
value that failed or did the whole partition fail? Also by testing only boundaries we
would probably not give the users much confidence as we are using extreme values
rather than normal values. The boundaries may be more difficult (and therefore
more costly) to set up as well.
For example, in the printer copies example described earlier we identified the
following boundary values:
Invalid
Valid
Invalid
0 1
99 100
Suppose we test only the valid boundary values 1 and 99 and nothing in between.
If both tests pass, this seems to indicate that all the values in between should also
work. However, suppose that one page prints correctly, but 99 pages do not. Now
we don
’t know whether any set of more than one page works, so the first thing we
would do would be to test for say 10 pages, i.e. a value from the equivalence
tải về 6.34 Mb.

Chia sẻ với bạn bè của bạn:
1   ...   10   11   12   13   14   15   16   17   ...   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