1 / 63

Software Testing: Finding Software Faults: Testing Process

Software Testing: Finding Software Faults: Testing Process. Topics covered. Introduction to testing Sources of errors Why do we need testing ? Verification and validation planning Software inspections. Static and dynamic verification. Software Testing Process.

villarreal
Download Presentation

Software Testing: Finding Software Faults: Testing Process

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Software Testing: Finding Software Faults: Testing Process

  2. Topics covered • Introduction to testing • Sources of errors • Why do we need testing ? • Verification and validation planning • Software inspections. • Static and dynamic verification. • Software Testing Process.

  3. SE is concerned with BIG programs complexity is an issue software evolves development must be efficient you’re doing it together software must effectively support users involves different disciplines SE is a balancing act Central themes

  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. Where do we get our faults from: operating systems ?

  6. Global distribution of effort Integration 10% engineering 10% coding 20% design 15% specification 10% testing 45% Do we follow a Methodology when building software ?

  7. Cost of Testing You’re going to spend at least half of your development budget on testing, whether you want to or not • In the real-world, testing is the principle post-design activity • Restricting early testing usually increases cost • Extensive hardware-software integration requires more testing

  8. Lessons • Many errors are made in the early phases • These errors are discovered late • Repairing those errors is costly •  It pays off to start testing real early

  9. Summary: Why Do We Test Software ? A tester’s goal is to eliminate faults as early as possible • Improve quality • Reduce cost • Preserve customer satisfaction

  10. How then to proceed? • Exhaustive testing most often is not feasible • Random statistical testing does not work either if you want to find errors • Therefore, we look for systematic ways to proceed during testing

  11. State-of-the-Art on Faults • 30-85 errors are made per 1000 lines of source code • extensively tested software contains 0.5-3 errors per 1000 lines of source code • testing is postponed, as a consequence: the later an error is discovered, the more it costs to fix it. • error distribution: 60% design, 40% implementation. 66% of the design errors are not discovered until the software has become operational.

  12. How Faults are introduced • In software development projects, a “software fault" can be introduced at any stage during development. • 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. • More complex faults can arise from unintended interactions between different parts of the software, the operating systems and the computer network. • 66% of the design errors are not discovered until the software has become operational.

  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. 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. Types of bugs • Arithmetic bugs • Division by zero. • Arithmetic overflow or underflow. • Loss of arithmetic precision due to rounding or numerically unstable algorithms. • Resource bugs • Null pointer dereference. • Using an uninitialized variable. • Using an otherwise valid instruction on the wrong data type (see packed decimal/binary coded decimal). • Access violations. • Resource leaks, where a finite system resource (such as memory or file handles) become exhausted. • Buffer overflow. • Excessive recursion.

  16. Types of bugs • Logic bugs • Infinite loops and infinite recursion. • Off by one error, counting one too many or too few when looping. • 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. Dynamics of Faults • Fault Detection: “Waiting” or causing (or finding) for the error or failure to ocurr. • Fault Location: Finding where the fault(s) ocurred, its causes and its consequences. • Fault Recovery: Fixing the fault and NOT causing others. • Regresion Testing: Testing the software again with the same data that caused the original fault

  18. What is our goal during testing? • Objective 1: find as many faults as possible • Objective 2: make you feel confident that the software works OK • Objective 3: make sure that the software fulfills its specification. • Objective 4: make sure that the customer approves the software. Do we know what to test and how to test it ?

  19. The structure of a software test plan • The testing process. • Requirements traceability. • Tested items. • Testing schedule. • Test recording procedures. • Hardware and software requirements. • Constraints.

  20. Static and dynamic verification • 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 • 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. • Software Debugging. Concerned with finding and removing the faults. • Fault Tolerance. If faults still ocurr during operation: detect, remove and recover the system from faults.

  21. Software inspections • These involve people examining the source representation with the aim of discovering anomalies and defects. • Inspections not require execution of a system so may be used before implementation. • They may be applied to any representation of the system (requirements, design,configuration data, test data, etc.). • They have been shown to be an effective technique for discovering program errors.

  22. Inspections and testing

  23. Inspection checklists • Checklist of common errors should be used to drive the inspection. • Error checklists are programming language dependent and reflect the characteristic errors that are likely to arise in the language. • In general, the 'weaker' the type checking, the larger the checklist. • Examples: Initialisation, Constant naming, loop termination, array bounds, etc.

  24. Inspection checks 1

  25. Inspection checks 2

  26. Stages of static analysis • Control flow analysis. Checks for loops with multiple exit or entry points, finds unreachable code, etc. • Data use analysis. Detects uninitialised variables, variables written twice without an intervening assignment, variables which are declared but never used, etc. • Interface analysis. Checks the consistency of routine and procedure declarations and their use

  27. Stages of static analysis • Information flow analysis. Identifies the dependencies of output variables. Does not detect anomalies itself but highlights information for code inspection or review • Path analysis. Identifies paths through the program and sets out the statements executed in that path. Again, potentially useful in the review process • Both these stages generate vast amounts of information. They must be used with care.

  28. Testing process goals • 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. • 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. The testing phases • 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. • 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. Testing phases

  31. Component testing • Component or unit testing is the process of testing individual components in isolation. • It is a defect testing process. • 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. System testing • Involves integrating components to create a system or sub-system. • May involve testing an increment to be delivered to the customer. • 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. Integration testing • Involves building a system from its components and testing it for problems that arise from component interactions. • Top-down integration • Develop the skeleton of the system and populate it with components. • Bottom-up integration • Integrate infrastructure components then add functional components. • To simplify error localisation, systems should be incrementally integrated.

  34. Incremental integration testing

  35. Interface testing • Objectives are to detect faults due to interface errors or invalid assumptions about interfaces. • Particularly important for object-oriented development as objects are defined by their interfaces.

  36. Interface testing

  37. Interface types • Parameter interfaces • Data passed from one procedure to another. • Shared memory interfaces • Block of memory is shared between procedures or functions. • Procedural interfaces • Sub-system encapsulates a set of procedures to be called by other sub-systems. • Message passing interfaces • Sub-systems request services from other sub-system.s

  38. Interface errors • 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. • Interface misunderstanding • A calling component embeds assumptions about the behaviour of the called component which are incorrect. • Timing errors • The called and the calling component operate at different speeds and out-of-date information is accessed.

  39. Interface testing guidelines • Design tests so that parameters to a called procedure are at the extreme ends of their ranges. • Always test pointer parameters with null pointers. • Design tests which cause the component to fail. • Use stress testing in message passing systems. • In shared memory systems, vary the order in which components are activated.

  40. Performance testing • Part of release testing may involve testing the emergent properties of a system, such as performance and reliability. • Performance tests usually involve planning a series of tests where the load is steadily increased until the system performance becomes unacceptable.

  41. Stress testing • Exercises the system beyond its maximum design load. Stressing the system often causes defects to come to light. • Stressing the system test failure behaviour.. Systems should not fail catastrophically. Stress testing checks for unacceptable loss of service or data. • Stress testing is particularly relevant to distributed systems that can exhibit severe degradation as a network becomes overloaded.

  42. Release testing • The process of testing a release of a system that will be distributed to customers. • Primary goal is to increase the supplier’s confidence that the system meets its requirements. • 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. The Software Testing process

  44. Components of a Test Case • A test case is a multipart artifact with a definite structure • Test case values • Expected results The values that directly satisfy one test requirement The result that will be produced when executing the test if the program satisfies it intended behavior

  45. Test case design • Involves designing the test cases (inputs and outputs) used to test the system. • The goal of test case design is to create a set of tests that are effective in validation and defect testing. • Design approaches: • Black Box Testing: Partition testing; • White Box Testing: • Structural testing. • Criteria based on Structures.

  46. Testing the algorithms Black Box Testing. • Study the algorithms • Programming. • Pre-conditions & Post-Conditionsof each algorithm. • Develop Test Cases. • Develop Oracle. • Run the test. • Record Inputs and Outputs. • Record Invalid Outputs • If invalid Outputs or Execution Errors then: • Debug the program: Finding the fault.

  47. Black-box testing

  48. Testing guidelines • 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. Partition testing • Input data and output results often fall into different classes where all members of a class are related. • Each of these classes is an equivalence partition or domain where the program behaves in an equivalent way for each class member. • Test cases should be chosen from each partition.

  50. Equivalence partitioning Test Data Generation Random Number Generation Valid/ Invalid Output Oracle

More Related