ST Unit 1 - Notes
ST Unit 1 - Notes
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
techniques includes the process of executing a program or application with the intent of finding software
bugs (errors or other defects).
Necessity:
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).
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.
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.
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.
Of the entire program behaviors, the specified ones are in the circle labeled S, and all those behaviors
actually programmed are in P.
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.
Basic definitions of Process and product: Process refers to how we do something, and product is end
result of process.
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
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
Levels of Testing:
Figure below shows the level of abstraction and testing in the waterfall model.
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.
• 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 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
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
Structured Implementation:
Figure shows the dataflow diagram description of triangle program. We could implement it as a main
program with the three indicated procedures.
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.)
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.
Example: Let us consider: Total number of locks sold=10, Total number of stocks sold=10, Total
number of Barrels sold=10,
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
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 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
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)
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)
7. Explain in detail various levels of software testing with embedded device like SATM as an example.
(15M)