0% found this document useful (0 votes)
248 views

ST Unit 1 - Notes

The document discusses key concepts in software testing such as: 1. Errors made by people during coding result in faults or bugs in the software. Failures occur when faults are executed, and incidents are failures that are apparent to users. 2. Testing involves exercising software with test cases to find failures or demonstrate correct execution. A test case specifies inputs and expected outputs. 3. Software testing aims to validate that software meets requirements, works as expected, and satisfies stakeholder needs. It is necessary to improve quality, build confidence, and discover defects. 4. The software testing life cycle depicts how bugs are introduced, tested for, and fixed throughout the development life cycle.

Uploaded by

Shushanth Gowda
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
248 views

ST Unit 1 - Notes

The document discusses key concepts in software testing such as: 1. Errors made by people during coding result in faults or bugs in the software. Failures occur when faults are executed, and incidents are failures that are apparent to users. 2. Testing involves exercising software with test cases to find failures or demonstrate correct execution. A test case specifies inputs and expected outputs. 3. Software testing aims to validate that software meets requirements, works as expected, and satisfies stakeholder needs. It is necessary to improve quality, build confidence, and discover defects. 4. The software testing life cycle depicts how bugs are introduced, tested for, and fixed throughout the development life cycle.

Uploaded by

Shushanth Gowda
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 20

Software Testing 10CS842 Unit 1-Notes

Unit 1 - A PERSPECTIVE ON TESTING


Basic Definitions:

Error: people make errors. A good synonym is mistake. When people make mistakes while coding, we
call these mistakes bugs. Errors tend to propagate; a requirements error may be magnified during design
and amplified still more during coding.

Fault: a fault is the result of an error. It is more precise to say that a fault is the representation of an
error, where representation is the mode of expression, such as narrative text, data flow diagrams,
hierarchy charts, source code, and so on. Defect is a good synonym for fault, as is bug. Faults can be
elusive. When a designer makes an error of omission, the resulting fault is that something is missing that
should be present in the representation.

Types of fault:

Fault of omission: Faults of omission occur when we fail to enter correct information. Of these two
types, faults of omission are more difficult to detect and resolve.

Fault of Commission: A fault of commission occurs when we enter something into a representation that
is incorrect.

Failure: a failure occurs when a fault executes. Two subtleties arise here: one is that failures only occur
in an executable representation, which is usually taken to be source code, or more precisely, loaded
object; the second subtlety is that this definition relates failures only to faults of commission.

Incident: when a failure occurs, it may or may not be readily apparent to the user (or customer or tester).
An incident is the symptom associated with a failure that alerts the user to the occurrence of a failure.

Test: testing is obviously concerned with errors, faults, failures, and incidents. A test is the act of
exercising software with test cases. A test has two distinct goals: to find failures or to demonstrate correct
execution.

Test Case: test case has an identity and is associated with a program behavior. A test case also has a set
of inputs and a list of expected outputs.

Software Testing:

Definition: According to the definition given by Dave Gelperin and William C. Hetzel - Software testing
can be stated as the process of validating and verifying that a software:
 Meets the requirements that guided its design and development.
 Works as expected.
 Satisfies the needs of stakeholders.
 Software testing is the process of analyzing a software item to detect the differences between existing
and required conditions (that is, bugs) and to evaluate the features of the software item. One of the test

Sameena H S, Dept. of CSE, GAT 1


Software Testing 10CS842 Unit 1-Notes

techniques includes the process of executing a program or application with the intent of finding software
bugs (errors or other defects).

Necessity:

 To determine a set of test cases.


 To improve the quality of software.
 To build confidence in the software
 To demonstrate to the developer and the customer that the software meets its requirements.
 To discover faults or defects in the software.

Software Testing Life Cycle:

Significance of testing life cycle is that it depicts how and when bugs are introduced, tested and fixed in a
software development life cycle (SDLC).

Phases putting Bugs IN:


 Requirement specification: Errors are made during requirement collection and analysis.
 Design: Testers work with developers in determining what aspects of a design are testable and under
what parameter those testers work. Errors introduced in previous phase results into faults and more errors
are made.
 Coding: Design is implemented. Faults and errors introduced in previous phases propagate and more
errors are made.
Phase finding Bugs:
 Testing: Test strategy or planning is done to generate test cases or scenarios, which are executed to find
