CS1: chr, jeh, & Testing vs. Debugging Testing finds problems –Unit test –Integration test –System test Debugging finds and fixes causes.

Slides:



Advertisements
Similar presentations
Testing and Inspecting to Ensure High Quality
Advertisements

Lecture 2: testing Book: Chapter 9 What is testing? Testing is not showing that there are no errors in the program. Testing cannot show that the program.
Software Testing. Quality is Hard to Pin Down Concise, clear definition is elusive Not easily quantifiable Many things to many people You'll know it when.
CS0007: Introduction to Computer Programming Introduction to Classes and Objects.
Composition CMSC 202. Code Reuse Effective software development relies on reusing existing code. Code reuse must be more than just copying code and changing.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Practical Testing Techniques. Verification and Validation Validation –does the software do what was wanted? “Are we building the right system?” –This.
Written by: Dr. JJ Shepherd
Software Failure: Reasons Incorrect, missing, impossible requirements * Requirement validation. Incorrect specification * Specification verification. Faulty.
FIT FIT1002 Computer Programming Unit 19 Testing and Debugging.
Well-behaved objects 4.0 Testing. 2 Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling Main concepts to.
16/27/2015 3:38 AM6/27/2015 3:38 AM6/27/2015 3:38 AMTesting and Debugging Testing The process of verifying the software performs to the specifications.
Terms and Rules Professor Evan Korth New York University (All rights reserved)
Testing an individual module
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Chapter 6 Control Statements Continued
ECE122 L17: Method Development and Testing April 5, 2007 ECE 122 Engineering Problem Solving with Java Lecture 17 Method Development and Testing.
Outline Types of errors Component Testing Testing Strategy
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Testing Dr. Andrew Wallace PhD BEng(hons) EurIng
Games and Simulations O-O Programming in Java The Walker School
Fundamentals of Python: From First Programs Through Data Structures
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
Object-Oriented Software Testing. C-S 5462 Object-Oriented Software Testing Research confirms that testing methods proposed for procedural approach are.
Modular Programming Chapter Value and Reference Parameters t Function declaration: void computesumave(float num1, float num2, float& sum, float&
CMSC 345 Fall 2000 Unit Testing. The testing process.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
Structured programming 4 Day 34 LING Computational Linguistics Harry Howard Tulane University.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
CSE 219 Computer Science III Testing. Testing vs. Debugging Testing: Create and use scenarios which reveal incorrect behaviors –Design of test cases:
1 Data Structures CSCI 132, Spring 2014 Lecture 3 Programming Principles and Life Read Ch. 1.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Neil Ghani Software testing. 2 Introduction In a perfect world all programs fully verified testing thus redundant Back in the real.
COMP 121 Week 1: Testing and Debugging. Testing Program testing can be used to show the presence of bugs, but never to show their absence! ~ Edsger Dijkstra.
CSE403 Software Engineering Autumn 2001 More Testing Gary Kimura Lecture #10 October 22, 2001.
Testing Testing Techniques to Design Tests. Testing:Example Problem: Find a mode and its frequency given an ordered list (array) of with one or more integer.
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
OOP in Java : © W. Milner 2005 : Slide 1 Java and OOP Part 2 – Classes and objects.
What is Testing? Testing is the process of finding errors in the system implementation. –The intent of testing is to find problems with the system.
Testing Chapter 23 IB103 Week 12 (part 3). Verify that a complex (any) program works correctly, that the program meets specifications The chapter reviews.
Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
Written by: Dr. JJ Shepherd
CompSci 100E 18.1 Testing and Debugging Robert A Wagner.
 Software Testing Software Testing  Characteristics of Testable Software Characteristics of Testable Software  A Testing Life Cycle A Testing Life.
Dynamic Testing.
Software Testing. Software Quality Assurance Overarching term Time consuming (40% to 90% of dev effort) Includes –Verification: Building the product right,
Subject Name: Software Testing Subject Code: 10CS842 Prepared By:
Java Primer 1: Types, Classes and Operators
Chapter 3: Using Methods, Classes, and Objects
Some Simple Definitions for Testing
Types of Testing Visit to more Learning Resources.
CSS 161: Fundamentals of Computing
UNIT-4 BLACKBOX AND WHITEBOX TESTING
slides created by Ethan Apter
slides created by Ethan Apter
Defining Classes and Methods
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
CSE403 Software Engineering Autumn 2000 More Testing
The Zoo of Software Security Techniques
CSE 1020:Software Development
Test Cases, Test Suites and Test Case management systems
slides created by Ethan Apter and Marty Stepp
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

CS1: chr, jeh, & Testing vs. Debugging Testing finds problems –Unit test –Integration test –System test Debugging finds and fixes causes of problems

CS1: chr, jeh, & Testing Static testing –Inspection –Code review –Walk-through Unit testing –Black box – Functional testing –White box – Structural testing Regression testing

CS1: chr, jeh, & A Test Strategy When code is messy, testing is hard. Java helps us by giving us the ability to test one piece (class) at a time. –Modularity methods objects –Encapsulation Data is packed with the methods (behaviors) that act on it. Private data means there is no other way to mess around with it.

CS1: chr, jeh, & Test Strategies Bottom-up test. Examine the Javadoc for the simplier methods, or for methods that are not dependent on others.

CS1: chr, jeh, & Debugging Recreate the problem. Think about the cause - don't try ad hoc testing. Narrow it down. Use debug statements. Vary data to pattern failures. Create tests that rule out portions of code (narrow the search).

CS1: chr, jeh, & Common Problem Areas Static variables treated like instance variables or vice-versa. Local variables treated like instance variables or vice-versa. –Same argument and instance variable names (recall the this example?). Invoking the wrong constructor. Off-by-one errors in ifs and loops. Faulty Boolean expressions.

CS1: chr, jeh, & Debugging Fix one problem at a time. Retest. This is called regression testing. Be sure you didn’t correct a problem in one place but create a new problem somewhere else. When all problems are fixed, rerun a full suite of tests.

CS1: chr, jeh, & Unit Testing In object-oriented programming, the logical unit to test is the class. –Create an object. –Call methods in different orders and with different argument values. Methods that modify state are called mutators. –Frequently check the state of the object to see if it is correct. Methods that reveal state are called accessors.

CS1: chr, jeh, & Writing a test harness Write a main method that creates instances of your class (creates objects), and then invokes the methods. Did everything work? Invoke its methods. Here's a pattern. 1.Call one method that modifies the object's state. 2.Call all methods that report the object's state. 3.Repeat #1-2 many times, with a different choice for the first step each time. This sounds trivial, but it can actually be a lot of work. This is critical -- you must test or you won’t know if your work is correct!

Prof. John Noll, Santa Clara Univ. CS1: chr, jeh, & Divide the input into equivalence classes. 1.Identify equivalence classes for each input type. Each input in a class yields the same (equivalent) execution path. –Range - one valid, two invalid classes Year between 1902 and 2038 –Number of inputs - one valid, two invalid classes Entries shall have exactly three fields. –Set (enumeration) - one valid class (the set), one invalid class (the set complement) Weekdays (not weekend days) –“Must be” constraint - one valid class (input satisfying constraint), one invalid class (input not satisfying constraint) Start date must precede End date. –Sub-classes - an equivalence class should be divided into sub-classes if elements of a given EC are handled differently by the program Passwords with fewer than 8 characters must include numbers as well as letters 2.Write test cases to cover each valid equivalence. Combine these into as few tests as possible. 3.Write test cases to cover each invalid equivalence class. Specify a separate test for each of these.