2_Testing Testing techniques.

Slides:



Advertisements
Similar presentations
Chapter 15 Debugging. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Debugging with High Level Languages.
Advertisements

Why care about debugging? How many of you have written a program that worked perfectly the first time? No one (including me!) writes a program that works.
An Introduction to Java Programming and Object- Oriented Application Development Chapter 8 Exceptions and Assertions.
Programming Types of Testing.
Debugging Techniques1. 2 Introduction Bugs How to debug Using of debugger provided by the IDE Exception Handling Techniques.
Lecture Roger Sutton CO331 Visual programming 15: Debugging 1.
Programming Languages: Notes for Class Discussion: V Deena Engel’s class.
Java Review 2 – Errors, Exceptions, Debugging Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Debugging Logic Errors CPS120 Introduction to Computer Science Lecture 6.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 2 Fundamentals of Programming Languages 4/5/09 Python Mini-Course: Day.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Object Oriented Programming
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
Programming Lifecycle
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
2_Testing Testing techniques. Testing Crucial stage in the software development process. Significant portion of your time on testing for each programming.
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
Testing Methods Carl Smith National Certificate Year 2 – Unit 4.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
ME 142 Engineering Computation I Debugging Techniques.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Program Errors and Debugging Week 10, Thursday Lab.
Controlling Execution Programming Right from the Start with Visual Basic.NET 1/e 8.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Debugging and Profiling With some help from Software Carpentry resources.
Basic Programming Lingo. A program is also known as a  Sequence of instructions  Application  App  Binary  Executable.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
1 Program Planning and Design Important stages before actual program is written.
Java Basics Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
Error messages 25-Apr-17.
ERRORS. Types of errors: Syntax errors Logical errors.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
The Hashemite University Computer Engineering Department
CS 177 Week 10 Recitation Slides 1 1 Debugging. Announcements 2 2.
Error Handling Tonga Institute of Higher Education.
Chapter 7 What’s Wrong with It? (Syntax and Logic Errors) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Lecture 3 Computer Programming -1-. The main steps of program development to solve the problem: 1- problem definition : The problem must be defined into.
Harvard Mark I Howard Aiken was a pioneer in computing and a creator of conceptual design for IBM in the 1940s. He envisioned an electro-mechanical computing.
Debugging and Testing Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
Testing and Debugging UCT Department of Computer Science Computer Science 1015F Hussein Suleman March 2009.
Wrapper Classes Debugging Interlude 1
Writing algorithms Introduction to Python.
Debugging and Handling Exceptions
ME 142 Engineering Computation I
Testing Tutorial 7.
CS1101X Programming Methodology
Testing and Debugging.
Chapter 2 Assignment and Interactive Input
Loop Structures.
Software Design and Development
Debugging CMSC 202.
CSS 161: Fundamentals of Computing
Problem Solving Techniques
Chapter 15 Debugging.
PROGRAMMING METHODOLOGY
Tonga Institute of Higher Education
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Chapter 15 Debugging.
Algorithm and Ambiguity
Bugs & Debugging - Testing
Software Development Process
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Learning Intention I will learn about the different types of programming errors.
Review of Previous Lesson
Chapter 15 Debugging.
CHAPTER 6 Testing and Debugging.
Chapter 15 Debugging.
Presentation transcript:

2_Testing Testing techniques

Testing Crucial stage in the software development process. Significant portion of your time on testing for each programming exercise in this course. Testing ensures that the program that you are developing meets the requirements of the problem. Later JUnit framework to perform one kind of testing called “unit testing.” Exception for runtime faults Testing allows you to detect bugs in your code. After a bug is identified, it must be fixed without introducing other bugs.

Bug Types and Debugging Techniques Syntax errors A syntax error occurs when a program does not satisfy the grammatical rules of the programming language. For example, in Java, each declaration statement must end with a semi-colon. Forgetting it is a syntax error. Among other things, it is the role of the compiler to catch syntax errors. Therefore, such errors are the easiest to catch and fix. Errors.java

Bug Types and Debugging Techniques Runtime errors A runtime error occurs when the execution of the program terminates abnormally. Note that these errors manifest themselves at run time, not at compile time, which makes them more problematic than syntax errors. For example, an exception is raised when attempting to divide by zero.

Bug Types and Debugging Techniques Logic errors A logic error exists every time the program does not behave the way it was supposed to, as specified in the requirements. These are the worst kind of errors because they are not caught by the compiler and they do not cause the program to crash. They may go undetected for a long time since they may manifest themselves only in a particular setting, e.g., for specific input values.

Debugging Debugging is the process of correcting errors in a program. Use a combination of techniques for debugging: Hand-trace the program Insert ’print’ statements to keep track of which instructions are executed and what values variables take. 3. Use a software utility called a debugger to: Set breakpoints Execute your program one statement at a time Display the value of variables and inspect the state of objects Step into a method’s body or step over a method call Inspect the call sequence Pause (halt), resume, or terminate a long-running program

Example: Counting syllables One simple algorithm to count the number of syllables in a word: count the number of vowel groups in the word, where a vowel group is a sequence of consecutive vowels that is surrounded by consonants on both sides or else appears at the beginning or the end of the word. This algorithm works in most cases provided silent e’s are removed from the end of the word, since they do not constitute a new syllable (e.g., in “niece” or “course”). In addition, a vowel count of zero is treated as a count of one to account for words such as “the” that end in e and contain only one syllable.

An FSM for a syllable-counter Event state vowel not a vowel Not in VG In VG (count++) In VG