bugs or errors. Bugs found are reported in error logs.
Phases getting Bugs OUT:
 Fault classification: Reported faults are assigned to different severity classes like catastrophic, serious,
mild etc.
 Fault isolation: Causes and location of different faults are pinpointed.
 Fault resolution: Patch work is done to fix the faults which give another opportunity for error and new
faults to be made.

Sameena H S, Dept. of CSE, GAT 2


Software Testing 10CS842 Unit 1-Notes

Test Cases:

Test case is a scenario made up of a sequence of steps and conditions or variables, where test inputs
are provided and the program is run using those inputs, to see how it performs.

An expected result is outlined and it is compared with result obtained. Certain, working conditions
present are also considered in the test cases so as to check how the program handles such conditions

.  Test cases, at the root level, are required to measure how program handles tricky situations or errors.
It is been expected from the cases that to showcase the hidden logical errors by different cases of input.

 A typical test case contains the following information:

Sameena H S, Dept. of CSE, GAT 3


Software Testing 10CS842 Unit 1-Notes

False Positive & False negative with respect to test cases:

False positive: A false positive test is a test result or finding which suggests the presence of a defect
which turns out apparently not to be there.

Examples:

 Airport Security: a "false positive" is when ordinary items such as keys or coins get mistaken for
weapons (machine goes "beep")
 Quality Control: a "false positive" is when a good quality item gets rejected.
 Antivirus software: a "false positive" is when a normal file is thought to be a virus
 Medical screening: low-cost tests given to a large group can give many false positives (saying
you have a disease when you don't), and then ask you to get more accurate tests.

False Negative: A false negative test is a result or finding which suggests that the defect is not there but
which, on further investigation, such a defect is/was, indeed, found to be present.

Examples:

 Medical arena: A test result comes out that a person does not have cancer when in actuality he
has cancer.
 Airport security: a “false negative test” is when the detector fails to detect explosives.
 Quality control: a “false negative” when a low quality product gets past quality assurance.

Insight from Venn diagram:

Testing is concerned with behaviour, and behaviour is orthogonal to the structural view common to
software developers.

Consider a universe of program behaviour. Given the program and its specification, consider the set S of
specified behaviors and set P of program behaviors. Figure above shows the relationship among our
universe of discourse as well as the specified and programmed behaviour.

Sameena H S, Dept. of CSE, GAT 4


Software Testing 10CS842 Unit 1-Notes

Of the entire program behaviors, the specified ones are in the circle labeled S, and all those behaviors
actually programmed are in P.

Figure below shows, specified, implemented and tested behaviors.

The new circle in the below figure is for test cases.

Region 1: Specified behaviors that are programmed and tested.


Region 2: Specified behaviors that are programmed but not tested.
Region 3: Unspecified behaviors that are programmed and tested.
Region 4: Specified behaviors that are tested but not programmed.
Region 5: Specified behaviors that are neither programmed nor tested.
Region 6: Unspecified behaviors that are programmed but not tested.
Region 7: Unspecified behaviors that are tested but not programmed.
Region 8: Behaviors that are neither specified and tested nor programmed.

Identifying the test cases:


There are two different types of testing:
1. Functional Testing
2. Structural Testing

Sameena H S, Dept. of CSE, GAT 5


Software Testing 10CS842 Unit 1-Notes

Black box/Functional testing:


Black box testing is a method of software testing that examines the functionality of an application
without peering into its internal structures or workings. Some functional testing methods are Boundary
Value Testing, Equivalence Class Testing and Decision Table-Based testing.
Advantages:
 Same Test Cases can be used in case of any changes in implementation i.e. Independent of
Software Implementation.
 Test case development can be done in parallel with the implementation, Hence reducing the
overall project development interval
Disadvantages:
 Significant Redundancies among test cases i.e. test cases similar to each other may repeat multiple
times.
 Possibility of gaps of untested software. This may result in a faulty product being delivered to the
customer.

White box/structural/clear box testing:

White- box testing (also known as clear box testing, glass box testing, and transparent box testing and
structural testing) is a method of testing software that tests internal structures or workings of an
application, as opposed to its functionality. Some structural testing methods are Path testing and dataflow
testing.

Sameena H S, Dept. of CSE, GAT 6


Software Testing 10CS842 Unit 1-Notes

Error and fault taxonomies:

Basic definitions of Process and product: Process refers to how we do something, and product is end
result of process.

Fault classification by severity:

Various error and fault taxonomies based upon a)Input / Output Faults b) Logic Faults c)
Computation Faults d) Interface Faults e) Data Faults

