Software Testing NE
Software Testing NE
Testing
Dr. Naresh.E
Hardware Testing Vs Software Testing
Hardware Testing:
Will be taken very much care to implement and test the product
in the initial phase as the failure(after delivery) costs you more
and difficult to modify the hardware as per the customer needs.
Software Testing:
Over confident in the software engineers as they can meet
changing needs of the customer as and when required, increases
the opportunities for hiring software test engineers.
2
Why does software have bugs?
• Miscommunication or No communication
• Software Complexity
• Programming errors
• Time Pressures
• Changing requirements
• Poorly Documented Code
3
Software Testing
Testing is the process of exercising a
program with the specific intent of finding
errors prior to delivery to the end user.
OR
[IEEE defn.]
4
Who Tests the Software?
independent tester
Understands the system
Must learn about the system,
but, is inclined to test "gently"
but, will attempt to break it
and, is driven by "delivery"
and, is driven by quality.
Testability of a program is
tested here.
5
Test Life Cycle
• Requirement Analysis – Setting test objectives and
requirements .
• Strategy and Planning – Determining risks and selecting
strategies.
• Design – Specifying test procedure, test scenarios and test cases
to be developed.
• Execution – Running and rerunning the tests.
• Reporting and Management – Tracking and updating the
progress of software tests.
• Analysis – Analyzing the test results and taking appropriate
corrective actions.
6
Activities of Test Engineers
7
Goal of Testing:
Design a series of tests that have a high
probability of finding errors prior to
delivery.
8
What Testing Shows
- errors
- requirements conformance
- performance
- an indication
of quality
Testing can never
be used to show the
absence of errors,
only their presence.
9
Basic Definitions
► Error – a conceptual mistake.
► Fault – the result of an error / Implemented error
Defect is a synonym of fault.
► Failure – occurs when a fault executes.
Observable behavior/failure.
► Test –exercising software with test cases.
► Test case – has an identity, associated with program
behavior, has a set of inputs, has a list of expected
outputs.
10
Errors, faults, failures
11
Testing and debugging
12
Principles of Testing
• Testing must find the largest number of errors in the least amount of time.
13
Characteristics that lead to testable software
Destruction Phases
Static Activities Dynamic Activities
21
Relationship – program behaviors
Program Behaviors
Specified Programmed
(expected) (observed)
Behavior Behavior Fault
Fault
of
of
Commission
Omission
Correct portion
22
Test Cases, Specs, and Programmed Behaviors
U
S P
S = Specified behaviors
2 P = Programmed behaviors
T = Tested behaviors
5 6 U = All possible behaviors
1
4 3 We want to make
region 1 as large
as possible.
7
T
23
Functional Test cases
Specified Programmed
Test
Cases
24
Functional Test cases after applying Functional
testing techniques
Specified Programmed
Test
Cases
25
Structural Test cases
Specified Programmed
Test
Cases
26
Structural Test cases after applying structural
testing techniques
Specified Programmed
Test
Cases
27
Need for designing test cases
• Almost every non-trivial system has an extremely
large input data domain thereby making exhaustive
testing impractical
• If randomly selected then test case may loose
significance since it may expose an already
detected error by some other test case
• Number of test cases do not determine the
effectiveness
• Each test case should detect different errors
28
Test Case format
29
Defect Life Cycle
30
Defect Report
31
Examples
• Triangle Problem
• NextDate function
• CurrencyConvertor Problem
• SATM Problem
• Commission Problem
32
Triangle Problem
The Triangle Program accepts three integers 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, or NotATriangle.
a < b + c,
b < a + c, and
c < a + b.
If any one of these fails to be true, then integers a, b, and c do not constitute
sides of a triangle.
33
NextDate function
34
Currency Convertor Problem
35
Simple ATM (SATM) Problem
36
Commission Problem
Rifle salespersons in the Arizona Territory sold rifle locks, stocks, and barrels made by a
gunsmith in Missouri. Locks cost $45.00, stocks cost $30.00, and barrels cost $25.00.
Salespersons had to sell at least one complete rifle per month, and production limits are
such that the most one salesperson could sell in a month is 70 locks, 80 stocks, and 90
barrels. Each rifle salesperson sent a telegram to the Missouri company with the total
order for each town (s)he visits; salespersons visit at least one town per month, but
travel difficulties made ten towns the upper limit.
At the end of each month, the company computed commissions as follows: 10% on sales
up to $1000, 15% on the next $800, and 20% on any sales in excess of $1800.
The company had four salespersons. The telegrams from each salesperson were sorted
into piles (by person) and at the end of each month a datafile is prepared, containing the
salesperson’s name, followed by one line for each telegram order, showing the number
of locks, stocks, and barrels in that order. At the end of the sales data lines, there is an
entry of “-1” in the position where the number of locks would be to signal the end of
input for that salesperson. The program produces a monthly sales report that gives the
salesperson’s name, the total number of locks, stocks, and barrels sold, the salesperson’s
total dollar sales, and finally his/her commission.
37
References
• Paul C Jorgensen, Software Testing, A
craftsman approach, 3rd edition.
• Adithya P Mathur, Foundations of Software
Testing, 2nd edition.
• Rex Black, Software Testing, Vol – I and II.