W11 Software Quality
W11 Software Quality
• Readability
• Ease of maintenance, testing, debugging,
fixing, modification and portability
• Low complexity
• Low resource consumption: memory, CPU
• Number of compilation or lint warnings
• Robust input validation and error handling,
established by software fault injection
Methods to improve the quality:
• Refactoring
• Code Inspection or software review
• Documenting code
Good Testing Practices
• A good test case is one that has a high
probability of detecting an undiscovered
defect, not one that shows that the program
works correctly
• It is impossible to test your own program
• A necessary part of every test case is a
description of the expected result
Good Testing Practices (cont’d)
• Avoid nonreproducible or on-the-fly testing
• Write test cases for valid as well as invalid
input conditions.
• Thoroughly inspect the results of each test
• As the number of detected defects in a piece
of software increases, the probability of the
existence of more undetected defects also
increases
Unit Testing
• Algorithms and logic
• Data structures (global and local)
• Interfaces
• Independent paths
• Boundary conditions
• Error handling
Software Testing Fundamentals
13
Flow Graph Notation
• A circle in a graph represents a node, which stands for a sequence of one
or more procedural statements
• A node containing a simple conditional expression is referred to as a
predicate node
– Each compound condition in a conditional expression containing one or
more Boolean operators (e.g., and, or) is represented by a separate
predicate node
– A predicate node has two edges leading out from it (True and False)
• An edge, or a link, is a an arrow representing flow of control in a specific
direction
– An edge must start and terminate at a node
– An edge does not intersect or cross over another edge
• Areas bounded by a set of edges and nodes are called regions
• When counting regions, include the area outside the graph as a region,
too
14
Flow Graph Example
FLOW CHART FLOW GRAPH
0 0
R4
1 1
2 2
3 R3
3
6 4 6 4
R2
7 8 5
7 R1 8 5
9
9
11 10 11 10 15
Independent Program Paths
• Defined as a path through the program from the start node until the
end node that introduces at least one new set of processing
statements or a new condition (i.e., new nodes)
• Must move along at least one edge that has not been traversed
before by a previous path
• Basis set for flow graph on previous slide
– Path 1: 0-1-11
– Path 2: 0-1-2-3-4-5-10-1-11
– Path 3: 0-1-2-3-6-8-9-10-1-11
– Path 4: 0-1-2-3-6-7-9-10-1-11
• The number of paths in the basis set is determined by the cyclomatic
complexity
16
Mutation testing methods
output
input events
Example
• A tester, without knowledge of the internal
structures of a website, tests the web pages
by using a browser; providing inputs (clicks,
keystrokes) and verifying the outputs against
the expected outcome.
LEVELS APPLICABLE TO
30
Advantages
• The black box tester has no "bonds" with the
code, and a tester's perception is very simple: a
code must have bugs.
• Using the principle, "Ask and you shall receive,"
black box testers find bugs where programmers
do not.
• Tests are done from a user’s point of view and
will help in exposing discrepancies in the
specifications.
• Tests can be conducted by a body independent
from the developers, allowing for an objective
perspective and the avoidance of developer-bias.
Disadvantages
• Only a small number of possible inputs can be
tested and many program paths will be left
untested.
• Without clear specifications, which is the
situation in many projects, test cases will be
difficult to design.
Seat Work
• What is difference between white box and
black box testing. Give an example for each.
• Explain each type of black box testing