Input:
 Correct input not accepted
 Incorrect input Accepted
 Description wrong or missing
 Parameters wrong or missing

Output:
 Wrong Format
 Wrong Result
 Correct result at wrong time
 Incomplete or missing result
 Spurious result
 Spelling / Grammar

Logical faults:
 Missing Case (s)
 Duplicate Case (s)
 Extreme Condition Neglected
 Misinterpretation

Sameena H S, Dept. of CSE, GAT 7


Software Testing 10CS842 Unit 1-Notes

 Missing Condition
 Extraneous Condition (s)
 Test of wrong Variable
 Incorrect loop iteration
 Wrong operator (e.g., < instead of <=)

Computation Faults:
 Incorrect Algorithms
 Missing Computations
 Incorrect Operand
 Incorrect Operation
 Parenthesis error
 Insufficient Precision ( Round-off , Truncation)
 Wrong Built-in function

Interface Faults:
 Incorrect interrupt handling
 I/O Timing
 Call to wrong Procedure
 Call to Nonexistent Procedure
 Parameter mismatch (type, number)
 Incompatible types
 Superfluous types

Data Faults:
 Incorrect initialization
 Incorrect storage / access
 Wrong flag / index value
 Incorrect packing / unpacking
 Wrong variable used
 Wrong data reference
 Scaling or unit errors
 Incorrect data dimension
 Incorrect Subscript , Incorrect type
 Incorrect data scope
 Sensor data out of limits

Sameena H S, Dept. of CSE, GAT 8


Software Testing 10CS842 Unit 1-Notes

Levels of Testing:

Figure below shows the level of abstraction and testing in the waterfall model.

The levels are as follows:

 Requirement specification: This step involves taking down requirements from the customer and
making a complete sense of the specified requirements.

 Preliminary design: A rough estimate (replica or sketch) of the product required by the customer is
made in this phase taking into account the requirements specified in the previous level.

 Detailed design: A complete detailed design of the product is made in this phase taking into account
all the requirements specified in the first phase and the sketch made in the second phase.

 Coding: The detailed design developed in the previous phase (i.e. detail design) is next coded and a
product is developed (in segments or subunits).

 Unit Testing: The developed subunits or segments are then tested for their specific functionality.
Structural testing is more appropriate at unit level testing.

 Integration Testing: The developed subunits in the coding phase are then integrated into a specific
module which is again tested to check the interactions between the subunits that are integrated.
Functional testing is more appropriate at Integration testing.

 System Testing: The integrated modules are then finally assembled into a finished product which is
tested again to check whether the product performs to the required standards as mentioned by the
customer. Functional testing is more appropriate at system level testing.

Examples:

Generalized Pseudo code: Pseudo code provides a natural way to express program source code.

Sameena H S, Dept. of CSE, GAT 9


Software Testing 10CS842 Unit 1-Notes

The Triangle Problem:

• The triangle program accepts 3 integers: a,b &c as sides of a triangle

• It outputs the type of the triangle from the length of the 3 sides – Equilateral (all sides are equal) –
Isosceles (2 sides are equal) – Scalene (all sides are not equal) – Not a triangle (if the sum of any 2 sides
<= the third)

• The triangle property: –

The sum of any pair of sides must be strictly greater than the third side ..(>) not (>=)

•a<b+c
•b<a+c
•c < a + b
• a, b,& c are integers from 1 to 200

Sameena H S, Dept. of CSE, GAT 10


Software Testing 10CS842 Unit 1-Notes

Flow Chart for traditional triangle program implementation is as follows:

Generalized Pseudo code:

TRIANGLEPROBLEM:
READ VALUES A, B, AND C
SORT VALUES A, B, AND C (ASCENDING) TO GIVE AA, BB, AND CC
IF AA + BB >CC :
IF AA = BB = CC : PRINT "EQUILATERAL TRIANGLE"
ELSE
: IF AA = BB :: PRINT "ISOSCELES TRIANGLE"
: ELSE
:: PRINT "SCALENE TRIANGLE" : ENDIF
: ENDIF ELSE PRINT "TRIANGLE IMPOSSIBLE"
ENDIF

