CSE 331 SOFTWARE DESIGN & IMPLEMENTATION TESTING II Autumn 2011.

Slides:



Advertisements
Similar presentations
Introduction to Algorithms Quicksort
Advertisements

Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
Computer Science 2212a/b - UWO1 Structural Testing Motivation The gcov Tool An example using gcov How does gcov do it gcov subtleties Further structural.
1 CS101 Introduction to Computing Lecture 17 Algorithms II.
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.
Ch6: Software Verification. 1 White-box testing  Structural testing:  (In)adequacy criteria  Control flow coverage criteria.
Nov R McFadyen1 A Traditional Software Development Process Unit test Integration test System test Detailed design Architectural design Analysis.
Testing, cont. Based on material by Michael Ernst, University of Washington.
Ch6: Software Verification. 1 Statement coverage criterion  Informally:  Formally:  Difficult to minimize the number of test cases and still ensure.
CSE 830: Design and Theory of Algorithms
Software Testing and Quality Assurance
1 Software Testing and Quality Assurance Lecture 5 - Software Testing Techniques.
CSE 403 Lecture 13 Black/White-Box Testing Reading: Software Testing: Principles and Practices, Ch. 3-4 (Desikan, Ramesh) slides created by Marty Stepp.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Structural Coverage Verilog code is available to help generate tests o Code can be analyzed statically and/or simulated Easier to detect “additive” design.
White-box Testing Black-box Testing Extensions
Class Specification Implementation Graph By: Njume Njinimbam Chi-Chang Sun.
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.
Chapter 12: Software Testing Omar Meqdadi SE 273 Lecture 12 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
UNIT TESTING. Plan project Integrate & test system Analyze requirements Design Maintain Test units Implement Software Engineering Roadmap Identify corporate.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
CSC 480 Software Engineering Lecture 14 Oct 16, 2002.
Path Testing + Coverage Chapter 9 Assigned reading from Binder.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION MIDTERM REVIEW Autumn 2011.
Agenda Introduction Overview of White-box testing Basis path testing
Something to amuse you… CS UWO minutes.
CSE403 Software Engineering Autumn 2001 More Testing Gary Kimura Lecture #10 October 22, 2001.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
White-box Testing.
1 Graph Coverage (4). Reading Assignment P. Ammann and J. Offutt “Introduction to Software Testing” ◦ Section
CSE332: Data Abstractions Lecture 24.5: Interlude on Intractability Dan Grossman Spring 2012.
CS 206 Introduction to Computer Science II 02 / 13 / 2009 Instructor: Michael Eckmann.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
Software Testing and Quality Assurance Practical Considerations (4) 1.
1 Control Flow Analysis Topic today Representation and Analysis Paper (Sections 1, 2) For next class: Read Representation and Analysis Paper (Section 3)
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
Software Construction Lecture 19 Software Testing-2.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Testing Data Structures Tao Xie Visiting Professor, Peking University Associate Professor, North Carolina State University
Dynamic Testing.
Chapter 12: Software Testing Omar Meqdadi SE 273 Lecture 12 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION ABSTRACT DATA TYPES Autumn 2011.
Week 6 MondayTuesdayWednesdayThursdayFriday Testing III Reading due Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
White-Box Testing Statement coverage Branch coverage Path coverage
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
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 (final thoughts). equals() and hashCode() Important when using Hash-based containers class Duration { public final int min; public final int sec;
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
Week 5-6 MondayTuesdayWednesdayThursdayFriday Testing I No reading Group meetings MidtermNo Section Testing II Progress report due Readings out Testing.
CSE373: Data Structures & Algorithms
Software Testing.
Software Testing.
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Software Engineering (CSI 321)
Structural testing, Path Testing
Types of Testing Visit to more Learning Resources.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Symbolic Implementation of the Best Transformer
Testing, conclusion Based on material by Michael Ernst, University of Washington.
Software Testing (Lecture 11-a)
CSE403 Software Engineering Autumn 2000 More Testing
Whitebox Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
By: Lecturer Raoof Talal
Unit III – Chapter 3 Path Testing.
Presentation transcript:

CSE 331 SOFTWARE DESIGN & IMPLEMENTATION TESTING II Autumn 2011

A4 UW CSE331 Autumn 2011  Will be available later today  Is a totally new assignment – by no means carefully vetted  It’s focused (again) on testing and binary search  This may be boring for some of you  I hope that the expected learning is important enough to justify this  One of the next assignments (likely only one more, possibly two) will be a music player that accepts a textual notation for music and produces MIDI output 2

Midterms – Parts I and II graded UW CSE331 Autumn 2011  Plan (hope?) to have them ready by Wednesday  Key with comments is under production – released when the results are released 3

A4 basics  Random test generation question from midterm  The randomly generated array length might not be consistent with the number of values in the array  The randomly generated array might not be sorted  Random keys are much more likely to be not found than to be found  There's no way to determine the oracle  You’ll write a test generation program that overcomes these issues (and produces JUnit tests)  Generate length and then values for the test array  Produce the randomized in a way that guarantees it is sorted – use a binary search tree (BST) to first insert the random elements and then retrieve them in sorted order  Randomly decide to generate (for instance) 10% found keys – and then find a key in the array or find a key not in the array  Voilà, an oracle appears (almost that easily) UW CSE331 Autumn

A4 objectives include UW CSE331 Autumn 2011  Deeper understanding of testing  Representation invariant needed for BST  Some focus on abstraction function  Related to visitor pattern for traversing BST to create sorted array  Clean mind  Separate tests you generate from tests you need to test your program  Separate binary search (program under test) from binary search tree (implementation mechanism for your program)  … 5

White (glass, clear)-box testing  Goals  Ensure test suite covers (executes) all of the program  Measure quality of test suite with % coverage  Assumption  High coverage  few mistakes in the program “If statement S hasn’t been executed (covered) by any test, it might cause an error”  Focus on coverage, not oracles  Fundamentally an inadequacy property of test suites  Focus: features not described by specification  Control-flow details  Performance optimizations  Alternate algorithms for different cases UW CSE331 Autumn

White-box Motivation  There are some subdomains that black-box testing won't find boolean[] primeTable = new boolean[CACHE_SIZE]; boolean isPrime(int x) { if (x>CACHE_SIZE) { for (int i=2; i<x/2; i++) { if (x%i==0) return false; } return true; } else { return primeTable[x]; }  Important transition around x = CACHE_SIZE that isn’t visible to black-box testing (assuming CACHE_SIZE is private ) UW CSE331 Autumn

White Box Testing: Advantages  Finds an important class of boundaries – yields useful test cases  Need to check numbers on each side of CACHE_SIZE CACHE_SIZE-1, CACHE_SIZE, CACHE_SIZE+1  If CACHE_SIZE is mutable, we may need to test with different CACHE_SIZE s  Disadvantages?  Tests may have same bugs as implementation UW CSE331 Autumn

Statement coverage  Test suite { min(2,3) }  Good: executes every instruction  Bad: doesn’t find bug  So, can be unsatisfying in trivial cases static int min (int a, int b) { int m = a; if (a <= b) { m = a; } return m; } UW CSE331 Autumn

Think of the program as a flow-chart UW CSE331 Autumn static int min (int a, int b) { int m = a; if (a <= b) { m = a; } return m; } m = a a <= b? m = a true return m false What is missed by { min(2,3) }?

Edge coverage  Covering all statements would not require edge ac to be covered  Edge coverage requires all control flow graph edges to be coverage by at least one test a b c d e f UW CSE331 Autumn 2011

Edge coverage UW CSE331 Autumn m = a a <= b? m = a true return m false { min(2,3), min(3,2) } Doesn’t increase statement coverage – still 100% But does increase edge coverage from 75% to 100%

Is edge coverage enough?  Consider this program and test suite (not exactly Java, but you can follow it)  Make it into a flow- chart… mark executed edges UW CSE331 Autumn if x != 0 y = 5; else z = z - x; if z > 1 z = z / x; else z = 0; {(x = 0, z = 1) (x = 1, z = 3)}

Edge coverage: 100% UW CSE331 Autumn if x != 0 y = 5; else z = z - x; if z > 1 z = z / x; else z = 0; x != 0? y = 5 truefalse z = z-x z > 1? z = z/x truefalse z = 0 {(x = 0, z = 1) (x = 1, z = 3)} What is missed?

15 Path coverage  Edge coverage is in some sense very static  Edges can be covered without covering actual paths (sequences of edges) that the program may execute  Not all paths in a program are always executable  Loops complicate paths UW CSE331 Autumn 2011

Varieties of coverage UW CSE331 Autumn  Covering all of the program  Statement coverage  Edge (branch) coverage  Decision coverage (not discussed) Handling compound decisions  Loop coverage (not discussed)  Condition/Decision coverage (not discussed)  Path coverage  Limitations of coverage  100% coverage is not always a reasonable target  High cost to approach the limit  Coverage is just a heuristic: we really want the revealing subdomains increasing number of test cases (more or less)

Structural coverage: some challenges UW CSE331 Autumn  Interprocedural coverage  Late binding in OO – coverage of polymorphism  Need good tools for tracking coverage  Higher coverage may be deceptive  There are a family of new, automatic test generation techniques that seem to be influencing coverage-based testing

Next steps UW CSE331 Autumn 2011  Assignment 4: out later today, due Wednesday November 9, 2011 at 11:59PM  Lectures: TBA 18