6. Testing and Verification

Slides:



Advertisements
Similar presentations
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Advertisements

Topics Introduction Types of Errors Exceptions Exception Handling
Lecture 9. 2 Exception  An exception is a unusual, often unpredictable event, detectable by software or hardware, that requires special processing occurring.
Exception Handling The purpose of exception handling is to permit the program to catch and handle errors rather than letting the error occur and suffer.
1 Chapter 17-2 Templates and Exceptions Dale/Weems.
An Introduction to Java Programming and Object- Oriented Application Development Chapter 8 Exceptions and Assertions.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 15: Exception Handling.
Chapter 16: Exception Handling C++ Programming: From Problem Analysis to Program Design, Fifth Edition.
Objectives In this chapter you will: Learn what an exception is Learn how to handle exceptions within a program See how a try / catch block is used to.
 Both System.out and System.err are streams—a sequence of bytes.  System.out (the standard output stream) displays output  System.err (the standard.
Chapter 8Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 8 l Basic Exception Handling »the mechanics of exceptions l.
SE-1020 Dr. Mark L. Hornick 1 Exceptions and Exception Handling.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 16: Exception Handling.
Slides prepared by Rose Williams, Binghamton University ICS201 Exception Handling University of Hail College of Computer Science and Engineering Department.
1 CSC241: Object Oriented Programming Lecture No 28.
Exception Handling. Introduction An exception is an abnormal condition that arises in a code sequence at run time. In computer languages that do not support.
Static Technique. Static Technique - Review  A way of testing software work products  Program code, requirement spec., design spec.  Test plan, test.
Testing Without Executing the Code Pavlina Koleva Junior QA Engineer WinCore Telerik QA Academy Telerik QA Academy.
CSI 3120, Exception handling, page 1 Exception and Event Handling Credits Robert W. Sebesta, Concepts of Programming Languages, 8 th ed., 2007 Dr. Nathalie.
Code Inspections CS 414 – Software Engineering I Donald J. Bagert Rose-Hulman Institute of Technology January 23, 2003.
Exceptions and Exception Handling (2) Carl Alphonce CSE116.
1 Software Testing and Quality Assurance Lecture 2 Software Verification & Validation.
Program Correctness and Efficiency Chapter 2. Chapter 2: Program Correctness and Efficiency2 Chapter Objectives To understand the differences between.
Exceptions in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© Copyright Eliyahu Brutman Exceptions. © Copyright Eliyahu Brutman Exceptions and Design Patterns - 2 Introduction to Exception Handling Definition:
Rossella Lau Lecture 9, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 9: Application with Exception Handling 
Slides prepared by Rose Williams, Binghamton University Chapter 9 More Exception Handling.
Java Review 2 – Errors, Exceptions, Debugging Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Exception Error handling. Exception 4 n An unusual occurrence during program execution that requires immediate handling n Errors are the most common type.
1 Software Inspections and Walkthroughs Author: A. Frank Ackerman Presented by Cynthia Johnson EEL6883.
Design Reviews Peer Reviews. Agenda Peer Reviews Participants of Peer Review Preparation for a Peer Review Session The Peer Review Session Post-peer Review.
1 Exception and Event Handling (Based on:Concepts of Programming Languages, 8 th edition, by Robert W. Sebesta, 2007)
CSE333 SECTION 7. Template vs Generics C++ templates are similar to preprocessor macros A template will be “materialized” into multiple copies with T.
Software Inspections and Walkthroughs By. Adnan khan.
Modular Programming Chapter Value and Reference Parameters t Function declaration: void computesumave(float num1, float num2, float& sum, float&
1 Exception Handling Introduction to Exception Handling Exception Handling in PLs –Ada –C++ –Java Sebesta Chapter 14.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 9 : Exception Handling King Fahd University of Petroleum & Minerals College of Computer.
Object Oriented Programming
CIS 270—Application Development II Chapter 13—Exception Handling.
Software Inspection A basic tool for defect removal A basic tool for defect removal Urgent need for QA and removal can be supported by inspection Urgent.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
How to Design Error Steady Code Ivaylo Bratoev Telerik Corporation
Introduction to Exception Handling and Defensive Programming.
CHAPTER 9 INSPECTIONS AS AN UP-FRONT QUALITY TECHNIQUE
Chapter 14: Exception Handling. Objectives In this chapter, you will: – Learn what an exception is – Learn how to handle exceptions within a program –
Exceptions in Java. Exceptions An exception is an object describing an unusual or erroneous situation Exceptions are thrown by a program, and may be caught.
BIO Java 1 Exception Handling Aborting program not always a good idea – can’t lose messages – E-commerce: must ensure correct handling of private.
Exceptions in C++. Exceptions  Exceptions provide a way to handle the errors generated by our programs by transferring control to functions called handlers.
Exceptions and Assertions Chapter 15 – CSCI 1302.
Chapter 15: Exception Handling C++ Programming: Program Design Including Data Structures, Fifth Edition.
© Michael Crosby and Charles Sacker, 2001 Systematic Software Reviews Software reviews are a “quality improvement process for written material”.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
CMSC 202 Computer Science II for Majors. CMSC 202UMBC Topics Exceptions Exception handling.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Exception and Exception Handling. Exception An abnormal event that is likely to happen during program is execution Computer could run out of memory Calling.
CIS 068 Welcome to CIS 068 ! Lesson 3: Algorithm Correctness And Efficiency.
Throw, Throws & Try-Catch Statements Explanations and Pictures from: Reference:
ECE122 L23: Exceptions December 6, 2007 ECE 122 Engineering Problem Solving with Java Lecture 24 Exceptions.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
2.4 Exceptions n Detects try { //code that may raise an exception and/or set some condition if (condition) throw exceptionName; //Freq. A string } n Handles.
Chapter 6 CS 3370 – C++ Functions.
Why exception handling in C++?
Chapter 14: Exception Handling
Chapter 17 Templates and Exceptions Part 2
Throwing and catching exceptions
Algorithm Correctness
Applied Software Project Management
Exception Handling.
Exception and Event Handling
Testing, Inspection, Walkthrough
Presentation transcript:

6. Testing and Verification Yan Shi CS/SE 2630 Lecture Notes

Software Life Cycle A typical waterfall model

Test Plan and Test Specification See “Test Document Description (MS Word)” at http://www.uwplatt.edu/~shiy/courses/cs263/ Start planning for testing early! You should start test plan after you have a mature draft of requirement specification. Design your test cases when you design your system! Test specification is usually done during detailed design. In fact, unit test specification should be part of the detailed design document!

Inspection and Walkthrough Inspection: one member of a team reads the code line by line and other members point our errors. Walkthrough: a team performs a manual simulation of the program. Both are static software verification activities. Inspection is more formal than walkthrough. Both can be applied to code design unit test

Code Inspection Team A minimum formal inspection team includes: Designated Moderator: an inspector responsible for organizing and reporting on inspection Author: developer of work product At least one peer inspector: often chosen to represent specific role- designer, tester, technical writer, SQA, etc. Walkthroughs generally do not include designated moderator and are often led by the author of the software.

Steps of inspection Planning: Preparation Meeting Rework Follow-up choose the inspection team schedule the following steps Preparation author collects all artifacts to be inspected inspector get familiar with background knowledge Meeting defects are pointed out and recorded Rework author makes changes to the artifacts in response to defects Follow-up moderator verifies the corrections and finish inspection summary report

Evaluation Assertion An assertion is a logical proposition that can be true or false. void assert ( int expression ); If the expression of this macro compares equal to 0 (i.e., the expression is false), a message is written to the standard error device and terminate the program execution. #include <assert.h> to disable this macro, #define NDEBUG right before #include <assert.h> Examples: assert(length > 0); // abort if length is negative. Important Note: assert is used for debugging! DONOT make your code dependent of the expression evaluated!!!

Try-Throw-Catch We’d like to handle the exceptions by ourselves, instead of ugly system error! try { // Code that may cause an exception if ( condition ) throw exception_name; // usually a string } catch ( Type variable ) // Code that handles the exception

Example try { int value; cin >> value; if ( value < 0 ) throw string("Negative values!"); } catch ( string message) cout << "An exception occurred. “ << “Exception message: " << message << endl;

Exception Handling: C++ vs. Java All types can be thrown as exception Only throwable and exception objects catch (…) // catch all kind of exceptions Catch ( Exception e ) No such block There is a block called finally that is always executed after the try-catch block to do cleanup work.

Common Exceptions C++ provides support to handle exceptions via a hierarchy of classes: The class exception is the base class of the exception classes provided by C++. Multiple handlers (i.e., catch expressions) can be chained; each one with a different parameter type. Only the handler whose argument type matches the type of the exception specified in the throw statement is executed.

Namespace Name clashes occur when different libraries containing same names are used simultaneously. namespace pollution: dumping many names into the namespace. A namespace groups a collection of names that logically belong together. namespace myNames { void GetData( int& ); int a; } namespace yourNames void GetData( int & ); myNames::GetData( int& value ) { … } cout << yourNames::a;