Download presentation
Presentation is loading. Please wait.
Published byArron Booth Modified over 8 years ago
1
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Finding Software Faults: Testing Process
2
Dr. Pedro Mejia Alvarez Software Testing Slide 2 Topics covered l Introduction to testing l Sources of errors l Why do we need testing ? l Verification and validation planning l Software inspections. l Static and dynamic verification. l Software Testing Process.
3
Dr. Pedro Mejia Alvarez Software Testing Slide 3 3 Central themes l SE is concerned with BIG programs l complexity is an issue l software evolves l development must be efficient l you’re doing it together l software must effectively support users l involves different disciplines l SE is a balancing act
4
Dr. Pedro Mejia Alvarez Software Testing Slide 4 How do we get here ? operating system growth size in millions of lines of code From Frans Kaashoek and Jerome Saltzer, Topics in the Engineering of Computer Systems.
5
Dr. Pedro Mejia Alvarez Software Testing Slide 5 Where do we get our faults from: operating systems ?
6
Dr. Pedro Mejia Alvarez Software Testing Slide 6 6 Global distribution of effort coding 20% testing 45% design 15% Integration 10% engineering 10% specification 10% Do we follow a Methodology when building software ?
7
Dr. Pedro Mejia Alvarez Software Testing Slide 7 7 Cost of Testing l In the real-world, testing is the principle post-design activity l Restricting early testing usually increases cost l Extensive hardware-software integration requires more testing You’re going to spend at least half of your development budget on testing, whether you want to or not
8
Dr. Pedro Mejia Alvarez Software Testing Slide 8 Lessons l Many errors are made in the early phases l These errors are discovered late l Repairing those errors is costly l It pays off to start testing real early
9
Dr. Pedro Mejia Alvarez Software Testing Slide 9 Summary: Why Do We Test Software ? Introduction to Software Testing, 9 A tester’s goal is to eliminate faults as early as possible Improve quality Improve quality Reduce cost Reduce cost Preserve customer satisfaction Preserve customer satisfaction
10
Dr. Pedro Mejia Alvarez Software Testing Slide 10 How then to proceed? l Exhaustive testing most often is not feasible l Random statistical testing does not work either if you want to find errors l Therefore, we look for systematic ways to proceed during testing
11
Dr. Pedro Mejia Alvarez Software Testing Slide 11 State-of-the-Art on Faults l 30-85 errors are made per 1000 lines of source code l extensively tested software contains 0.5-3 errors per 1000 lines of source code l testing is postponed, as a consequence: the later an error is discovered, the more it costs to fix it. l error distribution: 60% design, 40% implementation. 66% of the design errors are not discovered until the software has become operational.
12
Dr. Pedro Mejia Alvarez Software Testing Slide 12 How Faults are introduced l In software development projects, a “software fault" can be introduced at any stage during development. l Faults are a consequence of the nature of human factors during development. They arise from oversights or mutual misunderstandings made by a software team during specification, design, coding, data entry and documentation.human factors l More complex faults can arise from unintended interactions between different parts of the software, the operating systems and the computer network. l 66% of the design errors are not discovered until the software has become operational.
13
Dr. Pedro Mejia Alvarez Software Testing Slide 13 Most Common Software problems Incorrect calculation Incorrect data edits & ineffective data edits Incorrect matching and merging of data Data searches that yields incorrect results Incorrect processing of data relationship Incorrect coding / implementation of business rules Inadequate software performance
14
Dr. Pedro Mejia Alvarez Software Testing Slide 14 Most Common Software problems Confusing or misleading data Software usability by end users & Obsolete Software Inconsistent processing Unreliable results or performance Inadequate support of business needs Incorrect or inadequate interfaces with other systems Inadequate performance and security controls Incorrect file handling
15
Dr. Pedro Mejia Alvarez Software Testing Slide 15 Types of bugs Arithmetic bugs Division by zero.Division by zero Arithmetic overflow or underflow.Arithmetic overflowunderflow Loss of arithmetic precision due to rounding or numerically unstable algorithms.arithmetic precisionroundingnumerically unstable Resource bugs Null pointer dereference.Null pointer Using an uninitialized variable.uninitialized variable Using an otherwise valid instruction on the wrong data type (see packed decimal/binary coded decimal).data typepacked decimalbinary coded decimal Access violations.Access violations Resource leaks, where a finite system resource (such as memory or file handles) become exhausted.memoryfile handles Buffer overflow. Excessive recursion.
16
Dr. Pedro Mejia Alvarez Software Testing Slide 16 Types of bugs Logic bugs Infinite loops and infinite recursion.Infinite loopsrecursion Off by one error, counting one too many or too few when looping.Off by one error Syntax bugs: Those found by the compilers. Multi-threading programming bugs Dedlock. Race condition. Concurrency errors. Interfacing bugs. Incorrect hardware handling. Performance bugs Teamworking bugs
17
Dr. Pedro Mejia Alvarez Software Testing Slide 17 Introduction to Software Testing, 17 l Fault Detection: “Waiting” or causing (or finding) for the error or failure to ocurr. l Fault Location: Finding where the fault(s) ocurred, its causes and its consequences. l Fault Recovery: Fixing the fault and NOT causing others. l Regresion Testing: Testing the software again with the same data that caused the original fault Dynamics of Faults
18
Dr. Pedro Mejia Alvarez Software Testing Slide 18 What is our goal during testing? l Objective 1: find as many faults as possible l Objective 2: make you feel confident that the software works OK l Objective 3: make sure that the software fulfills its specification. l Objective 4: make sure that the customer approves the software. Do we know what to test and how to test it ?
19
Dr. Pedro Mejia Alvarez Software Testing Slide 19 The structure of a software test plan l The testing process. l Requirements traceability. l Tested items. l Testing schedule. l Test recording procedures. l Hardware and software requirements. l Constraints.
20
Dr. Pedro Mejia Alvarez Software Testing Slide 20 l Software inspections. Concerned with analysis of the static system representation to discover problems (static verification) May be supplement by tool-based document and code analysis l Software Testing. Concerned with exercising and observing product behaviour (dynamic verification) The system is executed with test data and its operational behaviour is observed. Used to Detect Faults. l Software Debugging. Concerned with finding and removing the faults. l Fault Tolerance. If faults still ocurr during operation: detect, remove and recover the system from faults. Static and dynamic verification
21
Dr. Pedro Mejia Alvarez Software Testing Slide 21 Software inspections l These involve people examining the source representation with the aim of discovering anomalies and defects. l Inspections not require execution of a system so may be used before implementation. l They may be applied to any representation of the system (requirements, design,configuration data, test data, etc.). l They have been shown to be an effective technique for discovering program errors.
22
Dr. Pedro Mejia Alvarez Software Testing Slide 22 Inspections and testing
23
Dr. Pedro Mejia Alvarez Software Testing Slide 23 Inspection checklists l Checklist of common errors should be used to drive the inspection. l Error checklists are programming language dependent and reflect the characteristic errors that are likely to arise in the language. l In general, the 'weaker' the type checking, the larger the checklist. l Examples: Initialisation, Constant naming, loop termination, array bounds, etc.
24
Dr. Pedro Mejia Alvarez Software Testing Slide 24 Inspection checks 1
25
Dr. Pedro Mejia Alvarez Software Testing Slide 25 Inspection checks 2
26
Dr. Pedro Mejia Alvarez Software Testing Slide 26 Stages of static analysis l Control flow analysis. Checks for loops with multiple exit or entry points, finds unreachable code, etc. l Data use analysis. Detects uninitialised variables, variables written twice without an intervening assignment, variables which are declared but never used, etc. l Interface analysis. Checks the consistency of routine and procedure declarations and their use
27
Dr. Pedro Mejia Alvarez Software Testing Slide 27 Stages of static analysis l Information flow analysis. Identifies the dependencies of output variables. Does not detect anomalies itself but highlights information for code inspection or review l Path analysis. Identifies paths through the program and sets out the statements executed in that path. Again, potentially useful in the review process l Both these stages generate vast amounts of information. They must be used with care.
28
Dr. Pedro Mejia Alvarez Software Testing Slide 28 Testing process goals l Validation testing To demonstrate to the developer and the system customer that the software meets its requirements; A successful test shows that the system operates as intended. l Defect testing To discover faults or defects in the software where its behaviour is incorrect or not in conformance with its specification; A successful test is a test that makes the system perform incorrectly and so exposes a defect in the system.
29
Dr. Pedro Mejia Alvarez Software Testing Slide 29 The testing phases l Component (unit) testing Testing of individual program components; Usually the responsibility of the component developer (except sometimes for critical systems); Tests are derived from the developer’s experience. l System testing Testing of groups of components integrated to create a system or sub-system; The responsibility of an independent testing team; Tests are based on a system specification.
30
Dr. Pedro Mejia Alvarez Software Testing Slide 30 Testing phases
31
Dr. Pedro Mejia Alvarez Software Testing Slide 31 Component testing l Component or unit testing is the process of testing individual components in isolation. l It is a defect testing process. l Components may be: Individual functions or methods within an object; Object classes with several attributes and methods; Composite components with defined interfaces used to access their functionality.
32
Dr. Pedro Mejia Alvarez Software Testing Slide 32 System testing l Involves integrating components to create a system or sub-system. l May involve testing an increment to be delivered to the customer. l Two phases: Integration testing - the test team have access to the system source code. The system is tested as components are integrated. Release testing - the test team test the complete system to be delivered as a black-box.
33
Dr. Pedro Mejia Alvarez Software Testing Slide 33 Integration testing l Involves building a system from its components and testing it for problems that arise from component interactions. l Top-down integration Develop the skeleton of the system and populate it with components. l Bottom-up integration Integrate infrastructure components then add functional components. l To simplify error localisation, systems should be incrementally integrated.
34
Dr. Pedro Mejia Alvarez Software Testing Slide 34 Incremental integration testing
35
Dr. Pedro Mejia Alvarez Software Testing Slide 35 l Objectives are to detect faults due to interface errors or invalid assumptions about interfaces. l Particularly important for object-oriented development as objects are defined by their interfaces. Interface testing
36
Dr. Pedro Mejia Alvarez Software Testing Slide 36 Interface testing
37
Dr. Pedro Mejia Alvarez Software Testing Slide 37 Interface types l Parameter interfaces Data passed from one procedure to another. l Shared memory interfaces Block of memory is shared between procedures or functions. l Procedural interfaces Sub-system encapsulates a set of procedures to be called by other sub-systems. l Message passing interfaces Sub-systems request services from other sub-system.s
38
Dr. Pedro Mejia Alvarez Software Testing Slide 38 Interface errors l Interface misuse A calling component calls another component and makes an error in its use of its interface e.g. parameters in the wrong order. l Interface misunderstanding A calling component embeds assumptions about the behaviour of the called component which are incorrect. l Timing errors The called and the calling component operate at different speeds and out-of-date information is accessed.
39
Dr. Pedro Mejia Alvarez Software Testing Slide 39 Interface testing guidelines l Design tests so that parameters to a called procedure are at the extreme ends of their ranges. l Always test pointer parameters with null pointers. l Design tests which cause the component to fail. l Use stress testing in message passing systems. l In shared memory systems, vary the order in which components are activated.
40
Dr. Pedro Mejia Alvarez Software Testing Slide 40 Performance testing l Part of release testing may involve testing the emergent properties of a system, such as performance and reliability. l Performance tests usually involve planning a series of tests where the load is steadily increased until the system performance becomes unacceptable.
41
Dr. Pedro Mejia Alvarez Software Testing Slide 41 Stress testing l Exercises the system beyond its maximum design load. Stressing the system often causes defects to come to light. l Stressing the system test failure behaviour.. Systems should not fail catastrophically. Stress testing checks for unacceptable loss of service or data. l Stress testing is particularly relevant to distributed systems that can exhibit severe degradation as a network becomes overloaded.
42
Dr. Pedro Mejia Alvarez Software Testing Slide 42 Release testing l The process of testing a release of a system that will be distributed to customers. l Primary goal is to increase the supplier’s confidence that the system meets its requirements. l Release testing is usually black-box or functional testing Based on the system specification only; Testers do not have knowledge of the system implementation.
43
Dr. Pedro Mejia Alvarez Software Testing Slide 43 The Software Testing process
44
Dr. Pedro Mejia Alvarez Software Testing Slide 44 Components of a Test Case l A test case is a multipart artifact with a definite structure l Test case values Expected results Expected results The result that will be produced when executing the test if the program satisfies it intended behavior The values that directly satisfy one test requirement
45
Dr. Pedro Mejia Alvarez Software Testing Slide 45 Test case design l Involves designing the test cases (inputs and outputs) used to test the system. l The goal of test case design is to create a set of tests that are effective in validation and defect testing. l Design approaches: Black Box Testing: Partition testing; White Box Testing: Structural testing. Criteria based on Structures.
46
Dr. Pedro Mejia Alvarez Software Testing Slide 46 Black Box Testing. l Study the algorithms l Programming. l Pre-conditions & Post-Conditions of each algorithm. l Develop Test Cases. l Develop Oracle. l Run the test. l Record Inputs and Outputs. l Record Invalid Outputs l If invalid Outputs or Execution Errors then: l Debug the program: Finding the fault. Testing the algorithms
47
Dr. Pedro Mejia Alvarez Software Testing Slide 47 Black-box testing
48
Dr. Pedro Mejia Alvarez Software Testing Slide 48 Testing guidelines l Testing guidelines are hints for the testing team to help them choose tests that will reveal defects in the system Choose inputs that force the system to generate all error messages; Design inputs that cause buffers to overflow; Repeat the same input or input series several times; Force invalid outputs to be generated; Force computation results to be too large or too small.
49
Dr. Pedro Mejia Alvarez Software Testing Slide 49 Partition testing l Input data and output results often fall into different classes where all members of a class are related. l Each of these classes is an equivalence partition or domain where the program behaves in an equivalent way for each class member. l Test cases should be chosen from each partition.
50
Dr. Pedro Mejia Alvarez Software Testing Slide 50 Equivalence partitioning Oracle Test Data Generation Valid/ Invalid Output Random Number Generation
51
Dr. Pedro Mejia Alvarez Software Testing Slide 51 Equivalence partitions
52
Dr. Pedro Mejia Alvarez Software Testing Slide 52 Search routine specification procedure Search (Key : ELEM ; T: SEQ of ELEM; Found : in out BOOLEAN; L: in out ELEM_INDEX) ; Pre-condition -- the sequence has at least one element T’FIRST <= T’LAST Post-condition -- the element is found and is referenced by L ( Found and T (L) = Key) or -- the element is not in the array ( not Found and not (exists i, T’FIRST >= i <= T’LAST, T (i) = Key ))
53
Dr. Pedro Mejia Alvarez Software Testing Slide 53 l Inputs which conform to the pre-conditions. l Inputs where a pre-condition does not hold. l Inputs where the key element is a member of the array. l Inputs where the key element is not a member of the array. Search routine - input partitions
54
Dr. Pedro Mejia Alvarez Software Testing Slide 54 Testing guidelines (sequences) Test Cases: l Test software with sequences which have only a single value. l Use sequences of different sizes in different tests. l Derive tests so that the first, middle and last elements of the sequence are accessed. l Test with sequences of zero length.
55
Dr. Pedro Mejia Alvarez Software Testing Slide 55 Search routine - input partitions
56
Dr. Pedro Mejia Alvarez Software Testing Slide 56 l Sometime called white-box testing. l Derivation of test cases according to program structure. Knowledge of the program is used to identify additional test cases. l Objective is to exercise all program statements (not all path combinations). Structural testing
57
Dr. Pedro Mejia Alvarez Software Testing Slide 57 Structural testing
58
Dr. Pedro Mejia Alvarez Software Testing Slide 58 l Pre-conditions satisfied, key element in array. l Pre-conditions satisfied, key element not in array. l Pre-conditions unsatisfied, key element in array. l Pre-conditions unsatisfied, key element not in array. l Input array has a single value. l Input array has an even number of values. l Input array has an odd number of values. Binary search - equiv. partitions
59
Dr. Pedro Mejia Alvarez Software Testing Slide 59 Binary search equiv. partitions
60
Dr. Pedro Mejia Alvarez Software Testing Slide 60 Binary search - test cases
61
Dr. Pedro Mejia Alvarez Software Testing Slide 61 Path testing l The objective of path testing is to ensure that the set of test cases is such that each path through the program is executed at least once. l The starting point for path testing is a program flow graph that shows nodes representing program decisions and arcs representing the flow of control. l Statements with conditions are therefore nodes in the flow graph.
62
Dr. Pedro Mejia Alvarez Software Testing Slide 62 Binary search flow graph
63
Dr. Pedro Mejia Alvarez Software Testing Slide 63 l 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14 l 1, 2, 3, 4, 5, 14 l 1, 2, 3, 4, 5, 6, 7, 11, 12, 5, … l 1, 2, 3, 4, 6, 7, 2, 11, 13, 5, … l Test cases should be derived so that all of these paths are executed l A dynamic program analyser may be used to check that paths have been executed Independent paths
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.