0% found this document useful (0 votes)
24 views22 pages

Validation, Verification and Testing

The document discusses the importance of validation and verification in computer systems to ensure accurate and reasonable data inputs. It outlines various validation methods such as range checks, length checks, type checks, presence checks, and format checks, as well as verification techniques like double entry and visual checks. Additionally, it explains the significance of testing with normal, erroneous, extreme, and boundary data to ensure program reliability.

Uploaded by

chawyadanarsan20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views22 pages

Validation, Verification and Testing

The document discusses the importance of validation and verification in computer systems to ensure accurate and reasonable data inputs. It outlines various validation methods such as range checks, length checks, type checks, presence checks, and format checks, as well as verification techniques like double entry and visual checks. Additionally, it explains the significance of testing with normal, erroneous, extreme, and boundary data to ensure program reliability.

Uploaded by

chawyadanarsan20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Validation and verification

 In order for computer systems to only accept data inputs that are reasonable and
accurate, every data inputs needs to be examined before it is accepted by the
system.
 There are two different methods:
 Validation
 Verification
Validation
 is an automatic check to ensure that data entered is reasonable before it is
accepted into a computer system.
 When data is validated by a computer system, if the data is rejected a message
should be output explaining why data was rejected and another opportunity given
to enter the data
 cannot ensure data is accurate.
 stops unexpected or abnormal data from crashing program and prevents from
receiving impossible garbage outputs.
 There are many different types of validation checks including:
Validation
Range Check
 checks that only numbers within a specified range are accepted
 Data outside the expected range is rejected
 Example : Mark ( between 0 and 100 inclusive)

OUTPUT “Pls enter the student’s mark”


REPEAT
INPUT mark
IF mark < OR mark > 100
0 OUTPUT “TheTHEN
student should be in the range 0 to 100, Pls re-enter the
mark”
ENDIF
UNTIL mark >= AND mark <= 100
0
 OUTPUT “Enter Your Mark :”
 INPUT Mark
 WHILE Mark < 0 OR Mark > 100 Do
 OUTPUT “Error ..”
 INPUT Mark
 ENDWHILE
 OUTPUT “Enter Your mark :”
 INPUT Mark
 WHILE Mark < 0 OR Mark > 100 DO
 OUTPUT “Error . Pls enter again..”
 INPUT Mark
 ENDWHILE
 OUTPUT “Enter your Mark :”
 INPUT Mark
 WHILE Mark < 0 OR Mark > 100 DO
 OUTPUT “ Incorrect …”
 INPUT Mark
 ENDWHILE
Validation
Length Check
 Checks either that data contains an exact number of characters.
Example: an 8 character password
Or
 that the data entered is a reasonable number of characters
Example: family name (between two and 30 characters inclusive)
OUTPUT “Pls enter your password of 8 characters”
REPEAT
INPUT Password
IF LENGTH (Password) < > 8
OUTPUT “Your password must be 8 characters, Pls re-enter ”
ENDIF

UNTIL LENGTH (Password) = 8


 OUTPUT “Enter your password “
 INPUT Password
 WHILE LENGTH (Password) < > 8 DO
 OUTPUT “Error…”
 INPUT Password
 ENDWHILE
Validation
 Length Check

OUTPUT “Pls enter your family name”


REPEAT
INPUT FamilyName
IF LENGTH (FamilyName) < OR LENGTH (FamilyName) >
30 be between 2 and 30 characters, Pls
2OUTPUT “Your Family name must
re-enter ”
ENDIF
UNTI LENGTH (FamilyName) AND LENGTH (FamilyName)<= 30
L >= 2
Validation
Type Check
 checks that the data entered is of a given data type
Example : the number of student (Integer)

OUTPUT “Pls enter the number of student”


REPEAT
INPUT NumberofStu
IF NumberofStu <> NumberofStu DIV
1OUTPUT “This must be whole number, Pls re-enter”
ENDIF
UNTIL NumberofStu = NumberofStu DIV 1
Validation
Presence Check
 checks to ensure that some data has been entered and the value has not been
left blank
Example : Email ( online transaction)

OUTPUT “Pls enter Email address”


REPEAT
INPUT Email
IF Email = “”
OUTPUT “Email must be required. Pls enter email”
ENDIF
UNTIL Email <> “”
Validation
Format Check
 checks that the characters entered conform to a pre-defined pattern
