cmpf 144 n.
Skip this Video
Loading SlideShow in 5 Seconds..
CMPF 144 PowerPoint Presentation
Download Presentation
CMPF 144

Loading in 2 Seconds...

play fullscreen
1 / 16

CMPF 144 - PowerPoint PPT Presentation

  • Uploaded on

CMPF 144. Testing and Validating program. Programming errors. Debugging – is the process of finding and correcting errors in computer programs. Program debugging is another form of problem solving. 3 types of programming errors: Design errors Syntax errors Run-time errors. Design errors.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'CMPF 144' - hunter-everett

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cmpf 144

CMPF 144

Testing and Validating program

programming errors
Programming errors
  • Debugging – is the process of finding and correcting errors in computer programs.
  • Program debugging is another form of problem solving.
  • 3 types of programming errors:
    • Design errors
    • Syntax errors
    • Run-time errors
design errors
Design errors
  • Occurs during :
    • Analysis
    • Design
    • Implementation


  • Make mistake in translating an algorithm into program
  • Choose incorrect method of solution for the problem to be solved
  • Design erroneous data for the program.

Difficult to detect

Debugging process: review careful the problem analysis , algorithm design , test data

syntax errors compilation errors
Syntax errors/compilation errors
  • Violation of syntax rules
  • Syntax rules – define how the elements of a programming language must be written
  • Occur during the implementation phase –detected by compiler during compilation process
  • Compiler issues diagnostic message-warning message/error message
  • Warning message
    • Indicates a minor error that may lead to a problem during program execution.
    • Does not cause the termination of the compilation process.
    • May cause errors sometimes (if serious)…
    • It is a good practice to warning seriously and eliminate their causes in the program.
  • Error message
    • Will cause the compiler stop from compiling the program
    • It tell that nature of the errors and the location of errors in the program
    • Since compiler explicitly ‘inform” the errors, thus syntax errors is relatively easy
example syntax error
Example: syntax error

>>> while True print 'Hello world‘

File "<stdin>", line 1, in ?

while True print 'Hello world'


SyntaxError: invalid syntax

  • The parser repeats the offending line and displays a little ‘arrow’ pointing at the earliest point in the line where the error was detected.
  • The error is caused by (or at least detected at) the token preceding the arrow: in the example, the error is detected at the keyword print since a colon (':') is missing before it.
  • File name and line number are printed so you know where to look in case the input came from a script.
example 2
Example 2

>>> print a+b:

SyntaxError: invalid syntax

run times errors
Run-times errors
  • Detected by computer while your program is being executed.
  • They are cause by program instructions that require the computer to do something illegal such as attempting to store inappropriate data or divide a number by 0.
  • When a run-time error is encountered, the computer produces an error diagnostic message and terminates the program execution.
example run time errors
Example: run-time errors

>>> print 1/0

Traceback (most recent call last):

File "<pyshell#6>", line 1, in <module>

print 1/0

ZeroDivisionError: integer division or modulo by zero

example 21
Example 2

>>> list=[123,'abc']

>>> print list[1]


>>> print list[2]

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

IndexError: list index out of range

testing and verification
Testing and verification
  • Program verification- is the process of ensuring that a program meets user requirements
  • Technique that can be use to verify program is by using program testing.
  • What is program testing????
    • program testing is the process of executing a program to demonstrate its correctness.
  • Used a set of data to test your program
  • Corrected output not necessarily means your program is logically correct.??? Why???
  • Must test all the conditions (if any) , selection, looping all must be tested to look at the flow …logic or not…
data validation
Data validation
  • In computer science data validation is the process of ensuring that a program operates on clean, correct and useful data.
  • It uses routines, often called “validation rules " or "check routines", that check for correctness, meaningfulness, and security of data that are input to the system.

Visual Studio .NET 2003

  • The simplest data validation verifies that the characters provided come from a valid set.
  • For example, telephone numbers should include the digits and possibly the characters +, -, (, and ) (plus, minus, and brackets).
  • A more sophisticated data validation routine would check to see the user had entered a valid country code, i.e., that the number of digits entered matched the convention for the country or area specified.

Visual Studio .NET 2003