SOFTWARE TESTING
VI SEM BCA
2023 ONWARDS:
UNIT – 1
TOPICS :
Introduction:
Basic Definitions
A testing life cycle
Test Cases
Fundamental approaches to apply Test Cases
Levels of Testing
Examples:
• The NextDate function,
• Triangle problem
• the Commission Problem
• The SATM (Simple Automatic Teller Machine) problem.
Definition:
Testing is the process of executing a program with the intent of finding
errors
➢Reasons for testing
To discover problems
To make judgment about quality or acceptability
Testing is obviously concerned with :
✓Errors
✓Faults
✓ Failures
✓Incidents
Errors
• Synonym mistake
• Mistakes while coding-bugs
• Tend to propagate
Fault
• Synonym defect
• A fault is the result of an error.
• fault is the representation of an error
• representation is the mode of expression:
▪ Dataflow diagram
▪ Hierarchy charts
▪ Narrative text
▪ Source code
Fault of commission-occurs when we enter something into a
representation that is incorrect
Fault of omission-occurs when we fail to enter correct information.
Failure
• Occurs when fault executes
• Applicable to only faults of omission
Incident
• Symptom associated with a failure
• Alerts user to occurrence of a failure
Test
• the act of exercising software with test cases with an objective of
• Two goals:
o Finding failure
o Demonstrate correct execution
Test case
• Has set of inputs and expected outputs.
• Has Identity associated with program behavior
Figure 1.1 - Testing Life Cycle
Testing Life Cycle Contd.,
• Errors-faults-failures propagates in development phases.
• Tester summarizes life cycle as 3 phases :
o Putting bugs - IN
o Testing phase – FINDING BUGS
o Getting bugs - OUT
• Test Cases occupies central position in the life cycle
• Testing is subdivided into
o Test planning
o Test case development
o Running test cases
o Evaluating test results.
Test Cases:
The essence of software testing is to determine a set of test cases for the
item to be tested.
test case will contain:
• a test case identifier,
• a brief statement of purpose (e.g., a business rule),
• a description of preconditions,
• the actual test case inputs,
• the expected outputs,
• a description of expected postconditions,
• and an execution history.
Test Cases Contd:
Act of testing is :
• Establishing necessary preconditions
• Providing the test case inputs
• Observing the outputs
• Comparing with the expected outputs
• Ensuring the existence of expected preconditions
The execution history - for test management use and it contains :
• the date when the test was run
• the person who ran it
• the version on which it was run
• the pass/fail result
Identifying Test Cases
Two fundamental approaches are used to identify test cases:
Functional (Black box) testing
Structural (White box) testing
Functional Testing/Black box testing
• Program-a function that maps values from its input domain to values in
its output range
• Content/implementation is not known
• Function is understood completely in terms of its inputs & outputs
• For test case identification only specification of the software is used
Advantages:
• Independent of software implementation
• Test case development can occur in parallel
Disadvantage:
• Redundancy among test cases
Structural /white box /clear box testing
• Implementation is known and used to identify test cases
• Concept of linear graph theory is required to understand
• Test coverage metrics –provides way to state the extent to which the software
item can be tested
Note: Linear graph theory --a graphical representation that discusses the
relationship between two or more quantities or things.
Levels of Testing:
Levels of testing :
• Levels of testing echo the levels of abstraction found in the waterfall
model of the software development life cycle.
• model is useful for:
testing as a means of identifying distinct levels of testing
clarifying the objectives that pertain to each level.
A diagrammatic variation of the waterfall model is given in Figure 1.8;
variation emphasizes the correspondence between testing and design
levels.
that in terms of specification-based testing, the three levels of definition
(specification, preliminary design, and detailed design) correspond
directly to three levels of testing—system, integration, and unit testing
The Triangle Problem
Problem statement
Simple version:
The triangle program accepts three integers, a, b, and c, as input.
These are taken to be sides of a triangle.
The output of the program is the type of triangle determined by the three
sides:
Equilateral
Isosceles
Scalene
Not A Triangle
The Triangle Problem
Improved version: “Simple version” plus better definition of inputs:
The integers a, b, and c must satisfy the following conditions:
c1. 1 ≤ a ≤ 200
c2. 1 ≤ b ≤ 200
c3. 1 ≤ c ≤ 200
c4. a < b + c
c5. b < a + c
c6. c < a + b
The Triangle Problem
Final Version: “Improved version” plus better definition of outputs:
If an input value fails any of conditions c1, c2, or c3, the program notes this
with an output message
“Value of b is not in the range of permitted values.”
for example,
If values of a, b, and c satisfy conditions c1, c2, and c3, one of four
mutually exclusive outputs is given:
If all three sides are equal, the program output is Equilateral.
If exactly one pair of sides is equal, the program output is
Isosceles.
If no pair of sides is equal, the program output is Scalene.
If any of conditions c4, c5, and c6 is not met, the program
output is Not a Triangle
Until c1 AND c2 AND c3
End NextDate2
Commission Problem
After each town visit, the salesperson sent a telegram to the Missouri gunsmith with the
number of locks, stocks, and barrels sold in that town. At the end of a month, the
salesperson sent a very short telegram showing –1 lock sold
SATM SYSTEM
UNIT -1 :
PART -1 TOPIC COMPLETES