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.

Slides:



Advertisements
Similar presentations
Object Oriented Analysis And Design-IT0207 iiI Semester
Advertisements

Verification and Validation
Testing and Quality Assurance
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.
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.
Test-Driven Development and Refactoring CPSC 315 – Programming Studio.
Week 5: Loops 1.  Repetition is the ability to do something over and over again  With repetition in the mix, we can solve practically any problem that.
Developer Testing and Debugging. Resources Code Complete by Steve McConnell Code Complete by Steve McConnell Safari Books Online Safari Books Online Google.
Unit Testing CSSE 376, Software Quality Assurance Rose-Hulman Institute of Technology March 27, 2007.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Debugging Introduction to Computing Science and Programming I.
Testing CPSC 315 – Programming Studio Fall Testing Testing helps find that errors exist Debugging finds and fixes them Systematic attempt to break.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts and Debugging.
Debugging CPSC 315 – Programming Studio Fall 2008.
Testing HCI Usability Testing. Chronological order of testing Individual program units are built and tested (white-box testing / unit testing) Units are.
Testing an individual module
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts, Testing and Debugging.
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.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Verification and Validation.
Programming Translators.
CMSC 345 Fall 2000 Unit Testing. The testing process.
CS4311 Spring 2011 Unit Testing Dr. Guoqiang Hu Department of Computer Science UTEP.
Nachos Phase 1 Code -Hints and Comments
General Programming Introduction to Computing Science and Programming I.
Coverage – “Systematic” Testing Chapter 20. Dividing the input space for failure search Testing requires selecting inputs to try on the program, but how.
Testing, Bug Fixing and Debugging the Code Yordan Dimitrov Telerik Corporation
Program Development Life Cycle (PDLC)
Software Testing The process of operating a system or component under specified conditions, observing and recording the results, and making an evaluation.
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?
October, 2006 © Copyright 2006, Larry A. Beaty. Copying and distribution of this document is permitted in any medium, provided this notice is preserved.
Testing 99 PART 2: Getting Going (chapter 10) Gradual adoption Current practice is changed little in each step. First step: use coverage. If coverage is.
Debugging Chapter 23. Outline  Overview of Debugging  Finding a Defect  Fixing a Defect  Psychological Considerations in Debugging  Debugging Tools—Obvious.
Testing, Bug Fixing and Debugging the Code Yordan Dimitrov Telerik Corporation
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
CS 350, slide set 5 M. Overstreet Old Dominion University Spring 2005.
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
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.
Black Box Testing Techniques Chapter 7. Black Box Testing Techniques Prepared by: Kris C. Calpotura, CoE, MSME, MIT  Introduction Introduction  Equivalence.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
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.
1 CS161 Introduction to Computer Science Topic #9.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Testing CSE 160 University of Washington 1. Testing Programming to analyze data is powerful It’s useless (or worse!) if the results are not correct Correctness.
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
Software Quality Assurance and Testing Fazal Rehman Shamil.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
Dynamic Testing.
Efficiently Solving Computer Programming Problems Doncho Minkov Telerik Corporation Technical Trainer.
1 CSE1301 Computer Programming: Lecture 16 Flow Diagrams and Debugging.
CSC 395 – Software Engineering Lecture 27: White-Box Testing.
Software Design and Development Development Methodoligies Computing Science.
Chapter 22 Developer Testing
Software Engineering (CSI 321)
Some Simple Definitions for Testing
Testing UW CSE 160 Spring 2018.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
John D. McGregor Session 9 Testing Vocabulary
CSCE 315 – Programming Studio, Fall 2017 Tanzir Ahmed
The Scientific Method.
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
CPSC 315 – Programming Studio
Java & Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

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 development activities.  The goal in testing a software is to break it.  It can never completely prove the absence of errors.  Testing alone does not improve the software’s quality.  Fix it after you test it.  You are required to assume that you’ll find errors in your code.  If you assume you won’t, then that is more than likely so. Even when there are errors.

Testing During Construction  “White/glass – box” testing  Can look into the class while testing  “Black – Box” testing  See no further than the interface while testing  Easier to debug if you test a routine or class one at a time vs. several at once.

Recommended approach, cover this ground:  Test each relevant requirement to make sure that the requirements have been implemented.  Test each relevant design concern to make sure that the design has been implemented.  “Basis testing” adds detailed test cases to those that the test requirements and the design.  Make a checklist for past errors.

