Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

Making the System Operational
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.
Simulation and Example
Lecture 8: Testing, Verification and Validation
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
(1) Verification Methods CS2110: SW Development Methods Reading: Study Section in the MSD text These slides supplement the textbook – These touch.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
Object Oriented Design An object combines data and operations on that data (object is an instance of class) data: class variables operations: methods Three.
ITEC200 Week02 Program Correctness and Efficiency.
Testing and Debugging CS221 – 2/13/09. Airline Program.
Program Correctness and Efficiency Chapter 2. Chapter 2: Program Correctness and Efficiency2 Chapter Objectives To understand the differences between.
Program Correctness and Efficiency Chapter 2. Chapter Objectives  To understand the differences between the three categories of program errors  To understand.
Program Testing Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
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.
Testing an individual module
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Program Correctness and Efficiency Chapter 2 Chapter 2: Program Correctness and Efficiency2 Chapter Objectives To understand the differences between.
Fall 2007CS 225 Program Correctness and Efficiency Chapter 2.
System/Software Testing
Modular Programming Chapter Value and Reference Parameters t Function declaration: void computesumave(float num1, float num2, float& sum, float&
TESTING.
© 2012 IBM Corporation Rational Insight | Back to Basis Series Chao Zhang Unit Testing.
Introduction Telerik Software Academy Software Quality Assurance.
CMSC 345 Fall 2000 Unit Testing. The testing process.
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.
FCS - AAO - DM COMPE/SE/ISE 492 Senior Project 2 System/Software Test Documentation (STD) System/Software Test Documentation (STD)
Lecture 11 Testing and Debugging SFDV Principles of Information Systems.
Design and Programming Chapter 7 Applied Software Project Management, Stellman & Greene See also:
Software Development Software Testing. Testing Definitions There are many tests going under various names. The following is a general list to get a feel.
Software Life Cycle Requirements and problem analysis. –What exactly is this system supposed to do? Design –How will the system solve the problem? Coding.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
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.
Week81 APCS-AB: Java Unit Testing Information today from “Unit Testing in BlueJ” October 28, 2005.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
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.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Debugging COMP T1.
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation.
Software Quality Assurance and Testing Fazal Rehman Shamil.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
Chapter – 8 Software Tools.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
CIS 068 Welcome to CIS 068 ! Lesson 3: Algorithm Correctness And Efficiency.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Testing It is much better to have a plan when testing your programs than it is to just randomly try values in a haphazard fashion. Testing Strategies:
Testing i. explain the importance of system testing and installation planning;
Testing Integral part of the software development process.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
Testing Tutorial 7.
Software Testing.
Rekayasa Perangkat Lunak Part-13
John D. McGregor Session 9 Testing Vocabulary
C++ Plus Data Structures
Testing and Debugging.
John D. McGregor Session 9 Testing Vocabulary
UNIT-4 BLACKBOX AND WHITEBOX TESTING
John D. McGregor Session 9 Testing Vocabulary
Lecture 09:Software Testing
Algorithm Correctness
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Program Correctness and Efficiency
Software Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

Testing

What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects after all syntax errors have been removed and the program compiles No amount of testing can guarantee the absence of defects in sufficiently complex programs

Careful Testing is Needed Unless all possible inputs are tested (usually impossible), testing cannot guarantee freedom from logic errors –Errors that always occur are easily found –But, errors that occur sporadically or only in certain special cases are hard to find –Testers must be careful and clever to test these obscure conditions!

Structured Walkthroughs Designer must explain the algorithm to other team members and simulate its execution with other team members looking on When you explain, you often catch your own errors Teammates might see errors or misconceptions

Levels and Types of Testing Unit testing: checking the smallest testable piece of the software (a method or class) Integration testing: testing the interactions among units System testing: testing the program in context

Levels and Types of Testing (continued) Acceptance testing: system testing designed to show that the program meets its functional requirements Black-box testing: tests the item based on its interfaces and functional requirements White-box testing: tests the software with the knowledge of its internal structure

Preparations for Testing A test plan should be developed early in the design phase Testing should take place concurrently with the design and coding A good programmer practices defensive programming –Include code to detect invalid or unexpected data (e.g. exception code)

Test Plan How will the software be tested? When will the tests occur? Who will do the testing? What is the test data (and expected results)?

Start with Documentation Method documentation: include parameters and expected results Carefully document method parameters and class attributes in comments as you write the code Include pre- and post-conditions

Include Helpful Output Leave a trace of execution by displaying the method name as you enter it Display values of all input parameters upon entry to a method Display the values of any class attributes that are accessed by this method Display the values of all method outputs after returning from a method

Developing the Test Data Specify test data during the analysis and design phases for the different levels of testing: unit, integration, and system Data includes inputs & expected outputs

Black Box Testing Test relationship between inputs & outputs Check for all (types of) expected inputs Check for unanticipated data –If a monkey was sitting at a keyboard…

White Box Testing Goal is to test every path through the code For every if statement, there should be at least one test case where the condition is false, and one where the condition is true All methods of all classes should be exercised

Boundary Conditions These are cases where errors often happen –The first or last execution of a loop (Off-by-one error) –The largest or smallest possible value –The first or last location in an array

Who Does Testing? The programmer –Risk: blind to his/her own oversights Other members of the software team who did not code the module being tested –Quality Assurance organization within company –Team member not responsible for the code Final users of the software product –Alpha testing –Beta testing –After delivery (unfortunately)

Unit Testing (Drivers & Stubs) To test a method, some other method or main needs to call it –A driver is written specifically to run test cases on one or more methods To test a method, methods that it uses must be implemented –A stub is written to allow its parent to be tested

Drivers A driver program declares any necessary object instances and variables, assigns values to any of the method’s inputs, calls the method, and displays the values of any outputs returned by the method You can put a main method in a class to serve as the test driver for that class’s methods

Stubs The replacement of a method that has not yet been implemented or tested is called a stub A stub has the same header as the method it replaces, but its body only displays a message indicating that the stub was called (and returns a default result if a return is needed)

Using a Test Framework A test framework is a software product that facilitates writing test cases, organizing the test cases into test suites, running the test suites, and reporting the results A test framework often used for Java products is JUnit, an open-source product that can be used in a stand-alone mode and is available from junit.org Junit is also included within Eclipse and BlueJ (and other Java IDE’s)

Junit in BlueJ Enable testing: –Preferences : Miscellaneous – check “Unit Testing Tools” Right click a class, ‘Create Test Class’ Creates a (green) test class Edit text or right-click for options Click ‘run tests’ to run all tests at once

Junit in Eclipse With the class you want to test open, select File / New / Junit TestCase Click ‘setup’ and ‘teardown’ for items to create (you can delete later if you don’t need them) Create tests (all begin with the word test) Run / Run As / Junit test (to test)