1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

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.
1 Software Engineering Lecture 11 Software Testing.
Software Testing Fundamentals
Exam 1 Review u Scores Min 30 Max 96 Ave 63.9 Std Dev 14.5.
Software Testing and Quality Assurance
(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.
Copyright by Scott GrissomCh 1 Software Development Slide 1 Software Development The process of developing large software projects Different Approaches.
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.
Chapter 13 & 14 Software Testing Strategies and Techniques
Black Box Software Testing
1 Joe Meehean. 2 Testing is the process of executing a program with the intent of finding errors. -Glenford Myers.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
System/Software Testing
CMSC 345 Fall 2000 Unit Testing. The testing process.
Software Testing.
Process Design (Requirements). Recall the Four Steps of Problem Solving * Orient Plan Execute Test These apply to any kind of problem, not just spreadsheet.
Chapter 13: Implementation Phase 13.3 Good Programming Practice 13.6 Module Test Case Selection 13.7 Black-Box Module-Testing Techniques 13.8 Glass-Box.
Coverage – “Systematic” Testing Chapter 20. Dividing the input space for failure search Testing requires selecting inputs to try on the program, but how.
1 Software testing. 2 Testing Objectives Testing is a process of executing a program with the intent of finding an error. A good test case is in that.
1 Principles of Computer Science I Prof. Nadeem Abdul Hamid CSC 120 – Fall 2005 Lecture Unit 10 - Testing.
Errors And How to Handle Them. GIGO There is a saying in computer science: “Garbage in, garbage out.” Is this true, or is it just an excuse for bad programming?
Requirements-based Test Generation for Functional Testing (© 2012 Professor W. Eric Wong, The University of Texas at Dallas) 1 W. Eric Wong Department.
Chapter 1 Working with strings. Objectives Understand simple programs using character strings and the string library. Get acquainted with declarations,
Black-Box Testing Techniques I
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.
Flow of Control Part 1: Selection
Neil Ghani Software testing. 2 Introduction In a perfect world all programs fully verified testing thus redundant Back in the real.
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
Grey Box testing Tor Stålhane. What is Grey Box testing Grey Box testing is testing done with limited knowledge of the internal of the system. Grey Box.
INF 111 / CSE 121: Software Tools and Methods Lecture Notes for Fall Quarter, 2007 Michele Rousseau Set 12 (Some slides adapted from Sommerville 2000 &
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.
Black Box Testing Techniques Chapter 7. Black Box Testing Techniques Prepared by: Kris C. Calpotura, CoE, MSME, MIT  Introduction Introduction  Equivalence.
Black-box Testing.
16 October Reminder Types of Testing: Purpose  Functional testing  Usability testing  Conformance testing  Performance testing  Acceptance.
Systems Life Cycle. Know the elements of the system that are created Understand the need for thorough testing Be able to describe the different tests.
(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.
Today’s Agenda  Reminder: HW #1 Due next class  Quick Review  Input Space Partitioning Software Testing and Maintenance 1.
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.
Exam 1 Review u Scores Min 30 Max 96 Ave 63.9 Std Dev 14.5.
Intermediate 2 Computing Unit 2 - Software Development.
Test Case Designing UNIT - 2. Topics Test Requirement Analysis (example) Test Case Designing (sample discussion) Test Data Preparation (example) Test.
Testing and inspecting to ensure high quality An extreme and easily understood kind of failure is an outright crash. However, any violation of requirements.
Software Quality Assurance and Testing Fazal Rehman Shamil.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
Boundary Value Testing 1.A type of “Black box” functional testing –The program is viewed as a mathematical “function” –The program takes inputs and maps.
Announcements You will receive your scores back for Assignment 2 this week. You will have an opportunity to correct your code and resubmit it for partial.
Week 6 MondayTuesdayWednesdayThursdayFriday Testing III Reading due Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
Introduction to Exceptions in Java CS201, SW Development Methods.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 10 Using Menus and Validating Input.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
Dynamic Black-Box Testing Part 1 What is dynamic black-box testing? How to reduce the number of test cases using: Equivalence partitioning Boundary value.
CSE 332: C++ Exceptions Motivation for C++ Exceptions Void Number:: operator/= (const double denom) { if (denom == 0.0) { // what to do here? } m_value.
Data Types Variables are used in programs to store items of data e.g a name, a high score, an exam mark. The data stored in a variable is entered from.
The Joy of Breaking Code Testing Logic and Case Selection
Black Box Testing PPT Sources: Code Complete, 2nd Ed., Steve McConnell
Input Space Partition Testing CS 4501 / 6501 Software Testing
CS5123 Software Validation and Quality Assurance
Chapter 13 & 14 Software Testing Strategies and Techniques
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Testing and Test-Driven Development CSC 4700 Software Engineering
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
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes

2 Functional Testing: Motivation With structural testing, we can guarantee all code has been executed with tests But say we have missed, ignored or forgotten some requirements Those requirements may not have been implemented in code No code  nothing to cover! Therefore, we can get 100% coverage without actually satisfying the requirements We need to test based on the requirements (functionality) too This is functional testing We will need to also consider “unstated” requirements like error handling We would like to go systematically through all stated and unstated requirements There are standard ways of doing this

3 Functional Testing Example Simple “triangle analyzer” Requirements: Program prompts user for input User types in three real numbers separated by commas —E.g. 2.5, 6, 6.5 Numbers are supposed to be lengths of the sides of a triangle Program responds with: —Equilateral – if there is a valid triangle with those side lengths and that type —Isosceles – likewise —Scalene – likewise —Not a triangle – if there is no valid triangle with those side lengths (e.g. 3, 4, 1000) What test cases to use? These will be functional (black-box) test cases, since we are working only from the requirements

4 Triangle Program: Our Test Cases Think of some test cases you would use to test the Triangle Analyzer:

5 Functional Testing: Basic Methods How to choose good functional test cases? We will look at each of the following methods: Test all possible outputs Test both valid and invalid inputs Test around boundaries Test extreme values Test input syntax Guess at possible errors These techniques will generate lots and lots of test cases In general: A test case may be one input or a sequence of inputs (depending on program) We will probably have more test cases for erroneous input than correct input

6 Test All Possible Outputs For each possible kind of output that we know the program could produce: Write a test case that will produce that kind of output Called equivalence classes in our textbook (Chapter 10) Examples: Triangle program —One case for each of Equilateral, Isosceles, Scalene and Not a triangle Parking garage simulator: —Should have a case (or cases) for parking a car and retrieve a car —Should also have cases for “garage full”, “no such car” What do we mean by “the same kind” of output This is a judgment call We have to just make some reasonable choice We can start by choosing one test case producing each kind of output We may choose others producing the same kind of output later, for other reasons

7 Test Valid and Invalid Inputs Often, individual inputs x to a program have: Valid ranges; e.g. x >= 0, x is from 1 to 12 Valid sets of values; e.g. —X is a string of alphanumeric characters —X  {red, green, blue} Inputs outside these ranges or sets are invalid For each input to the program: Test at least one “valid” value Test at least one “invalid” value Test invalid values off either end of value range, if appropriate

8 Individual inputs to the program” can include: Things typed in to a text interface or GUI Command-line options Examples of invalid inputs: Triangle program:  Test –1 or Z as length of side Day planner program:  Enter Jqx as name of a month

9 Test Around Boundaries Failure often occur close to “boundaries”; e.g. Boundaries between different kinds of output Boundaries between valid and invalid inputs These failures are due to faults like Small errors in arithmetic Using <= instead of < Not initializing a loop properly Therefore, should test at or near boundaries

10 Examples: Triangle program: Test case: 2, 2, (almost but not a triangle) Test case: 2, 2, 4 (right on boundary) Pop machine program: What happens if user has just exactly enough money in account to buy one can of pop Should be allowed However, if the test in the program is something like if (balance > cost), it will not be allowed It should be: if (balance >= cost) Therefore, need to test this situation

11 Test Extreme Values Often, software does not handle “very large” or “very small” values correctly These failures are due to things like: —Buffer or arithmetic overflows —Mistaken assumptions that a string will be non-empty Therefore those values may be a way to break the program Examples With just about any program that takes user input: —Empty strings —Very long strings Triangle Program: —Test case: , , (very large) —Test case: , , (very small)

12 Test Input Syntax What happens if input syntax wrong? e.g. Something left out — 5,  comma missing Too few / too many repetitions — 5, 12 or 5, 12, 13, 20 Invalid tokens — 5, 12, axolot! In these situations Program shouldn’t just crash Shouldn’t give an uninformative error message Also, program shouldn’t just accept and process as if correct! —This could even be worst Should give an informative error message, recover from error

13 Guess at Faults Finally, use intuition to think of how program might be wrong Might be better to get person A to think of possible faults in person B’s code Example with the triangle program: To see whether triangle isosceles, the code must try all three distinct pairs amongst the three numbers for equality What if not all three pairs have been tried by this code? Therefore test all three of “2,2,3”, “2,3,2”, “3,2,2” This method not based on systematic study More like educated guesses

14 Building a Test Suite Tests from all the previous categories can be helpful Sometimes a given test case might be considered to be in several of these categories Once we think of a good test case, write it down! Recorded test suites can be re-run as software changes. Helps protect against one update breaking something else

Exercise Assume you are writing a driver to test the following function: public int maxOfThreeNumbers(int n1, int n2, int n3) Give some test cases you would put in your driver to thoroughly test it: 15 n1n2n3Expected Output Error, throws error perhaps?

16 Functional vs. Structural Testing Functional (black box) testing: Good Points: —Makes sure program meets requirements —Tests boundaries, etc. explicitly Bad Points: —Can’t test undocumented features —May not test hidden implementation details thoroughly Structural (white or clear-box) testing: Good Points: —Tests all code, tests implementation details —Has automated tool support (e.g. gcov) Bad Points: —But, can’t test whether all desired features are implemented Best to use a combination