Testing Slides adopted from John Jannotti, Brown University

Slides:



Advertisements
Similar presentations
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
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.
1 Software Engineering Lecture 11 Software Testing.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
WISTPC-09 : Session A Tariq M. King PhD Candidate Florida International University Workshop on Integrating Software Testing into Programming.
Introduction to Eclipse, Unit Testing and JUnit David Rabinowitz.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Chapter 13 & 14 Software Testing Strategies and 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.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Software Testing CS 121 “Ordering Chaos” “Mike” Michael A. Erlinger
CMSC 345 Fall 2000 Unit Testing. The testing process.
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.
Path Testing + Coverage Chapter 9 Assigned reading from Binder.
1 Principles of Computer Science I Prof. Nadeem Abdul Hamid CSC 120 – Fall 2005 Lecture Unit 10 - Testing.
07 Coding Conventions. 2 Demonstrate Developing Local Variables Describe Separating Public and Private Members during Declaration Explore Using System.exit.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
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.
CSE403 Software Engineering Autumn 2001 More Testing Gary Kimura Lecture #10 October 22, 2001.
Chapter 22 Developer testing Peter J. Lane. Testing can be difficult for developers to follow  Testing’s goal runs counter to the goals of the other.
16 October Reminder Types of Testing: Purpose  Functional testing  Usability testing  Conformance testing  Performance testing  Acceptance.
Software Construction Lecture 18 Software Testing.
TEST-1 6. Testing & Refactoring. TEST-2 How we create classes? We think about what a class must do We focus on its implementation We write fields We write.
Week 14 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
CPSC 873 John D. McGregor Session 9 Testing Vocabulary.
Intoduction to Unit Testing Using JUnit to structure Unit Testing SE-2030 Dr. Mark L. Hornick 1.
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
Testing Data Structures Tao Xie Visiting Professor, Peking University Associate Professor, North Carolina State University
An array example: the transpose A 2-D array corresponds to a mathematical matrix: One simple matrix operation transposes the matrix.
Week 6 MondayTuesdayWednesdayThursdayFriday Testing III Reading due Group meetings Testing IVSection ZFR due ZFR demos Progress report due Readings out.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Test Plans Test Driven Development – Unit test plan first Code coverage Automated Regression built as you go Debug is easier Serves as system doc – Still.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
Software Testing. Software Quality Assurance Overarching term Time consuming (40% to 90% of dev effort) Includes –Verification: Building the product right,
Testing Data Structures
Functional testing, Equivalence class testing
Software Testing CS II: Data Structures & Abstraction
Black/White-Box Testing Reading:
Software Testing.
Software Testing.
John D. McGregor Session 9 Testing Vocabulary
The Joy of Breaking Code Testing Logic and Case Selection
Black Box Testing PPT Sources: Code Complete, 2nd Ed., Steve McConnell
CompSci 230 Software Construction
Development and Testing Ch4.1. Algorithm Analysis
Testing & Testing Tools
Chapter 13 & 14 Software Testing Strategies and Techniques
John D. McGregor Session 9 Testing Vocabulary
Testing Approaches.
Data Structures and Algorithms
Testing UW CSE 160 Spring 2018.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
John D. McGregor Session 9 Testing Vocabulary
CSC 143 Error Handling Kinds of errors: invalid input vs programming bugs How to handle: Bugs: use assert to trap during testing Bad data: should never.
CS240: Advanced Programming Concepts
CSE 403 Lecture 13 Black/White-Box Testing Reading:
CSE 303 Concepts and Tools for Software Development
Automation of Testing in the Distributed Common Ground System (Army)
Automation of Testing in the Distributed Common Ground System (Army)
CSE403 Software Engineering Autumn 2000 More Testing
Java & Testing.
CSE 1020:Software Development
Exceptions 10-May-19.
Think about your view of QA
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing.
Software Testing.
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

Testing Slides adopted from John Jannotti, Brown University /course/cs0320/www/lectures/

But first… Project review Midterm review

Four ways to write tests When do you write tests? Before you write the implementation. After you write the implementation. What is the “scale" of test? Are you testing a single class/method? Are you testing how modules interact? Are you testing the entire system? What do you consider when you write tests? The specification only. Implementation details. When are you done writing tests? When you call each method? When you execute each line? Take each branch? Each path? Never?

Testing principles Write Tests Before (Test Driven Design) Forces you to think like the caller. Forces you to develop a “testable" interfaces. Satisfaction as tests start passing. But write the spec first! and Write Tests After Based on your knowledge of implementation. Can you get someone else to write some? Every time you find a bug, write a test. A good regression test suite.

Enjoy being devious Consider “surprising" input. Empty collections, nulls, 0, negatives, MAX VALUE, MIN VALUE. Empty strings, “international" characters, “weird" characters. Quoting can be really  tricky, yet critical for security. Avoid doing it “yourself." Use well-tested library routines. Duplicate arguments. What does list.addAll(list) do? Remember to think of the object's state as an argument. Missing les, empty les, BIG les (2GB & 4GB can be important) Consider integer overflow and floating point (im)precision.

Black box testing Black box tests adherence to a spec. assertEquals(Math.min(2,3), 2); Sort a list, then iterate through and test all neighbors. Compress and the decompress a .gif, compare. (use other implementations of each as well) These kind of tests could be written by a QA team. On the one hand, nice to have a different brain write tests. On the other, that can be a slow process, filled with finger-pointing.

Glass/White/Clear box testing Whitebox testing considers the implementation (but still tests the spec). Considering explicit boundary conditions of the code. Choosing a median value? Try odd and even sized arrays. Selecting a min/max internally? Try a >  b, b <  a, ties. Alternate implementations based on size? Transitions? Growing your hash table at known size intervals? Take care that you are testing the specification. If the spec doesn't guarantee a stable sort, don't test that! Messing up here is what makes some people think unit tests are too much work. “I have to change my tests every time I do anything!"

Partition the input domain Consider testing BigInteger.multiply() Exhaustive testing isn't going to happen. How should you choose your tests? Black box thinking. 0, 1, -1, positive, negative Glass box thinking. Small integers and large are different. Always consider “boundaries" (which would also lead to including 0, - 1, 1) Each input can be selected from these seven partitions.

Coverage You are usually looking for high “coverage" | a metric for how well your tests exercise your code. Consider each branch Construct input to exercise code Code coverage tools can help EclEmma for Eclipse Statements vs Branches vs Paths

Unit, System, Integration testing Unit test should be self-contained Integration tests a few components System tests are “end-to-end" Scale of the test Unit test should be self-contained I  Are you separating CSV lines into tokens properly? I  Can your KdTree nd members properly? I  Does your command loop process input properly? I  At this level, avoid testing multiple modules. This can be tricky. Integration tests a few components I  Is a star le being put into KDTree properly? I  You can still use the JUnit framework for these. System tests are \end-to-end" I  Does a star le plus query yield the proper output? I  We're giving you a start with our system test framework.

Unit Testing JUnit is a defacto standard in Java world Similar libraries for other languages. Helpful framework for testing You write small testSomething() methods JUnit runs them, compiles a report Test should be small and self-contained. When tests fail, you should be able to pinpoint blame. Avoid cross-module calls. “Leave no trace" (try. . . finally, setUp(), tearDown()) How can you avoid infrastructure classes? How can you get good coverage of error handling? It's great for them to run at compile time.