Chapter 1
Chapter 1
Chapter 1
Principles of Testing
1.1 OVERVIEW
In this module you will get an overview of the most fundamental principles of testing.
Firstly, we point out that although you will come across different terminology throughout
your career, professional testers are all pretty much agreed on these basic ideas that we
describe in this module.
Secondly, we take a look at the need for proper testing look at the cost of getting it wrong and
we show why exhaustive testing is neither possible not practical. What are errors and how do
they get into the software?
Thirdly, we describe a fundamental test process, base on industry standards, and underline
importance of planning) tests and determining expected results in advance of test execution.
We conclude with a look at re-testing and regression testing; why it is so important to go that
extra mile and run a suite of tests again, just when you thought it was safe to hit the release
date.
1.2 OBJECTIVES
After completing this module you will:
Understand basic testing terminology.
Understand why testing is necessary.
Be able to define error, fault and failure.
Appreciate why errors occur and how costly they can be.
Understand that you cannot test everything and that testing is therefore a risk management
process.
Understand the fundamental test process.
Understand that developers and testers have different mindsets.
Learn how to communicate effectively with both developers and testers.
Find out why you cannot test your own work.
Understand the need for regression testing.
Understand the importance of specifying your expected results in advance.
Understand how and why tests should be prioritized.
The cost of these errors were ultimately that ambulances didn't turn up and people lost their
lives although the official enquiry report did not attribute any fatalities to the system
problems. The costs in terms of loss of confidence in the computer system, industrial
relations and so on were probably also high.
HOME WORK
Exercise
Putting aside management problems. Read through test documentation examples in BS79252 and answer following questions:
What test techniques does component test strategy stipulate?
What percentage of decision coverage is required?
What should be done if errors are found?
The project component test plan is useful because the approach outlined allows:
a) Strict adherence to the component test strategy
b) More faults to be identified in the LOG components
c) A basic working systems to be established as early as possible
d) Isolation of the components within the test strategy
The component test plan must consist of a single document? TRUE/FALSE
The component test plan must specify test completion criteria? TRUE/FALSE
Why does component test plan specify 100% DC whereas strategy required 90%?
Which test case deals with non-numeric input?
List the expected outcome and the test condition
Why does the CTP have additional/altered test cases?
What action has been taken as a result of the test report?
Are perceived as destructive - only happy when they are finding faults!
Are often not valued within the organization.
Usually do not have any industry recognized qualifications, until now
Usually require good communication skills, tack & diplomacy.
Normally need to be multi-talented (technical, testing, team skills).
We make assumptions
We are emotionally attached to the product (it's our baby and there's nothing
wrong with it).
We are so familiar with the product we cannot easily see the obvious faults.
We're humans.
We see exactly what we want to see.
We have a vested interest in passing the product as ok and not finding faults.
Generally it is thought that objective independent testing is more effective. There are several
levels of independence as follows:
The discussion of independence test groups and outsourcing is left to another section.
10
11
12
13
14
Business people are not the only ones who need custom-designed programs. No two people
manage their finances exactly the same way; no two scientists need computers for exactly the
same kinds of computations; and no two graphic artists need the same kinds of computer
drawing tools. Although people buy spreadsheets and word processors for their generalpurpose computing needs, many people require specialized programs for specific jobs.
The art of programming computers is rewarding not only from a requirements standpoint, but
also on a more personal level. Programming computers is fun! Just as a sculptor looks on a
finished work of clay, programmers are often proud of the programs that they write. By the
time you finish this book, you will have written programs that were not available before you
wrote them. When you want your computer to do something specific and you cannot find a
program that does the job exactly the way you want, you will be able to design and write the
program yourself.
Some Programs are Changeable: There is a third method for getting exactly the program that
you need if you want to computerize your company's accounting records. Accounting
software firms often sell not only accounting programs but also the source code for those
programs. The source code is a listing of the program's instructions. By having access to the
source code, you can take what the software company wrote and modify the behavior of the
program to suit your own requirements.
By starting with a functional program instead of starting from scratch, you save programming
time and money. Sadly, most non-accounting software firms do not supply the source code.
Most programs sold today have been compiled. After compiling, the source code is translated
into a locked-in executable program. The bottom line is that you cannot easily change the
behavior of compiled programs. For most programs, therefore, you have the choice of buying
them or writing them yourself from scratch.
Definition: Code is another name for program.
Review: No single program pleases everyone. When a company sells a program, it must be
general enough to please most purchasers. Some people need programs to behave in a
specific manner in order to fulfill a specific need. They must resort to writing their own
programs. Luckily, Visual Basic takes a lot of the pain out of writing programs.
15
16
For the purpose of this module, Visual Basic (VB) programming language will be
used. Hence the VB Integrated Development Environment (IDE) will do the
translation into coded form, which is a software program.
17
Cost
Specification
Design
Code
18
Changing requirements - the customer may not understand the effects of changes, or
may understand and request them anyway - redesign, rescheduling of engineers,
effects on other projects, work already completed that may have to be redone or
thrown out, hardware requirements that may be affected, etc. If there are many minor
changes or any major changes, known and unknown dependencies among parts of the
project are likely to interact and cause problems, and the complexity of keeping track
of changes may result in errors. Enthusiasm of engineering staff may be affected. In
some fast-changing business environments, continuously modified requirements may
be a fact of life. In this case, management must understand the resulting risks, and QA
and test engineers must adapt and plan for continuous extensive testing to keep the
inevitable bugs from running out of control
Egos - people prefer to say things like: 'no problem', 'piece of cake', 'I can whip that
out in a few hours' 'it should be easy to update that old code'
Instead of: 'that adds a lot of complexity and we could end up making a lot of
mistakes' or we have no idea if we can do that; we'll wing it', 'I can't estimate how
long it will take, until I take a close look at it', 'we can't figure out what that old
spaghetti code did in the first place'
If there are too many unrealistic 'no problems', the result is bugs.
Poorly documented code - it's tough to maintain and modify code that is badly written
or poorly documented; the result is bugs. In many organizations management
provides no incentive for programmers to document their code or write clear,
understandable code. In fact, it's usually the opposite: they get points mostly for
quickly turning out code, and there's job security if nobody else can understand it ('if
it was hard to write, it should be hard to read').
Software development tools - visual tools, class libraries, compilers, scripting tools,
etc. often introduce their own bugs or are poorly documented, resulting in added
bugs.
19
INPUTS
EXPECTED RESULTS
Spelling
5
6
File Print
Click on print icon
20
INPUTS
EXPECTED RESULTS
1
2
3
4
5
6
7
10
16
17
25
26
65
70
Error msg
Error msg
Issues dl+insurance-high
Issues dl+insurance-high
Issues dl+insurance-std
Issues dl+insurance-std
Errormsg
21
ATM Exercise
Some simplified rules for an A TM:
a) Card must be valid for this bank
b) Correct PIN must be entered
c) Withdrawal must not take account overdrawn unless there is an overdraft agreed
d) Notes available are 1 0 and 20 only
TEST NO
INPUTS
EXPECTED RESULTS
Valid Card
Incorrect PIN
50 requested
Valid Card
Correct PIN
200 requested
Balance 50
No overdraft
Valid Card
Correct PIN
50 requested
Balance 50
No overdraft
Valid Card
Correct PIN
50 requested
Balance 400
Withdrawn 160 earlier
errormsg
'"
accepted
'i-
accepted
/
1-
22
INPUTS
1
2
3
4
5
6
Pick UD receiver
Dial 100
Dia1142 or 192
Dial 999
Dial Busy Number
Press
5
After Hearing
Engaged tone
Dia11471
Dia11571
7
8
EXPECTED RESULTS
23
Severity.
Probability.
Visibility of failure.
Business priority assigned to the requirement.
Customer wants.
How much change the function has undergone.
How error prone is this module.
How critical is it to the business.
How technically complex is it.
How difficult is it to test.
How costly is it to test.
Keep the test priority with the test at all times. This_ will prevent you from developing and
designing lo_ priority tests that never get run. Use a scheme of high, medium, low or a
numeric scheme or 1,2, 3, 4 but try not to have more than about 4 categories.
NO
2
3
4
5
6
7
PRI
24
25
1.10 Summary
You should now be familiar with some of the fundamental principles of testing
and you will recognize much of the terminology. The horror stories that you will
have heard are not just sensationalist to motivate the course; they are true stories
and there are (unfortunately) many more stories about the costs of not testing
systems properly.
In particular you can now:
26