Test First or Last?  Writing test cases before code does not take any more effort than after.  If first, you can detect defects earlier and you can correct them more easily.  Writing cases first forces you to think a little bit about the requirements and design.  It exposes requirement problems sooner before code is written.

Limitations  Developer tests tend to be “clean” tests.  Tries to how it works rather than how it breaks.  Tends to have an optimistic view of test coverage.  Most programmers assume they’ve covered more than they actually did,  Tends to skip more sophisticated kinds of test coverage.

Incomplete Testing  Pick test cases that are most likely to find errors.  Concentrate on picking a few that tell you different things instead of a set that says the same thing again and again.

Structured Basis Covering  Start with 1 test case for the routine itself.  Add 1 test case for every logic statement (if, while, for, and and or)

Data-Flow Testing  Defined – The data has been initialized, but not used yet.  Used – Data that’s been used for computation.  Killed – Once defined data that has now been undefined.  Entered – Control flow enters routine immediately before the variable is acted upon.  Exited – The control flow leaves the routine immediately after the variable acted upon.

Equivalence Partitioning  If two test cases bring out exactly the same errors, you need only one of them.  Helps when you are not looking at it from source code.

Error Guessing  Heuristic approach  Sophisticated guessing.

Boundary analysis & Compound Boundaries  Test cases that exercise the maximum and minimum of allowable values.

Classes of Bad Data  Too little data (or no data)  Too much data  Invalid data  Wrong size of data  Uninitialized data

Classes of Good Data  Nominal cases – middle-of-the-road, expected values  Min and Max normal configurations  Compatibility with old data

Test Cases that make Hand checks convenient  Using numbers in values that are easy to calculate by hand for testing.

Which classes contain most errors  80%of the errors are found in 20% of a project’s classes or routines.  50% of the errors are found in 5% of a project’s classes.

Errors by Classification  Scope of most errors is fairly limited  Many errors are outside the domain of construction  Thin application domain knowledge, conflicting requirements, bad communication  Most construction errors are the programmer’s fault  95% programmer, 2% system software, 2% other software, 1% hardware  Typos are surprisingly common source problems  Misunderstanding the design is a recurring theme in studies of programmers errors  Most are easy to fix  It’s a good idea to measure your own organization’s experience with errors.

Proportion from Faulty Construction  On small projects, construction defects make up the vast bulk of all errors.  Construction defects account for at least 35% of all projects regardless of size.  Although cheaper to fix than requirements and design errors, construction errors are still expensive.

Errors in Testing Itself  Check your work  Plan test cases as you develop your software  Keep your test cases  Plug unit tests into a test framework

Chapter 23 Debugging

The scientific Method of Debugging 1.Stabilize the error  Unpredictable errors are often initialization errors  Requires narrowing a test case that produces the error. 2.Locate the source of error  Gather data that produces defect  Analyze the data that has been gathered, and form a hypothesis about the defect  Determine how to prove/disprove the hypothesis, by testing or examining the code and do so. 3.Fix defect 4.Test fix 5.Look for similar errors

Tips for finding defects  Use all the data available to make hypothesis  Refine the test case that produce the error  Exercise the code in your unit test suite  Test code in isolation  Use available tools  Reproduce the error several different ways

Tips (part 2)  Generate more data to generate more hypotheses  Use results of negative tests  Brainstorm for possible hypotheses  Make list of things to try  Narrow the suspicious region of the code

Tips (part 3)  Be suspicious of classes and routines that have had defects before  Check code that’s changed recently  Expand the suspicious region of the code  Integrate incrementally  Check for common defects  Talk to someone else about the problem  Take a break from the problem

Syntax Errors  Don’t trust line numbers in compiler messages  Compiler may place error on the line before or after the actual error.  Don’t trust compiler messages  May need to read between the lines to understand  Don’t trust compiler’s second message  Errors following the first may no mean anything  Divide and conquer  Temporarily remove part of code and compile again.  Find misplaced comments and quotation marks

Fixing defects  Understand the problem before you fix it  Understand the program, not just the problem  Confirm the defect diagnosis  Relax  Save original source code  Fix the problem, not the symptom  Change code only for good reasons; be certain that it will work  One change at a time

….. Okay, I’m done.