Professional Documents
Culture Documents
Verification of programs (do program runs correctly Different roles within lifecycle
Developers testing Users testing
Different techniques
Blackbox Whitebox
Regression testing
does program works after a change?
1 3/9/2013
Spectramindsolutions.com
Testing Purpose
Developers testing
Done by developer during development (coding) Purpose: verify direction of development
Acceptance testing
Last phase before delivery of software
Program correctness
Algorithmically unsolvable problem Halting problem Testing is based on heuristics We solve a similar solvable problem
2 3/9/2013
Spectramindsolutions.com
60* to 100*
1.5* to 6* Cost 1*
Definition 3 3/9/2013
Development
Post Release
Spectramindsolutions.com
System specification
System design
Detailed design
Service
Acceptance test
4 3/9/2013
Spectramindsolutions.com
Testing Techniques
Testing in the small
testing of individual module
5 3/9/2013
Spectramindsolutions.com
Testing Techniques
Number of test case does not necessarily contribute to the significance of the test set A fragment to compute the maximum of two numbers if x>y then max=x; else max =x; Test set {<x=3, y=2>, <x=2, y=3> } is able to detect the error, {<x=3, y=2>, <x=4,y=3>, <x=5, y=1> } is not
6 3/9/2013
Spectramindsolutions.com
Testing Techniques
Two approaches in testing in the small
White box testing (Glass Box testing, structural coverage testing)
use info about the internal structure implementation-based testing
Branch coverage
each branch of the control graph is traversed at least once
Path coverage
all paths leading from the initial to the final node of ps control flow graph are traversed
8 3/9/2013
Spectramindsolutions.com 8
Example
read (x); read (y); if x > 0 then write ("1"); else write ("2"); end if; if y > 0 then write ("3"); else write ("4"); end if;
10 3/9/2013
{<x = 2, y = 3>, <x = - 13, y = 51>, <x = 97, y = 17>, <x = - 1, y = - 1>} covers all statements {<x = - 13, y = 51>, <x = 2, y = - 3>} is minimal
Spectramindsolutions.com
10
11 3/9/2013
Spectramindsolutions.com
11
12 3/9/2013
Spectramindsolutions.com
12
{<x = 0, z = 1>, <x = 1, z = 3>} causes the execution of all branches, but fails to expose the risk of a division by zero
Spectramindsolutions.com
13
Path-coverage criterion
Select a test set T which traverses all paths from the initial to the final node of Ps control flow
it is finer than previous kinds of coverage however, number of paths may be too large, or even infinite (while loops)
additional constraints must be provided
14 3/9/2013
Spectramindsolutions.com
14
Exhaustive testing
If-then-else
15 3/9/2013
Spectramindsolutions.com
15
Adequacy criteria
adequacy scores based on coverage
example: 95% statement coverage
16 3/9/2013
Spectramindsolutions.com
16
Further problem
What if the code omits the implementation of some part of the specification? White box test cases derived from the code will ignore that part of the specification!
17 3/9/2013
Spectramindsolutions.com
17
18
The program receives as input a record describing an invoice. The invoice must be inserted into a file of invoices that is sorted by date. If other invoices exist in the file with the same date, then the invoice should be inserted after the last one.
19 3/9/2013
Spectramindsolutions.com
19
Test cases
An invoice whose date is the current date An invoice whose date is before the current date (This might be even forbidden by law) An invoice whose date is the same as that some existing invoice An invoice whose date does not exist in any previously recorded invoice Several incorrect invoices, checking different types of inconsistencies
20 3/9/2013
Spectramindsolutions.com
20
21 3/9/2013
Spectramindsolutions.com
21
Integration testing
integration of modules and subsystems
System testing
testing the entire system
Acceptance testing
performed by the customer
23 3/9/2013
Spectramindsolutions.com 23
Module testing
Verify: given module has been implemented correctly (it expected external behavior) Example
Mi uses Mh and Mk Mh and Mk not available how to test Mi in isolation? Provide temporary context that simulates the real context to be provided by Mh and Mk
24 3/9/2013
Spectramindsolutions.com 24
Module testing
In general, a module may
use an operation (calls a process) that does not belong to it access non-local data structure be used by another module
25 3/9/2013
Spectramindsolutions.com
25
STUB CALL
DRIVER
26 3/9/2013
Spectramindsolutions.com
26
driver
module activating the module under test simulates use of module being tested by others sets shared data as they would be set in the real application by other modules that are yet to be designed
27 3/9/2013
Spectramindsolutions.com
27
Example driver
procedures insertTable inserts an item in a table in a proper order initTable to initialize a table printTable to print out the content of the table procedure input to read values via suitable interactions with the user
a driver initTable; input (elm1); insertTable (elm1); printTable ; ---//check whether insertion is done properly input (elm2); insertTable (elm2); printTable ; ---//check whether insertion is done properly ---Spectramindsolutions.com 28
28 3/9/2013
Integration testing
Incremental approach
modules are progressively integrated and tested Advantages
Easy to discover errors at early stages easy to localize errors incrementally
integration of n modules, then n+1
can proceed both top-down and bottom-up according to the USES relation
29 3/9/2013
Spectramindsolutions.com
29
System Testing
A series of tests to verify that all system elements have been properly integrated. Purpose of System Testing: to ensure that the system does what the customer wants
30 3/9/2013
Spectramindsolutions.com
30
Function Testing
Check whether integrated system performs functions as specified in requirements Example: A bank account package enter a withdrawal, calculate interest Example: A word processing system
document creation document modification document deletion 31 3/9/2013
Spectramindsolutions.com 31
Performance Testing:
stress Testing:
Executes the system in a manner that demands resources in abnormal quantity, frequency or volume. If requirements state that a system is to handle a specified number of devices or users, activate all those devices or users simultaneously
configuration testing
analyze various s/w, h/w configurations
robustness testing
test sunder unexpected conditions, like erroneous user commands, power failure
32 3/9/2013
Spectramindsolutions.com
32
Performance Testing
Recovery Testing:
addresses response to 1) presence of faults 2) loss of data, devices, service loss system resources and see if it recovers properly
Overload testing
evaluate when goes beyond limit ex. A transaction system is required to execute 20 tran. Per second. Test when 30 tran. Required in a second
Quality testing
evaluate systems reliability, maint. Availability include calculation of mean time to failure and mean time to repair
33 3/9/2013
Spectramindsolutions.com
33
Installation testing
Users exercise system functions and document problems that result from being the actual site Example: A system designed to work aboard a ship must demonstrate that it is not affected by severe weather, ships motion
34 3/9/2013
Spectramindsolutions.com
34
Acceptance testing
assures customers that they are getting the system they requested testing is done by the customers according to their understanding of requirements
35 3/9/2013
Spectramindsolutions.com
35
customer tests
customer site
developer reviews
customer tests
developer site
36 3/9/2013
Spectramindsolutions.com
36
regression testing
identifies new faults that may have been introduced as current ones are being corrected
37 3/9/2013
Spectramindsolutions.com
37
Walkthroughs
Team of 4-6 members, chaired by SQA (why?) spec writer & manager, client, designers, SQA more experienced & senior better why? Distribute info in advance, each reviewer creates list of confusing items list of items in error Process detect suspected faults, dont correct (why?) document-driven & interactive, not participant-driven verbalization leads to fault finding spontaneously by presenter no performance appraisal
38 3/9/2013
Spectramindsolutions.com
38
Software inspections
Involve people examining the source representation with the aim of discovering anomalies and defects Do not require execution of a system so may be used before implementation May be applied to any representation of the system (requirements, design, test data, etc.) Very effective technique for discovering errors
39 3/9/2013
Spectramindsolutions.com
39
Inspection success
Many different defects may be discovered in a single inspection. In testing, one defect ,may mask another so several executions are required The reuse domain and programming knowledge so reviewers are likely to have seen the types of error that commonly arise
40 3/9/2013
Spectramindsolutions.com 40
Inspection pre-conditions
A precise specification must be available Team members must be familiar with the organisation standards Syntactically correct code must be available An error checklist should be prepared Management must accept that inspection will increase costs early in the software process Management must not use inspections for staff appraisal
42 3/9/2013
Spectramindsolutions.com
42
Inspections
Five stage process oral overview document distributed afterwards preparation participants try to understand in detail aided by statistics of fault types from recent inspections inspection one participants walks through the document thoroughly fault finding moderator must produce a report within one day rework responsible individuals resolve all faults follow-up moderator ensures document corrected if more than 5% reworked, reconvene a 100% reinspection
43 3/9/2013
Spectramindsolutions.com
43
44 3/9/2013
Spectramindsolutions.com
44
Inspection procedure
System overview presented to inspection team Code and associated documents are distributed to inspection team in advance Inspection takes place and discovered errors are noted Modifications are made to repair discovered errors Re-inspection may or may not be required
45 3/9/2013
Spectramindsolutions.com
45
Inspection teams
Made up of at least 4 members Author of the code being inspected Inspector who finds errors, omissions and inconsistencies Reader who reads the code to the team Moderator who chairs the meeting and notes discovered errors Other roles are Scribe and Chief moderator
46 3/9/2013
Spectramindsolutions.com
46
Inspection checklists
Checklist of common errors should be used to drive the inspection Error checklist is programming language dependent The 'weaker' the type checking, the larger the checklist Examples: Initialisation, Constant naming, loop termination, array bounds, etc.
47 3/9/2013
Spectramindsolutions.com
47
Inspection rate
500 statements/hour during overview 125 source statement/hour during individual preparation 90-125 statements/hour can be inspected Inspection is therefore an expensive process Inspecting 500 lines costs about 40 man/hours effort
48 3/9/2013
Spectramindsolutions.com
48
Fault Statistics
Recorded by severity & fault type Metrics
fault density (faults / page or faults / KLOC)
by severity (major vs. minor) or phase
Several uses
help inspectors focus their inspections help warn of problems
compare to previous products at same stage disproportionate # of faults in particular module disproportionate # of faults of certain type
49 3/9/2013
Spectramindsolutions.com
49
Success of Inspections
Inspections can find many of the faults
82%, 70%, 93% of all detected faults (IBM, 76, 78, 86)
50 3/9/2013
Spectramindsolutions.com
50
Weaknesses
if system has poor architecture, unwieldy to review
OO paradigm makes this easier small, independent modules
51 3/9/2013
Spectramindsolutions.com
51