CS48715-1/51 Illinois Institute of Technology CS487 Software Engineering Software Testing Techniques Mr. David A. Lash.

Slides:



Advertisements
Similar presentations
Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Advertisements

Black Box Testing Csci 565 Spring 2009.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
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.
1 Software Engineering Lecture 11 Software Testing.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Software Testing and Quality Assurance
Illinois Institute of Technology
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
Testing an individual module
Chapter 18 Testing Conventional Applications
1 Software Testing and Quality Assurance Lecture 5 - Software Testing Techniques.
Unit Testing CS 414 – Software Engineering I Don Bagert Rose-Hulman Institute of Technology January 16, 2003.
Software Engineering Lecture 12 Software Testing Techniques 1.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
Chapter 13 & 14 Software Testing Strategies and Techniques
Test Design Techniques
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Verificarea şi Validarea Sistemelor Soft Tem ă Laborator 2 Testare Black Box Dat ă primire laborator: Lab 2 Dat ă predare laborator: Lab 2,3.
Software Systems Verification and Validation Laboratory Assignment 3
System/Software Testing
Introduction Telerik Software Academy Software Quality Assurance.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Testing phases. Test data Inputs which have been devised to test the system Test cases Inputs to test the system and the predicted outputs from these.
Prof. Mohamed Batouche Software Testing.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
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.
1 Testing Course notes for CEN Outline  Introduction:  terminology and philosophy  Factors that influence testing  Testing techniques.
Overview of Software Testing 07/12/2013 WISTPC 2013 Peter Clarke.
Lecture 11 Testing and Debugging SFDV Principles of Information Systems.
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.
Software Reviews & testing Software Reviews & testing An Overview.
Software Testing Testing types Testing strategy Testing principles.
Software Testing The process of operating a system or component under specified conditions, observing and recording the results, and making an evaluation.
Agenda Introduction Overview of White-box testing Basis path testing
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.
Test Coverage CS-300 Fall 2005 Supreeth Venkataraman.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
1 Chapter : Testing Tactics. 2 Testing Fundamental Software engineer attempts to build software from an abstract concept to a tangible product. Next is.
Black-box Testing.
INTRUDUCTION TO SOFTWARE TESTING TECHNIQUES BY PRADEEP I.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Theory and Practice of Software 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.
1. Black Box Testing  Black box testing is also called functional testing  Black box testing ignores the internal mechanism of a system or component.
Dynamic Testing.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Software Testing. SE, Testing, Hans van Vliet, © Nasty question  Suppose you are being asked to lead the team to test the software that controls.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
Testing Integral part of the software development process.
Functional testing, Equivalence class testing
PREPARED BY G.VIJAYA KUMAR ASST.PROFESSOR
Software Testing.
Software Testing.
Software Engineering (CSI 321)
Chapter 13 & 14 Software Testing Strategies and Techniques
Structural testing, Path Testing
Types of Testing Visit to more Learning Resources.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing (Lecture 11-a)
Chapter 14 Software Testing Techniques
Chapter 10 – Software Testing
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Software Testing “If you can’t test it, you can’t design it”
UNIT-4 BLACKBOX AND WHITEBOX TESTING
By: Lecturer Raoof Talal
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

CS /51 Illinois Institute of Technology CS487 Software Engineering Software Testing Techniques Mr. David A. Lash

CS /51 Why Test? u Testing is the filter to catch bugs before the are “discovered” by customer – Every time the program is run by a customer, it generates a “test-case”. u Software development is a human activity with huge potential for errors u Testing before release helps assure quality and save money

CS /51 Testing Steps u Start at testing each individual new component and work way out – Unit test – Integration test – High Order Test – Customer Acceptance testing u Different testing techniques are used at different times in the process u A test specification is often used as a testing road-map that is generally reviewed by a team.

CS /51 u Purpose of testing is... – To find errors u A good test... – Trys to discover undetected errors – Is successful when errors are found u To design good test cases must understand the system and the software development process. u Zero Defects is not possible. – Always a condition or usage that can lead to an incorrect behavior. – Done testing when continued testing is no longer economical. Testing Objectives

CS /51 Tester VS Developer It is critical that developers and testers work together as a team

CS /51 Software Quality Assurance Modes u Verification – “Are we building the product right?” – Does product meet requirements during this particular phase – Can and should be done as part of implementation. u Validation – “Are we building the right product?” – Evaluating software at end of software development process VS requirements – 3rd party is generally most effective validators (developer ego can interfere with judgment). u Formal Reviews u Quality and Configuration audits

