Testing
Testing
1
Topics covered
✧ Development testing
✧ Test-driven development
✧ Release testing
✧ User testing
2
Program testing
3
Program testing goals
5
Testing process goals
✧ Validation testing
▪ To demonstrate to the developer and the system customer that
the software meets its requirements
▪ A successful test shows that the system operates as intended.
✧ Defect testing
▪ To discover faults or defects in the software where its behaviour
is incorrect or not in conformance with its specification
▪ A successful test is a test that makes the system perform
incorrectly and so exposes a defect in the system.
6
An input-output model of program testing
7
Verification vs validation
✧ Verification:
"Are we building the product right”.
✧ The software should conform to its specification.
✧ Validation:
"Are we building the right product”.
✧ The software should do what the user really requires.
8
V & V confidence
9
Inspections and testing
10
Inspections and testing
11
A model of the software testing process
12
Stages of testing
13
Development testing
14
Development testing
15
Unit testing
16
Object class testing
17
The weather station object interface
18
Weather station testing
19
Automated testing
20
Automated test components
✧ A setup part, where you initialize the system with the test
case, namely the inputs and expected outputs.
✧ A call part, where you call the object or method to be
tested.
✧ An assertion part where you compare the result of the
call with the expected result. If the assertion evaluates to
true, the test has been successful if false, then it has
failed.
21
Choosing unit test cases
23
Partition testing
24
Equivalence partitioning
25
Equivalence partitions
26
Testing guidelines (sequences)
27
General testing guidelines
28
Component testing
30
Interface testing
31
Interface errors
✧ Interface misuse
▪ A calling component calls another component and makes an
error in its use of its interface e.g. parameters in the wrong order.
✧ Interface misunderstanding
▪ A calling component embeds assumptions about the behaviour
of the called component which are incorrect.
✧ Timing errors
▪ The called and the calling component operate at different
speeds and out-of-date information is accessed.
32
Interface testing guidelines
33
System testing
34
System and component testing
35
Use-case testing
36
Collect weather data sequence chart
37
Test cases derived from sequence diagram
38
Testing policies
39
Test-driven development
40
Test-driven development
42
TDD process activities
✧ Code coverage
▪ Every code segment that you write has at least one associated
test so all code written has at least one test.
✧ Regression testing
▪ A regression test suite is developed incrementally as a program
is developed.
✧ Simplified debugging
▪ When a test fails, it should be obvious where the problem lies.
The newly written code needs to be checked and modified.
✧ System documentation
▪ The tests themselves are a form of documentation that describe
what the code should be doing.
44
Regression testing
45
Release testing
46
Release testing
47
Release testing and system testing
48
Requirements based testing
49
Requirements tests
50
A usage scenario for the Mentcare system
George is a nurse who specializes in mental healthcare. One of his responsibilities is to visit patients
at home to check that their treatment is effective and that they are not suffering from medication
side effects.
On a day for home visits, George logs into the Mentcare system and uses it to print his schedule of
home visits for that day, along with summary information about the patients to be visited. He
requests that the records for these patients be downloaded to his laptop. He is prompted for his key
phrase to encrypt the records on the laptop.
One of the patients that he visits is Jim, who is being treated with medication for depression. Jim
feels that the medication is helping him but believes that it has the side effect of keeping him awake
at night. George looks up Jim’s record and is prompted for his key phrase to decrypt the record. He
checks the drug prescribed and queries its side effects. Sleeplessness is a known side effect so he
notes the problem in Jim’s record and suggests that he visits the clinic to have his medication
changed. Jim agrees so George enters a prompt to call him when he gets back to the clinic to make
an appointment with a physician. George ends the consultation and the system re-encrypts Jim’s
record.
After, finishing his consultations, George returns to the clinic and uploads the records of patients
visited to the database. The system generates a call list for George of those patients who He has to
contact for follow-up information and make clinic appointments.
51
Features tested by scenario
53
User testing
54
User testing
55
Types of user testing
✧ Alpha testing
▪ Users of the software work with the development team to test
the software at the developer’s site.
✧ Beta testing
▪ A release of the software is made available to users to allow
them to experiment and to raise problems that they discover with
the system developers.
✧ Acceptance testing
▪ Customers test a system to decide whether or not it is ready to
be accepted from the system developers and deployed in the
customer environment. Primarily for custom systems.
56
The acceptance testing process
57
Stages in the acceptance testing process
58
Agile methods and acceptance testing
59
Key points
60
Key points