Internet Software Development Testing and Inspections Paul J Krause.

Slides:



Advertisements
Similar presentations
Testing and Inspecting to Ensure High Quality
Advertisements

Object Oriented Analysis And Design-IT0207 iiI Semester
Test process essentials Riitta Viitamäki,
Testing and Quality Assurance
Software Engineering-II Sir zubair sajid. What’s the difference? Verification – Are you building the product right? – Software must conform to its specification.
Software Failure: Reasons Incorrect, missing, impossible requirements * Requirement validation. Incorrect specification * Specification verification. Faulty.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 10: Testing and Inspecting to Ensure High Quality Part 1:
Testing an individual module
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Object-Oriented Software Engineering Revision Paul J Krause.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
Testing and Inspecting to Ensure High Quality
1 Object-Oriented Testing CIS 375 Bruce R. Maxim UM-Dearborn.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Verification and Validation.
Software Quality Assurance Lecture #4 By: Faraz Ahmed.
© 2012 IBM Corporation Rational Insight | Back to Basis Series Chao Zhang Unit Testing.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 10: Testing and Inspecting to Ensure High Quality Part 4:
CMSC 345 Fall 2000 Unit Testing. The testing process.
Software Engineering DKT 311 Lecture 11 Verification and critical system validation.
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.
Coverage – “Systematic” Testing Chapter 20. Dividing the input space for failure search Testing requires selecting inputs to try on the program, but how.
Lecture 11 Testing and Debugging SFDV Principles of Information Systems.
From Use Cases to Test Cases 1. A Tester’s Perspective  Without use cases testers will approach the system to be tested as a “black box”. “What, exactly,
Software Testing Testing types Testing strategy Testing principles.
Testing Methods Carl Smith National Certificate Year 2 – Unit 4.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Chapter SIX Implementation, Testing and Pragmatics Making it a reality.
Black-box Testing.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
Chapter 10: Testing Lecturer: Dr. Mai Fadel. Basic Definitions A failure is an unacceptable behavior exhibited by a system. E.g. the production of incorrect.
Chapter 12: Software Inspection Omar Meqdadi SE 3860 Lecture 12 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Testing and inspecting to ensure high quality An extreme and easily understood kind of failure is an outright crash. However, any violation of requirements.
CS451 Lecture 10: Software Testing Yugi Lee STB #555 (816)
Dynamic Testing.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
Testing and Debugging. Testing Fundamentals  Test as you develop Easier to find bugs early rather than later Prototyping helps identify problems early.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Software Engineering Testing. These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill 2009). Slides copyright.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Verification vs. Validation Verification: "Are we building the product right?" The software should conform to its specification.The software should conform.
Defect testing Testing programs to establish the presence of system defects.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
Dynamic Black-Box Testing Part 1 What is dynamic black-box testing? How to reduce the number of test cases using: Equivalence partitioning Boundary value.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 10: Testing and Inspecting to Ensure High Quality.
Testing and Inspecting to Ensure High Quality. © Lethbridge/Laganière 2005 Chapter 10: Testing and Inspecting for High Quality 2 Basic definitions A failure.
Introduction to Algorithms
Testing and Inspecting to Ensure High Quality
Some Simple Definitions for Testing
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Lecture 09:Software Testing
Programming Fundamentals (750113) Ch1. Problem Solving
Baisc Of 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.
Introduction to Algorithms
CSE 240 Lecture 12.
CHAPTER 6 Testing and Debugging.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

Internet Software Development Testing and Inspections Paul J Krause

Software: benefits and risks Instruction 0x30da4b referenced memory at 0x04de

The Drive for Software Quality Low Defect Rates High User Satisfaction

But Testing is:-  Time consuming writing test cases writing test cases executing test cases executing test cases  Error prone

But Testing is:-  Time consuming writing test cases writing test cases executing test cases executing test cases  Error prone

Hazardous quality definition  Quality means conformance to requirements  Requirements contain > 15% of software errors.  Requirements grow at > 2% per month.  Do you conform to requirements errors?  Do you conform to totally new requirements?  Whose requirements are you trying to satisfy?

The World is Informal  “… one of the greatest difficulties in software development is formalisation  “- capturing in symbolic representation a worldly computational problem so that statements obtained by following symbolic manipulation are useful statements once translated back into the real world.  The formalisation problem is the essence of requirements engineering.”  W L Scherlis

