Escolar Documentos
Profissional Documentos
Cultura Documentos
Wei-Tek Tsai
Department of Computer Science and
Engineering
Arizona State University
Tempe, AZ 85287
1
Structural testing Vs. functional testing
• Structural testing
– compares test program behavior against the
apparent intention of the source code
– examines how the program works, taking into
account possible pitfalls in the structure and
logic
2
Complete Coverage
• The phrase, complete coverage, is
misleading
• "completeness" is measured only relative to a
specific population of possible test cases
• Even if you achieve complete coverage for a given
population of tests (such as, all lines of code
tested), you have not done complete, or even
adequate, testing
• Path-based coverage
– requires the execution of particular components
of the program
• Fault-based coverage
– requires that the test suite exercise the program
in a way that would reveal likely faults.
3
Process of Test coverage analysis
• Finding areas of a program not exercised by
a set of test cases
• Creating additional test cases to increase
coverage, and
• Determining a quantitative measure of code
coverage, which is an indirect measure of
quality
Fundamental Measures
• Statement Coverage
– reports whether each executable statement is
encountered
– Also known as: line coverage, segment
coverage, C1, and basic block coverage
4
Fundamental Measures (Cont.)
• Decision Coverage
– reports whether boolean expressions tested in
control structures evaluated to both true and
false
– Also known as: branch coverage, all-edges
coverage, basis path coverage, C2, decision-
decision-path testing
10
5
Fundamental Measures (Cont.)
• Multiple Condition Coverage
– reports whether every possible combination of
boolean sub-expressions occurs
• Condition/Decision Coverage
– a hybrid measure composed by the union of
condition coverage and decision coverage
11
12
6
Other Measures
• Function Coverage
– reports whether you invoked each function or procedure
• Call Coverage
– reports whether you executed each function call
• Linear Code Sequence and Jump (LCSAJ)
– variation of path coverage
– considers only sub-paths that can easily be represented
in the program source code, without requiring a flow
graph
13
7
Other Measures (Cont.)
• Race Coverage
– reports whether multiple threads execute the same code at the same
time
• Relational Operator Coverage
– reports whether boundary situations occur with relational operators
(<, <=, >, >=)
• Weak Mutation Coverage
– whether test cases occur which would expose the use of wrong
operators and also wrong operands
• Table Coverage
– indicates whether each entry in a particular array has
been referenced
15
16
8
Advanced Coverage Metrics for
Object-Oriented Software
17
Object-oriented context
coverage metrics
• Inheritance context coverage
18
9
RTCA/DO-178B Coverage
• The international avionics standard for
safety critical software
• Imposes very strict Dynamic Coverage
Analysis requirements on projects
19
20
10
Links for DO- 178B
• RTCA/DO-178B Guidelines
• Testing Embedded Software to
FAA Regulated Requirements
• DO-178B Description
• DO-178B, "Software Considerations in
Airborne Systems and Equipment
Certification"
21
22
11
Links for DO- 178B (Cont.)
• Guidelines for Applying the RTCA/DO-
178B Level D Criteria to Previously
Developed Software (PDS)
• Guidelines for the Qualification of Software
Tools Using RTCA/DO-178B
• Guidelines for the Approval of Software
Changes in Legacy Systems Using RTCA
DO-178B
23
24
12
References
• http://www.testing.com/writings/coverage-
terminology.html
• http://www.testing.com/writings/coverage.pdf
• http://www.testing.com/writings/experience.pdf
• http://www.kaner.com/coverage.htm#f1
• http://www.bullseye.com/webCoverage.html
• http://www.kaner.com/coverage.htm
25
References (Cont.)
• http://www.testing.com/writings/iview1.htm
• http://www.iplbath.com/pdf/p0833.pdf
• http://www.iplbath.com/pdf/p0823.pdf
• http://www.iplbath.com/pdf/p0833.pdf
• http://www.csc.calpoly.edu/~dbutler/tutorials/wint
er96/coverage/
• http://www.rtca.org
• http://www.stsc.hill.af.mil/crosstalk/1996/sep/num
ber.asp
26
13
References (Cont.)
• http://www.ldra.co.uk/pages/core-info/sw_test.htm
• http://www.construx.com/seminars/flyers/CxReal
WorldTesting.htm
• http://www.ida.liu.se/~TDDB62/lectures/testing.p
df
• http://sern.ucalgary.ca/~denzinger/lecture17.ppt
• http://www.elet.polimi.it/Users/DEI/Sections/Com
peng/Mauro.Pezze/Tutorials/ICSE98/icse98/
27
References (Cont.)
• http://www.acm.org/sigada/conf/sigada2000/privat
e/SIGAda2000-CDROM/SIGAda2000-
Proceedings/Romanski-Presentation.pdf
• http://www2.informatik.uni-erlangen.de/IMMD-
II/Lehre/WS00_01/testing/TestSem.ppt
• http://www.cs.purdue.edu/homes/apm/talks/covera
ge-principle.ppt
• http://www.bullseye.com/coverage.html
28
14