1 Principles of Computer Science I Prof. Nadeem Abdul Hamid CSC 120 – Fall 2005 Lecture Unit 10 - Testing.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Lecture 8: Testing, Verification and Validation
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
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.
Testing & Debugging CSC 171 FALL 2004 LECTURE 13.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
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.
(c) 2007 Mauro Pezzè & Michal Young Ch 10, slide 1 Functional testing.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
ECE122 L17: Method Development and Testing April 5, 2007 ECE 122 Engineering Problem Solving with Java Lecture 17 Method Development and Testing.
Computer Skills Preparatory Year Presented by: L.Obead Alhadreti.
Types and Techniques of Software Testing
Operating Systems.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Fundamentals of Python: From First Programs Through Data Structures
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
COMP 354 Software Engineering I Section BB Summer 2009 Dr Greg Butler
Fundamentals of Python: First Programs
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
Objectives Understand the basic concepts and definitions relating to testing, like error, fault, failure, test case, test suite, test harness. Explore.
CS 501: Software Engineering Fall 1999 Lecture 16 Verification and Validation.
Software Engineering Chapter 23 Software Testing Ku-Yaw Chang Assistant Professor Department of Computer Science and Information.
Chapter 10 – Testing and Debugging. Chapter Goals ► Learn techniques to test your code ► Learn to carry out unit tests ► Understand principles of test.
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
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.
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
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.
Chapter 10 Testing and Debugging. Chapter Goals ► To learn how to carry out unit tests ► To understand the principles of test case selection and evaluation.
Debugging Strategies from Software Carpentry. Agan's Rules Many people make debugging harder than it needs to be by: Using inadequate tools Not going.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Software Construction Lecture 18 Software Testing.
(1) Unit Testing and Test Planning CS2110: SW Development Methods These slides design for use in lab. They supplement more complete slides used in lecture.
1 Principles of Computer Science I Prof. Nadeem Abdul Hamid CSC 120 – Fall 2005 Lecture Unit 2 - Using Objects.
Streams Using Python ByTim Walsh. What is a stream? Called a “generator” in Python Similar to a list First made available in Python 2.2, all newer versions.
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.
Week 14 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
CPSC 873 John D. McGregor Session 9 Testing Vocabulary.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
CS451 Lecture 10: Software Testing Yugi Lee STB #555 (816)
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
Software Quality Assurance and Testing Fazal Rehman Shamil.
Dynamic Testing.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
Outline Announcements: –HW I key online this afternoon –HW II due Friday –Sign up to discuss projects Debugging Testging for correctness.
Perfecto Mobile Automation
Today's Ninja Challenge: Write Your First Computer Game!
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
CS 325: Software Engineering February 16, 2016 Designing a Design Class Diagram Design Class Diagrams DCD: Restaurant Example DCD: ATM Example Software.
Chapter 10 – Testing and Debugging. Goals Learn techniques to test your code Learn techniques to test your code Learn to carry out unit tests Learn to.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
Debugging and Testing Hussein Suleman March 2007 UCT Department of Computer Science Computer Science 1015F.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Testing and Debugging UCT Department of Computer Science Computer Science 1015F Hussein Suleman March 2009.
Software Testing.
Design and Programming
Chapter 1 Introduction(1.1)
CSE 303 Concepts and Tools for Software Development
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Java & Testing.
CSE 1020:Software Development
Programming Logic and Design Eighth Edition
Testing Slides adopted from John Jannotti, Brown University
Presentation transcript:

1 Principles of Computer Science I Prof. Nadeem Abdul Hamid CSC 120 – Fall 2005 Lecture Unit 10 - Testing

2 Testing Important for discovering and fixing errors in programs (bugs) Unit tests Most common method of testing program code Tests classes/methods in isolation, not the complete program For each test, you provide a simple class called a test harness Test harness feeds parameters to the methods being tested CSC120 — Berry College — Fall 2005

3 Example: Square Root Algorithm To compute the square root of a use a common algorithm: Guess a value x that might be somewhat close to the desired square root (x = a is ok) Actual square root lies between x and a/x Take midpoint (x + a/x) / 2 as a better guess Repeat the procedure. Stop when two successive approximations are very close to each other

4 Example: Polygons Methods for area and perimeter What polygons with known area/perimeter would you use as input?

5 Providing Test Cases Using input from user Hard to repeat and remember inputs Hardwire test inputs into test harness Alternative: put test inputs in a file and send through test harness Automatically generate test inputs using a loop Usually restricted to a small set of values Random generation of test cases

6 Choosing Test Cases Selecting good test cases is an important skill for debugging programs Test all features of the methods that you are testing Test typical test cases 100, 1/4, 0.01, 2, 10E12 Test boundary test cases: test cases that are at the boundary of acceptable inputs, eg. 0 Programmers often make mistakes dealing with boundary conditions Division by zero, extracting characters from empty strings, and accessing null pointers

7 Reading Test Inputs From a File Use input redirection: java Program < input.txt Some IDEs may not support this Then, use the command window (terminal/shell) Output redirection: java Program > output.txt

8 Regression Testing Save test cases Use saved test cases in subsequent versions A test suite is a set of tests for repeated testing Cycling = bug that is fixed but reappears in later versions Regression testing: repeating previous tests to ensure that known failures of prior versions do not appear in new versions

9 Test Coverage Black-box testing: test functionality without consideration of internal structure of implementation White-box testing: take internal structure into account when designing tests Test coverage: measure of how many parts of a program have been tested Make sure that each part of your program is exercised at least once by one test case e.g., make sure to execute each branch in at least one test case

10 Test Coverage Tip: write first test cases before program is written completely → gives insight into what program should do Modern programs can be challenging to test Graphical user interfaces (use of mouse) Network connections (delay and failures) There are tools to automate testing in this scenarios Basic principles of regression testing and complete coverage still hold

11 Exercises P10.1, P10.2, 10.5