Errors, defects, failures ErrorDefectFailure Introduces aMay result in one or more

Effective and Efficient Testing  To test effectively, you must use a strategy that uncovers as many defects as possible.  To test efficiently, you must find the largest possible number of defects using the fewest possible tests Testing is like detective work: Testing is like detective work: The tester must try to understand how programmers and designers think, so as to better find defects.The tester must try to understand how programmers and designers think, so as to better find defects. The tester must not leave anything uncovered, and must be suspicious of everything.The tester must not leave anything uncovered, and must be suspicious of everything. It does not pay to take an excessive amount of time; tester has to be efficient.It does not pay to take an excessive amount of time; tester has to be efficient.

Black-box testing  Testers provide the system with inputs and observe the outputs They can see none of: They can see none of: The source codeThe source code The internal dataThe internal data Any of the design documentation describing the system’s internalsAny of the design documentation describing the system’s internals But they can see: But they can see: Requirements documents and/or specificationsRequirements documents and/or specifications

Glass-box testing  Also called ‘white-box’ or ‘structural’ testing  Testers have access to the system design They can They can Examine the design documentsExamine the design documents View the codeView the code Observe at run time the steps taken by algorithms and their internal dataObserve at run time the steps taken by algorithms and their internal data Individual programmers often informally employ glass-box testing to verify their own code Individual programmers often informally employ glass-box testing to verify their own code But they are testing what is implemented, and not necessarily what is required!

Recommended Practice  Use Black Box techniques for initial test design Check all requirements are covered Check all requirements are covered  Analyse the code or design to see to what extent the logical structure of the software under test is covered  Intelligently add in test cases to increase the structural coverage up to some agreed level

Test design techniques  Equivalence partitioning Reduces the number of test cases by selecting “representative” input values Reduces the number of test cases by selecting “representative” input values  Boundary value analysis Increases effectiveness of test case design by focusing on “high risk” input values Increases effectiveness of test case design by focusing on “high risk” input values  These are applicable to Black Box testing as they base test design on the input values that are required to be handled

Equivalence classes  It is inappropriate to test by brute force, using every possible input value Takes a huge amount of time Takes a huge amount of time Is impractical Is impractical Is pointless! Is pointless!  Divide the possible inputs into groups which you believe will be treated similarly by all algorithms. Such groups are called equivalence classes. Such groups are called equivalence classes. A tester needs only to run one test per equivalence class A tester needs only to run one test per equivalence class The tester has to The tester has to understand the required input,understand the required input, appreciate how the software may have been designedappreciate how the software may have been designed

Examples of equivalence classes  Valid input is a month number (1-12) Equivalence classes are: [-∞..0], [1..12], [13.. ∞] Equivalence classes are: [-∞..0], [1..12], [13.. ∞]  Valid input is one of ten strings representing a type of fuel Equivalence classes are Equivalence classes are 10 classes, one for each string10 classes, one for each string A class representing all other strings (Carefull!)A class representing all other strings (Carefull!)

Testing at boundaries of equivalence classes  More errors in software occur at the boundaries of equivalence classes  The idea of equivalence class testing should be expanded to specifically test values at the extremes of each equivalence class E.g. The number 0 often causes problems E.g. The number 0 often causes problems  E.g.: If the valid input is a month number (1-12) Test equivalence classes as before Test equivalence classes as before Test 0, 1, 12 and 13 as well as very large positive and negative values Test 0, 1, 12 and 13 as well as very large positive and negative values

Detecting specific categories of defects  A tester must try to uncover any defects the other software engineers might have introduced. This means designing tests that explicitly try to catch a range of specific types of defects that commonly occur This means designing tests that explicitly try to catch a range of specific types of defects that commonly occur

Defects in Ordinary Algorithms  Incorrect logical conditions  Performing a calculation in the wrong part of a control construct  Not terminating a loop or recursion  Not setting up the correct preconditions for an algorithm  Not handling null conditions  Off-by-one errors  …

Defects in Timing and Co-ordination  Deadlock and livelock Defects: Defects: A deadlock is a situation where two or more threads are stopped, waiting for each other to do something.A deadlock is a situation where two or more threads are stopped, waiting for each other to do something. The system is hung The system is hung Livelock is similar, but now the system can do some computations, but can never get out of some states.Livelock is similar, but now the system can do some computations, but can never get out of some states.

