Testing, Bug Fixing and Debugging the Code Yordan Dimitrov Telerik Corporation www.telerik.com.

Slides:



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

Software Testing. Quality is Hard to Pin Down Concise, clear definition is elusive Not easily quantifiable Many things to many people You'll know it when.
Testing and Quality Assurance
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.
White Box Testing Sources: Code Complete, 2 nd Ed., Steve McConnell Software Engineering, 5 th Ed., Roger Pressman.
Developer Testing and Debugging. Resources Code Complete by Steve McConnell Code Complete by Steve McConnell Safari Books Online Safari Books Online Google.
Chapter 3.5 Debugging Games
Unit Testing CSSE 376, Software Quality Assurance Rose-Hulman Institute of Technology March 27, 2007.
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.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
1 Testing. 2 About Testing  The reason the program is in testing is that it probably doesn’t work!  We test to find bugs before our users and hope that.
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.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
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.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
Software Systems Verification and Validation Laboratory Assignment 3
TESTING.
Debugging Building Rock-Solid Software Software University Technical Trainers SoftUni Team.
Introduction Telerik Software Academy Software Quality Assurance.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Software Engineering Chapter 23 Software Testing Ku-Yaw Chang Assistant Professor Department of Computer Science and Information.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
Chapter 8 – Software Testing Lecture 1 1Chapter 8 Software testing The bearing of a child takes nine months, no matter how many women are assigned. Many.
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.
Debugging Chapter 23. Outline  Overview of Debugging  Finding a Defect  Fixing a Defect  Psychological Considerations in Debugging  Debugging Tools—Obvious.
1 Chapter 22 Developer Testing. 2 introduction Testing is the most popular quality-improvement activity Testing is the most popular quality-improvement.
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.
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.
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.
Unit Testing 101 Black Box v. White Box. Definition of V&V Verification - is the product correct Validation - is it the correct product.
Software Testing Yonsei University 2 nd Semester, 2014 Woo-Cheol Kim.
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.
White-box Testing.
Week 9 Data structures / collections. Vladimir Misic Week 9 Monday, 4:20:52 PM2 Data structures (informally:) By size: –Static (e.g. arrays)
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.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
Theory and Practice of Software Testing
Dynamic Testing.
Controlling Program Flow with Decision Structures.
1 CSE1301 Computer Programming: Lecture 16 Flow Diagrams and Debugging.
Software Testing Testing is the process of exercising a program with the specific intent of finding errors prior to delivery to the end user.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
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.
Chapter 22 Developer Testing
Testing and Debugging PPT By :Dr. R. Mall.
Software Engineering (CSI 321)
Some Simple Definitions for Testing
Chapter 18 Software Testing Strategies
UNIT-4 BLACKBOX AND WHITEBOX TESTING
CSCE 315 – Programming Studio, Fall 2017 Tanzir Ahmed
CS240: Advanced Programming Concepts
IMPORTANT NOTICE TO STUDENTS:
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.
Improving Your Testing
CS 240 – Advanced Programming Concepts
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

Testing, Bug Fixing and Debugging the Code Yordan Dimitrov Telerik Corporation

Testing is a means of detecting errors. 2

 Unit testing  Component testing  Integration testing  Regression testing  System testing 3

 beta tests  customer-acceptance tests  performance tests  configuration tests  platform tests  stress tests  usability tests 4

 Black-box testing  White-box (or glass-box) testing. 5

 Individual testing steps (unit test, component test, and integration test) typically find less than 50 percent of the errors present each.  The combination of testing steps often finds less than 60 percent of the errors present (Jones 1998). 6

 Testing's goal runs counter to the goals of other development activities  Testing can never completely prove the absence of errors  Testing by itself does not improve software quality  Testing requires you to assume that you'll find errors in your code 7

8 Developer testing should probably take 8 to 25 percent of the total project time

 Test for each relevant requirement to make sure that the requirements have been implemented  Test for each relevant design concern to make sure that the design has been implemented  Use "basis testing" to add detailed test cases to those that test the requirements and the design  Use a checklist of the kinds of errors you've made on the project to date or have made on previous projects 9

 Effort is the same  Detect defects earlier  Forces you to think at least a little bit  Exposes requirements problems sooner  Run it when you want 10 source flickr

 Developer tests tend to be "clean tests“  Developer testing tends to have an optimistic view of test coverage  Developer testing tends to skip more sophisticated kinds of test coverage 11

 Incomplete Testing  Structured Basis Testing  Data-Flow Testing  Equivalence Partitioning  Error Guessing  Boundary Analysis  Classes of Bad Data  Classes of Good Data  Use Test Cases That Make Hand-Checks Convenient 12

Test each statement in a program at least once. Compute the minimum number of test cases: Start with 1 for the straight path through the routine Add 1 for each of the following keywords, or their equivalents: if, while, repeat, for, and, and or Add 1 for each case in a case statement. If the case statement doesn't have a default case, add 1 more. 13