CS /51 Testing Goals u Show that the program is correct. – Zero Defect Software is not possible. u There is always some condition that you are not aware of that can cause a incorrect behavior. – Microsoft does test. u Their testing covers “main-line” systems. u There are several million possible hardware configurations. u It is the integrators responsibility to ensure that the system works with Microsoft Software.

CS /51 Testing Goals - Reality u To Have “confidence” in the software system. u To Find all major defects – You must first define major. – Defect scale u To find all major defects with given resources – Number of testers – Amount of time. u Design a set of test cases that have a high probability of finding defects.

CS /51 Testing Case Design u Test cases should be designed to have the highest likelihood of finding problems u Can test by either – Black-box or using the specifications of what the software should do u Tests are derived from the I/O specification. u Used in most functional tests. u A.K.A. data-driven, input/output-driven. – White-Box - testing internal paths and working of the software u Examine internal program structure and derive tests from an examination of the program’s logic. u Used to develop test cases for unit and integration testing u A.K.A. Glass-box, Logic-driven, Structural.

CS /51 White-Box Strategies u Statement – Requires each statement of the program to be executed at least once. u Branch – Requires each branch to be traversed at least once. u Multi-condition – Requires each condition in a branch be evaluated.

CS /51 White-Box Strategies u Basis Path – Execute all control flow paths through the code. Based on Graph Theory. u Thomas McCabe’s Cycolmatic Complexity: u V(g) : #edges - #nodes + 2 u Data Flow – Selects test data based on the locations of definition and the use of variables. u And a number of others

CS /51 Statement Coverage u The criterion is to require every statement in the program to be executed at least once u Weakest of the white-box tests. u Specified by the F.D.A. as the minimum level of testing.