Defects in Timing and Co- ordination  Deadlock and livelock Testing strategies: Testing strategies: Deadlocks and livelocks occur due to unusual combinations of conditions that are hard to anticipate or reproduce.Deadlocks and livelocks occur due to unusual combinations of conditions that are hard to anticipate or reproduce. It is often most effective to use inspection to detect such defects, rather than testing alone.It is often most effective to use inspection to detect such defects, rather than testing alone. However, when testing:However, when testing: Vary the time consumption of different threads. Vary the time consumption of different threads. Run a large number of threads concurrently. Run a large number of threads concurrently. Deliberately deny resources to one or more threads. Deliberately deny resources to one or more threads.

Example of deadlock B:ThreadA:Thread waiting to lock O: waiting to lockP: lock P: O: lock

Defects in Timing and Co- ordination  Critical races Defects: Defects: One thread experiences a failure because another thread interferes with the ‘normal’ sequence of events.One thread experiences a failure because another thread interferes with the ‘normal’ sequence of events. Testing strategies: Testing strategies: It is particularly hard to test for critical races using black box testing alone.It is particularly hard to test for critical races using black box testing alone. One possible, although invasive, strategy is to deliberately slow down one of the threads.One possible, although invasive, strategy is to deliberately slow down one of the threads. Use inspection.Use inspection.

Example of critical race A:ThreadData:B:Thread get set a) Normal A:ThreadData:B:Thread get set b) Abnormal due to delay in thread A

Semaphore and synchronization  Critical races can be prevented by locking data so that they cannot be accessed by other threads when they are not ready One widely used locking mechanism is called a semaphore. One widely used locking mechanism is called a semaphore. In Java, the synchronized keyword can be used. In Java, the synchronized keyword can be used. It ensures that no other thread can access an object until the synchronized method terminates.It ensures that no other thread can access an object until the synchronized method terminates.

Example of a synchronized method A:ThreadData:B:Thread get a) Abnormal: The value put by thread A is immediately overwritten by the value put by thread B. put calc put calc A:ThreadData:B:Thread get put calc put calc waiting for A: to complete its synchronized operation b) The problem has been solved by accessing the data using synchronized methods

Inspections  An inspection is an activity in which one or more people systematically Examine source code or documentation, looking for defects. Examine source code or documentation, looking for defects. Normally, inspection involves a meeting... Normally, inspection involves a meeting... Although participants can also inspect alone at their desks.Although participants can also inspect alone at their desks.

Roles on inspection teams  The author  The moderator. Calls and runs the meeting. Calls and runs the meeting. Makes sure that the general principles of inspection are adhered to. Makes sure that the general principles of inspection are adhered to.  The secretary. Responsible for recording the defects when they are found. Responsible for recording the defects when they are found. Must have a thorough knowledge of software engineering. Must have a thorough knowledge of software engineering.  Paraphrasers. Step through the document explaining it in their own words. Step through the document explaining it in their own words.

Principles of inspecting  Inspect the most important documents of all types code, design documents, test plans and requirements code, design documents, test plans and requirements  Choose an effective and efficient inspection team between two and five people between two and five people Including experienced software engineers Including experienced software engineers  Require that participants prepare for inspections They should study the documents prior to the meeting and come prepared with a list of defects They should study the documents prior to the meeting and come prepared with a list of defects  Only inspect documents that are ready Attempting to inspect a very poor document will result in defects being missed Attempting to inspect a very poor document will result in defects being missed

Principles of inspecting  Avoid discussing how to fix defects Fixing defects can be left to the author Fixing defects can be left to the author  Avoid discussing style issues Issues like are important, but should be discussed separately Issues like are important, but should be discussed separately  Do not rush the inspection process A good speed to inspect is A good speed to inspect is 200 lines of code per hour (including comments)200 lines of code per hour (including comments) or ten pages of text per houror ten pages of text per hour

Principles of inspecting  Avoid making participants tired It is best not to inspect for more than two hours at a time, or for more than four hours a day It is best not to inspect for more than two hours at a time, or for more than four hours a day  Keep and use logs of inspections You can also use the logs to track the quality of the design process You can also use the logs to track the quality of the design process  Re-inspect when changes are made You should re-inspect any document or code that is changed more than 20% You should re-inspect any document or code that is changed more than 20%