Example: Date ( MM/DD/YYYY), the cub number (CUB9999)
Validation
Check Digit
 are used for barcodes, product codes, International Standard Book Numbers (ISBN)
and Vehicle Identification Numbers (VIN)
 is the final digit included in a code; it is calculated from all the other digits in the code
 are used to identify errors in data entry caused by mis-typing or mis-scanning a
barcode
 detect the following types of error:
 an incorrect digit entered (eg : 5327  5027)
 transposition errors ( 537  507)
 omitted or extra digits ( 537  53)
 phonetic errors ( 13  30)
Exercise
Which validation checks could you use for the following? You may decide
that more than one validation check is required.
a. Entering a telephone number.
b. Entering a student’s name.
c. Entering a part number in the form XXX999, where X must be a letter and
9 must be a digit.

Draw a flow chart which validate the input number is between 1 and 50.
Verification
 does not check if data makes sense or is within acceptable boundaries, it only
checks that the data entered is identical to the original source.
 prevents errors when data is copied from one medium to another.
 Verification methods include:

Verification Method Description


Double Entry Data is entered twice and the computer checks that they
match up
Screen/ Visual Check  The user manually reads and compares the newly
inputted data against the original source to ensure they
match
 When the data entry is complete the data is displayed on
the screen and the user is asked to confirm that it is
correct before continuing
Testing and Test Data
 In order to determine whether a solution is working as it should, it needs to be
tested.
 To test a program, each section of the code is run using sample data.
 This sample data is known as test data.
 There are four types of test data should be used to make sure a program is bug-
free.
 Normal Test Data
 Erroneous/abnormal data
 Extreme data
 Boundary data
Test Data
Normal data
 is test data that is typical (expected) and should be accepted by the system
For Example:
 An algorithm that calculates sales of tickets for an outdoor festival. A customer
is allowed to buy between 1 and 5 tickets.

Normal Test Data : 2 ,3 ,4

Expected Results: This value should be accepted and the


algorithm calculate the sales of tickets
correctly

Purpose : The normal test data is used to check


that the algorithm calculate the sales
of tickets correctly.
Test Data
Erroneous/Abnormal data
 is test data that falls outside of what is acceptable and should be rejected by
the system.
For Example:
 An algorithm that calculates sales of tickets for an outdoor festival. A customer
is allowed to buy between 1 and 5 tickets.

Abnormal Test Data : 0, 10, six, 1.5

Expected Results: This values should be rejected

Purpose : Erroneous data is used to check that


the algorithm does not accept it.
Test Data
Extreme data
 is test data at the upper or lower limits of expectations that should be
accepted by the system
For Example:
 An algorithm that calculates sales of tickets for an outdoor festival. A customer
is allowed to buy between 1 and 5 tickets.

Extreme Test Data : 1, 5

Expected Results: This values should be accepted


and the algorithm calculate the
sales of tickets correctly

Purpose : Extreme data is used to check that the


algorithm works correctly with this test
data at upper and lower limit.
Test Data
Boundary data
 A pair of values at each end of a range:
 The data at the upper or lower limits of expectations that should be accepted
 The immediate values before or beyond the limits of expectations that should
be rejected
For Example:
 An algorithm that calculates sales of tickets for an outdoor festival. A customer is
allowed to buy between 1 and 5 tickets..

Boundary Data : 1, 0; 5,6

Expected Results: 1,5 are accepted; 0 and 6 are rejected

Purpose : Boundary data is used to check that the algorithm works correctly with
this test data at upper and lower limit and rejects the test data beyond
the limit.
Example
 The algorithm that accept only integers between 1 and 10 as input.
 Provide two sets of normal data and their expected results.
 Provide some abnormal/erroneous data.
 Identify the boundary data required and the expected results.

Normal Test Data : 2,9

Expected Results: This value should


be accepted
Abnormal Test Data : 0,20

Expected Results:

Boundary Test Data : 1, 0 ; 10,11


Expected Results:
Exercise
A programmer restricts input values to less than and equal to 70 and greater than29.
State two different types of test data the programmer would need to use. Give an
example of each type and the reason that the programmer chose that test data.
 Type1 :
 Example :
 Reason :

 Type2 :
Data > 29 AND Data <= 70
 Example :
 Reason :

 Type 3 :
 Boundary

You might also like