CS /51 Statement Coverage u Example: voidexample(int a, int b, float *x) { 1if ((a>1) && (b==0)) 2x /= a; 3if ((a==2) || (x > 1) 4x++; } u Test case(s) 1.a=2, b=0, x=3

CS /51 Statement Coverage u Test Case a=2, b=0 & x=3 u Coverage – acbed u What happens with data that takes: – abed – abd

CS /51 Branch Coverage u This criterion states that one must write enough test cases such that each decision has a true and false outcome at least once. u A.K.A. Decision coverage u More comprehensive than statement coverage.

CS /51 Branch Coverage u Example: voidexample(int a, int b, float *x) { 1if ((a>1) && (b==0)) 2x /= a; 3if ((a==2) || (x > 1) 4x++; } u Test case(s) 1.a=2, b=0, x=3 2.a=3, b=1, x=1

CS /51 Branch Coverage u Test Case 1. a=2, b=0 & x=3 2. a=3, b=1 & x=1 u Coverage 1. ace 2. abd u What happens with data that takes: – abe, or – acd

CS /51 Multiple-condition Coverage u This criterion requires one to write sufficient test cases such that all possible combinations of condition outcomes in each decision, and all points of entry are invoked at least once. u More comprehensive than branch coverage u First step is to identify the test conditions – ifs, whiles, for – reduce to simple predicates

CS /51 Multiple-condition Coverage u Example: voidexample(int a, int b, float *x) { 1if ((a>1) && (b==0)) 2x /= a; 3if ((a==2) || (x > 1) 4x++; } u Test Conditions a>1, b=0; a>1, b!=0; a<=1, b=0; a<=1, b!=0; a==2, x > 1; a!=2, x>1; a==2, x<=1; a!=2, x<=1.

CS /51 Multiple-condition Coverage u Test Conditions 1. a>1, b=05. a=2, x >1 2. a>1, b!=06. a=2, x 1 4. a<=1,b!=08. a!=2, x<=1 u Test Cases 1. a=2, b=0 & x=4 (1,5) 2. a=2, b=1 & x=1 (2,6) 3. a=1, b=0 & x=2 (3,7) 4. a=1, b=1 & x=1 (4,8) u Coverage – all

CS /51 Basis Path u Execute all independent flow paths through the code. Based on a flow graph. – An independent flow path is on that introduces at least 1 new set of statements or conditions – Must move along at least 1 new edge on flow graph – Flow graph shows the logical control flow using following notation: Sequence If while until

CS /51 Control Flow Example

CS /51 Corresponding Flow Graph

CS /51 Number of Independent Paths

CS /51 Another Example

CS /51 Corresponding Flow Graph

CS /51 Corresponding Flow Graph

CS /51 Number of Paths V(g) = E - N = 6 R = 6

CS /51 Black-Box Testing u Focuses on functional requirements of the software without regard to the internal structure. u A.K.A. data-driven, input/output-driven or behavior testing u Used in most system level testing – Functional, – Performance, etc. u Tests set up to exercise full functional requirements of system

CS /51 Black Box Testing Find Errors in... u Incorrect or missing functions (compare to white box) u Interface errors u Errors in External Data structures u Behavior performance problems (Combinations of input make it behave poorly). u Initialization and Termination errors (Sensitive to certain inputs (e.g., performance) u Blackbox done much later in process than white box.

CS /51 Black-box Strategies u Exhaustive input testing – A test strategy that uses every possible input condition as a test case. – Ideal u Random – Test cases are created from a pseudo random generator. – Broad spectrum. Not focused. – Hard to determine the result of the test.

CS /51 Black-box Strategies u Equivalence Partitioning – A black-box testing method that divides the input domain of a program into classes of data which test cases can be derived. u Boundary Value Analysis – A test case design technique that complements equivalence partitioning, by selecting test cases at the “edges” of the class. u And others.

CS /51 Equivalence Partitioning u Divides the input domain of a program into classes of data which test cases can be derived. – 1 test case uncovers classes of errors u Helps reduce the number of inputs u What are the properties of a well-selected test cases: – It reduces, by more than one, the number of test case that must be developed. – It covers a large set of other possible test cases.

CS /51 Identifying Equivalence Classes u Take each input condition (a sentence or phrase in the specification) partition or divide it into 2 or more classes. u Class – Valid equivalence classes – Invalid equivalence classes

CS /51 Rules for Equivalence Classes u Range - If an input condition specifies a range (i.e. n is an integer from 1 to 1000). – 1 valid(1< n < 1000) – 2 invalid(n 1000) u Specified Value - A black-box testing method that If an input condition specifies a specific value ( i.e. 6 character string) identify: – 1 valid(6 character string) – 2 invalid(5 character string, 7 char string)

CS /51 Rules for Equivalence Classes u Value Set - If the input specifies a set of valid values, define: – 1 valid condition within the set. – 1 invalid condition outside the set.

CS /51 Rules for Equivalence Classes u Boolean - If an input condition specifies a “must be” situation (e.g. “first character alpha”) then identify: – 1 valid (first character alpha). – 1 invalid (first character not alpha). u If there is any reason to believe that elements in an equivalence class are not handled in an identical manner by the program, split the equivalence class into smaller equivalence classes.

CS /51 Equivalence Partition Example

CS /51 Equivalence Partition Example

CS /51 Boundary Value Analysis u Experience shows that test cases exploring boundary conditions have a high payoff. – E.g., Most program errors occur in loop control. u Different from equivalence partitioning: – Rather than any element in class, BVA selects tests at edge of the class. – In addition to input condition, test cases can be derived for output conditions. u But similar to Equivalence partitioning...

CS /51 Guideline for Boundary-Value Analysis u If an input condition specifies a range of values, write test cases for the ends of the range, and invalid-input test cases for situations just beyond the ends. – If a domain of an input is -1.0 to 1.0 write test cases for the situation to – Or in general, if bounded by a and b write test cases just above and below

CS /51 Guideline for Boundary-Value Analysis u If an input condition specifies a number of values, write test cases for the minimum and maximum number of values and one beneath and beyond these values. – For example an input file can contain records, write test cases for 0, 1, 255 and 256

CS /51 Guideline for Boundary-Value Analysis u Apply the preceding rules to the output. – For example, if output is a output report, then create an output report with maximum and minimum allowable table entries. u Apply rules to internal data structures... – If use an array that has elements max then set up test cases for 0, 1, 100, 101 elements. u Look for other applications for BVA

CS /51 Test Case Grid

CS /51 Test Case Grid u Equivalence Class case and Boundary-Value analysis cases can be shown on the same table. – Separate sections for Equivalence Class cases and Boundary-Value analysis. – Equivalence Class cases first

CS /51 Test Case Documentation u Minimum information for a test case – Identifier – Input data – Expected output data u Recommended to add the condition being tested (hypothesis). u Format of test case document changes depending on what is being tested. u Always include design worksheets.

CS /51 Simple Test Case Format

CS /51 Test Case Formats u Testing worksheet – Test Case u Identifier (serial number) u Condition (narrative or predicate) u Input (Stimuli data or action) u Expected Output (Results) – Test Results u Actual Output (Results) u Status (Pass/Fail)

CS /51 PSP Test Case Format

CS /51 ANSI/IEEE Test Case Outline u Test-case-specification Identifier – A unique identifier u Test Items – Identify and briefly describe the items and features to be exercised by this case u Input Specifications – Specify each input required to execute the test case. u Output Specifications – Specify all of the outputs and features required of the test items.

CS /51 ANSI/IEEE Test Case Outline u Environmental needs – Hardware – Software – Other u Special procedural requirements – Describe any special constraints on the test procedures which execute this test case. u Interfaces dependencies – List the id’s of test cases which must be executed prior to this test case