14 CaseTest DescriptionTest Data 1Nominal caseAll boolean conditions are true 2The initial for condition is falsenumEmployees < 1 3The first if is false m_employee[ id ].governmentRetirementWith-held >=MAX_GOVT_RETIREMENT 4 The second if is false because the first part of the and is false not m_employee[ id ].WantsRetirement 5 The second if is false because the second part of the and is false not EligibleForRetirement( m_employee[id] ) 6The third if is falsenot EligibleForPersonalRetirement( m_employee[ id ] )

The normal combination of data states is that a variable is defined, used one or more times, and perhaps killed. The key to writing data-flow test cases is to exercise all possible defined-used paths: All definitions. Test every definition of every variable—that is, every place at which any variable receives a value. All definitions. Test every definition of every variable—that is, every place at which any variable receives a value. All defined-used combinations. Test every combination of defining a variable in one place and using it in another. All defined-used combinations. Test every combination of defining a variable in one place and using it in another. 15

CaseTest Description 7 Define companyRetirement in line 12, and use it first in line 26. This isn't necessarily covered by any of the previous test cases. 8Define companyRetirement in line 17, and use it first in line 31. This isn't necessarily covered by any of the previous test cases. 16 if ( Condition 1 ) { x = a; } else { x = b; } if ( Condition 2 ) { y = x + 1; } else { y = x - 1; }

CaseTest Description 1 Case 1 is defined so that the true condition for m_employee[ ID ]. governmentRetirementWithheld < MAX_GOVT_RETIREMENT is the first case on the true side of the boundary. T 3 Case 3 is defined so that the false condition for m_employee[ ID ]. governmentRetirementWithheld < MAX_GOVT_RETIREMENT is on the false side of the boundary. 9An additional test case is added for the case directly on the boundary in which m_employee [ ID ].governmentRetirementWithheld = MAX_GOVT_RETIREMENT. 17

CaseTest Description 10 A large group of employees, each of whom has a large salary (what constitutes "large" depends on the specific system being developed)—for the sake of example, we'll say 1000 employees, each with a salary of $250,000, none of whom have had any social security tax withheld and all of whom want retirement withholding. 11A group of 10 employees, each of whom has a salary of $ Minimum and Maximum allowable values

 Too little data  Too much data  The wrong kind of data  The wrong size of data  Uninitialized data 19 CaseTest Description 12An array of 100,000,000 employees. Tests for too much data. 13A negative salary. Wrong kind of data. 14A negative number of employees. Wrong kind of data.

 Nominal cases—middle-of-the-road, expected values  Minimum normal configuration  Maximum normal configuration  Compatibility with old data 20 CaseTest Description 16 A group of one employee. To test the minimum normal configuration. 17A group of 500 employees. To test the maximum normal configuration.

 Which Classes Contain the Most Errors?  Errors by Classification  The scope of most errors is fairly limited  Many errors are outside the domain of construction  Most construction errors are the programmers' fault  Clerical errors (typos) are a surprisingly common source of problems  Misunderstanding the design is a recurring theme in studies of programmer errors  Most errors are easy to fix  It's a good idea to measure your own organization's experiences with errors 21

 Building Scaffolding to Test Individual Classes  Diff Tools  Test-Data Generators  Coverage Monitors  Data Recorder/Logging  Symbolic Debuggers  System Perturbers  Error Databases 22

 Planning to Test  Retesting (Regression Testing)  Automated Testing 23

Debugging is a means of diagnosing and correcting the root causes of errors that have already been detected. 24

1. Stabilize the error 2. Locate the source of the error a.Gather the data b.Analyze the data and form hypothesis c.Determine how to prove or disprove the hypothesis d.Prove or disprove the hypothesis by 2c 3. Fix the defect 4. Test the fix 5. Look for similar errors 25

26 The program is supposed to print a list of employees and their income-tax withholdings in alphabetical order.

 Use all available data  Refine the test cases  Check unit tests  Use available tools  Reproduce the error several different ways  Generate more data to generate more hypotheses  Use the results of negative tests  Brainstorm for possible hypotheses 27

 Narrow the suspicious region of the code  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 28

 Understand the problem before you fix it  Understand the program, not just the problem  Confirm the defect diagnosis  Relax  Save the original source code  Fix the problem not the symptom  Make one change at a time  Add a unit test that expose the defect  Look for similar defects 29

30  Your ego tells you that your code is good and doesn't have a defect even when you've seen that it has one.  How "Psychological Set" Contributes to Debugging Blindness

 How "Psychological Distance" Can Help 31 First VariableSecond VariablePsychological Distance stopptstcpptAlmost invisible shiftrnshiftrmAlmost none dcountbcountSmall claims1claims2Small productsumLarge

 Diff Tools  Compiler Warning Messages  Set your compiler’s warning level to the highest  Treat warnings as errors  Initiate project wide standards  Extended Syntax and Logic Checking  Profilers  Test Frameworks/Scaffolding  Debuggers 32

Questions?