Sameena H S, Dept. of CSE, GAT 11


Software Testing 10CS842 Unit 1-Notes

Structured Implementation:

Figure shows the dataflow diagram description of triangle program. We could implement it as a main
program with the three indicated procedures.

Note: For structured program: Refer Lab program code.

Next date Function:

Problem statement: NextDate is a function of three variables: month, day and year. It returns the date of
the day after the input date. The month, day and year variables have integer values subject to these
conditions:

C1. 1<=month<=12
C2. 1<=day<=31
C3 1812<=year<=2012

If any of the conditions c1, c2 or c3 fails, NextDate produces an output indicating the corresponding
variable is out-of-range value-for example, “Value of month not in range 1..12.” Because numerous
invalid day-month-year combinations exist, Next Date collapses these into one message: “Invalid Input
date.”

 Pseudo code: (Note: Both version1 and version2 have been specified here. However, from the exam
point of view, only version 1 is sufficient. Interested readers can study version 2 also.)

Sameena H S, Dept. of CSE, GAT 12


Software Testing 10CS842 Unit 1-Notes

Sameena H S, Dept. of CSE, GAT 13


Software Testing 10CS842 Unit 1-Notes

Sameena H S, Dept. of CSE, GAT 14


Software Testing 10CS842 Unit 1-Notes

Sameena H S, Dept. of CSE, GAT 15


Software Testing 10CS842 Unit 1-Notes

Commission problem:

Problem Statement: A rifle salesperson in the former Arizona Territory sold rifle locks, stocks, and
barrels made by a gunsmith in Missouri. Locks cost $45, stocks cost $30, and barrels cost $25. The
salesperson had to sell at least one complete rifle per month, and production limits were such that the
most the salesperson could sell in a month was 70 locks, 80 stocks, and 90 barrels. 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.
The gunsmith then knew the sales for the month were complete and computed the salesperson’s
commission as follows: 10% on sales up to (and including) $1000, 15% on the next $800, and 20% on
any sales in excess of $1800.

The commission program produced a monthly sales report on:

 The total number of locks,


 The total number of stocks,
 The total number of barrels sold,
 The salesperson’s total dollar sales, and,
 Finally, the commission for the total sales.

Example: Let us consider: Total number of locks sold=10, Total number of stocks sold=10, Total
number of Barrels sold=10,

We can calculate the sales using the formula:


Sales= (number of locks*45+number of stocks*30+number of barrels*25)
Therefore in our example sales would be 1000.0 We can calculate commission using the formula:
If sales>1 & sales<=1000
Then the commission will be= (0.1*sales)
If sales>1000 & sales<=1800
Then the commission will be= (0.1*sales) + (0.15*(sales-1000))
If sales>1800
Then the commission will be= (0.1*sales) + (0.15* (sales-1000)) + (0.2*(sales-1800))
In our Example commission will be=100.0

Structured Pseudo code:


Program commission (INPUT, OUTPUT)
Dim lockPrice, stockPrice, barrelPrice As Real
Dim locks, stocks, barrels As Integer
Dim totalLocks, totalStocks As Integer

Sameena H S, Dept. of CSE, GAT 16


Software Testing 10CS842 Unit 1-Notes

Dim totalBarrels As Integer


Dim lockSales, stockSales As Real
Dim barrelSales As Real
Dim sales, commission As Real
lockPrice = 45.0, stockPrice = 30.0, barrelPrice = 25.0
totalLocks = 0, totalStocks = 0, totalBarrels = 0
Input (locks)
While NOT (locks = -1)
‘Input device uses -1 to indicate end of data
Input (stocks, barrels)
totalLocks = totalLocks + locks
totalStocks = totalStocks + stocks
totalBarrels = totalBarrels + barrels
Input (locks)
EndWhile
Output ("Locks sold: ", totalLocks)
Output ("Stocks sold: ", totalStocks)
Output ("Barrels sold: ", totalBarrels)
Sales = lockPrice*totalLocks + StockPrice*totalStocks + barrelPrice * totalBarrels
Output ("Total sales: ", sales)
If (sales > 1800.0)
Then commission = 0.10 * 1000.0
commission = commission + 0.15 * 800.0
commission = commission + 0.20*(sales-1800.0)
Else If (sales > 1000.0)
Then commission = 0.10 * 1000.0
commission = commission + 0.15*(sales-1000.0)
Else
commission = 0.10 * sales
EndIf
EndIf
Output ("Commission is $", commission)
End Commission

THE SATM System:-Simple automatic teller machine

The below figure shows SATM terminal

Sameena H S, Dept. of CSE, GAT 17


Software Testing 10CS842 Unit 1-Notes

SATM system is actually used for communicating with bank customers. SATM customers can select any
of three transaction types:
 deposits
 withdrawals
 savings
When a bank customer arrives at an SATM station, screen 1 is displayed. The bank customer accesses the
SATM system with a plastic card encoded with a PAN, which is a key to an internal customer account file
containing ,among other things ,the customer name and account information. If customers PAN matches,
the screen 2 will be displayed to the customer else screen 4 will be displayed.
SATM communicate with bank customers via 15 screens as shown in below figure:

Thus SATM is just the day to day ATM services which we use in daily life.
And if there is any error then cancel the transaction and exit from the screen. At screen 2, customer is
asked to enter the PIN. If PIN is correct then screen 5 will be displayed, else screen 3 will be displayed
and user is given 3 chances before the card is blocked. On screen 5, the information provided is
customers account, current date, and increment to the number of ATM session. Customer selects the

Sameena H S, Dept. of CSE, GAT 18


Software Testing 10CS842 Unit 1-Notes

transaction to be processed. If balance is requested then screen 14 is displayed. If deposit is requests then
screen 7 is displayed. Once deposit amount is entered then screen 13 is displayed. After this is over
screen 14 would be displayed. If withdrawal is requested screen 7 would be displayed or if it is jammed
then screen 10 is displayed. If the fund to be withdrawn is insufficient then screen 8 is displayed else
screen 11 is displayed and money is dispensed. After cash is removed, system displays screen 14. When
the “No” button is pressed in screen 10, 12 0r 14, then the system presents screen 15 and returns the
customer’s ATM card. Once the cared is removed from the card slot, screen 1 is displayed. When the
“yes” button is pressed in screen 10, 12, or 14, the system presents screen 5 so customer can select
additional transaction. Thus the basic SATM system along with SATM screens is explained.

The Currency Converter


An event-driven program with a graphical user interface (GUI), shown below

 The currency conversion program is another event driven program that emphasizes code
associated with GUI. The application converts U.S dollars to any of four currencies: Brazilian
reals, Canadian dollars, European euros and Japanese yen.
 Currency selection is governed by the radio buttons which are mutually exclusive. When a
country is selected, the system responds by completing the label. If Canadian button is clicked, a
small Canadian flag appears next to output position and the converted currency amount is
displayed. Either before or after currency selection, the user inputs an amount in US dollars. Once
tasks are accomplished, the user can click on the computer button, the clear button, or the quit
button. Clicking the computer button results in conversion of the US dollar amount to the
equivalent amount in the selected currency. Clicking on the clear button resets the currency

Sameena H S, Dept. of CSE, GAT 19


Software Testing 10CS842 Unit 1-Notes

selection, the US dollar amount, and the equivalent currency amount and the associated label.
Clicking on the quit button ends the application.
Saturn Windshield Wiper Controller

• The windshield wiper on some Saturn cars is controlled by a lever with a dial • The lever has 4
positions: OFF, INT(intermittent), LOW and HIGH • The dial has three positions: 1,2,3 – The dial
positions indicate three intermittent speeds – It is relevant only when the lever is at the INT position

• The decision table below shows the windshield wiper speeds in wipes per minute for the lever and dial
positions.

Question bank:

1. Define the following : a) Error b) Fault c) Failure d) Incident e) Test f) Test case (6M)

2. Difference between functional testing and structural testing (6M)

3. What is software testing? Why it is so important in SDLC? (5M)

4. Explain the triangle problem statement along with flow chart for traditional implementation. (7M)

5. Explain the IEEE error and fault taxonomy and IEEE standard anomaly process in software testing.
(8M)

6. Explain error and fault taxonomies. (5M)

7. Explain in detail various levels of software testing with embedded device like SATM as an example.
(15M)

Sameena H S, Dept. of CSE, GAT 20

You might also like