Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

35
Chapter 22 소소소소소 소소소 소소 Software Testing Strategies 소소소 소소소소소 Revised from the slides by Roger S. Pressman and Bruce R. Maxim for the book “Software Engineering: A Practitioner’s Approach, 8/e”

description

Software Testing Testing is the process of exercising a program with the specific intent of finding errors prior to delivery to the end user.

Transcript of Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Page 1: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

임현승강원대학교

Revised from the slides by Roger S. Pressman and Bruce R. Maxim for the book “Software Engineering: A Practitioner’s Approach, 8/e”

Page 2: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Software Testing• Testing is the process of exercising a program with the

specific intent of finding errors prior to delivery to the end user.

2

Page 3: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

What Testing Shows

errorserrors

requirements conformancerequirements conformance

performanceperformance

an indicationan indicationof qualityof quality

3

Page 4: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Strategic Approach• To perform effective testing, you should conduct effective technical reviews. By doing this, many errors will be eliminated before testing commences.

• Testing begins at the component level and works "outward" toward the integration of the entire computer-based system.

• Different testing techniques are appropriate for different software engineering approaches and at different points in time.

• Testing is conducted by the developer of the software and (for large projects) an independent test group.

• Testing and debugging are different activities, but debugging must be accommodated in any testing strategy.

4

Page 5: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Verification and Validation

• Verification refers to the set of tasks that ensure that software correctly implements a specific function.

• Validation refers to a different set of tasks that ensure that the software that has been built is traceable to customer requirements.

• Boehm [Boe81] states this another way: • Verification: "Are we building the product right?" • Validation: "Are we building the right product?"

5

Page 6: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Who Tests the Software?

independent testerMust learn about the system, but will attempt to break it, and is driven by quality

developerUnderstands the system, but will test “gently”,and is driven by ”delivery”

6

Page 7: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Testing Strategy• System engineering -> requirements analysis -> design -> coding -> unit testing (component level) -> integration testing (architecture level) -> validation testing (conformance to requirements) -> system testing

7

Page 8: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Software Testing Steps• We begin by ‘testing-in-the-small’ and move toward ‘testing-in-the-large’

8

Page 9: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Strategic Issues• A software testing strategy will succeed only when software testers:

• Specify product requirements in a quantifiable manner long before testing commences.

• State testing objectives explicitly. • Understand the users of the software and develop a profile for each user category.

• Develop a testing plan that emphasizes “rapid cycle testing.”

• Build “robust” software that is designed to test itself• Use effective technical reviews as a filter prior to testing• Conduct technical reviews to assess the test strategy and test cases themselves.

• Develop a continuous improvement approach for the testing process.

9

Page 10: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Unit Testing• Focuses verification effort on the smallest unit of software design—the software component or module

modulemoduleto beto be

testedtested

test casestest cases

resultsresults

softwaresoftwareengineerengineer

10

Page 11: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Unit Testing

interface interface local data structureslocal data structuresboundary conditionsboundary conditionsindependent pathsindependent pathserror handling pathserror handling paths

modulemoduleto beto betestedtested

test casestest cases

11

Page 12: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Unit Test Environment• Drivers and stubs are testing “overhead” that must be coded but is not delivered with the final product.

ModuleModule

stubstub stubstub

driverdriver

RESULTSRESULTS

interface interface

local data structureslocal data structures

boundary conditionsboundary conditions

independent pathsindependent paths

error handling pathserror handling paths

test casestest cases12

Page 13: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Simple Example using CUnit

int fact (int n) { if (n <= 1) return 1; else return n * fact (n – 1);}

int fact_aux (int n, int acc) { if (n <= 1) return acc; else return fact_tail(n – 1, acc * n);}

int fact_tail (int n) { return fact_aux(n, 1); }

void test_fact_tail (void) { CU_ASSERT(fact_tail(0) == 1); CU_ASSERT(fact_tail(1) == 1); CU_ASSERT(fact_tail(10) == fact(10));}

13

Page 14: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Integration Testing• A systematic technique for constructing the software architecture while conducting tests to uncover errors associated with interfacing.

• Takes unit-tested components and build a program structure.

• The “big bang” approach combine all components and then tests the entire program as a whole.

• In incremental integrationapproaches, the program isconstructed and tested insmall increments, whereerrors are easier to isolateand correct.

14

Page 15: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Top Down Integration• Modules are integrated by moving downward through the control hierarchy, beginning with the main control module (main program).

top module is tested with top module is tested with stubsstubs

stubs are replaced with actual component stubs are replaced with actual component one at a time, in a "depth first" (or "breadth one at a time, in a "depth first" (or "breadth first" ) manner first" ) manner

as new modules are integrated, some subsetas new modules are integrated, some subsetof tests is re-run (regression testing) of tests is re-run (regression testing)

AA

BB

CC

DD EE

FF GG

15

Page 16: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Bottom-Up Integration• Begins construction and testing with atomic modules at the lowest levels in the program structure.

• A driver (a control program for testing) for each cluster is written to coordinate test-case input and output.

drivers are replaced one at a drivers are replaced one at a time, "depth first"time, "depth first"

worker modules are grouped intoworker modules are grouped intoclusters (aka builds) and integrated clusters (aka builds) and integrated

AA

BB

CC

DD EE

FF GG

clustercluster 16

Page 17: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Sandwich Testing

Top modules areTop modules aretested with stubstested with stubs

worker modules are grouped intoworker modules are grouped intoclusters (aka builds) and integrated clusters (aka builds) and integrated

AA

BB

CC

DD EE

FF GG

clustercluster

17

Page 18: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Regression Testing• Regression testing is the re-execution of some subset of tests that have already been conducted to ensure that changes have not propagated unintended side effects

• Whenever software is corrected, some aspect of the software configuration (the program, its documentation, or the data that support it) is changed.

• Regression testing helps to ensure that changes (due to testing or for other reasons) do not introduce unintended behavior or additional errors.

• Regression testing may be conducted manually, by re-executing a subset of all test cases or using automated capture/playback tools.

18

Page 19: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Smoke Testing• A common approach for creating “daily builds” for product software

• Smoke testing steps:• Software components that have been translated into code are integrated into a “build.”

• A build includes all data files, libraries, reusable modules, and engineered components that are required to implement one or more product functions.

• A series of tests is designed to expose errors that will keep the build from properly performing its function.

• The intent should be to uncover “show stopper” errors that have the highest likelihood of throwing the software project behind schedule.

• The build is integrated with other builds and the entire product (in its current form) is smoke tested daily.

• The integration approach may be top down or bottom up.

19

Page 20: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

General Testing Criteria• Interface integrity – internal and external module interfaces are tested as each module or cluster is added to the software

• Functional validity – test to uncover functional defects in the software

• Information content – test for errors in local or global data structures

• Performance – verify that specified performance bounds are tested

20

Page 21: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Object-Oriented Testing• Begins by evaluating the correctness and consistency of the analysis and design models

• Testing strategy changes• he concept of the ‘unit’ broadens due to encapsulation (each class and each instance of a class package data and the operations that manipulate these data)

• integration focuses on classes and their execution across a ‘thread’ (a set of classes that respond to an input or event) or in the context of a usage scenario

• Test case design draws conventional methods, but also encompasses special features (e.g., not advisable to test operations in isolation)

21

Page 22: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

OO Testing Strategy• Class testing is the equivalent of unit testing

• operations within the class are tested• the state behavior of the class is examined

• Integration applied three different strategies• Thread-based testing—integrates the set of classes required to respond to one input or event for the system

• Use-based testing—constructs the system by testing independent classes that use very few (if any) server classes, and then dependent classes in the next layer

• Cluster testing—a cluster of collaborating classes is exercised to uncover errors in the collaborations

22

Page 23: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

High Order Testing• Validation testing—focuses on software requirements• System testing—focuses on system integration• Alpha/Beta testing—focuses on customer usage• Recovery testing—forces the software to fail in a variety of ways and verifies that recovery is properly performed

• Security testing—verifies that protection mechanisms built into a system will, in fact, protect it from improper penetration

• Stress testing— executes a system in a manner that demands resources in abnormal quantity, frequency, or volume

• Performance testing—tests the run-time performance of software within the context of an integrated system

23

Page 24: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Debugging: A Diagnostic Process

• When a test case uncovers an error, debugging is the process that results in the removal of the error.

24

Page 25: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

The Debugging Process

25

Page 26: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Debugging Efforttime required to time required to diagnose the symptom diagnose the symptom and determine the causeand determine the cause

time required to time required to correct the errorcorrect the errorand conductand conductregression testsregression tests

26

Page 27: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Symptoms and Causes• symptom and cause may be geographically separated (e.g., highly-coupled components)

• symptom may disappear (temporarily) when another problem is fixed

• cause may be due to a combination of non-errors (e.g., round-off inaccuracies)

• cause may be due to a system or compiler error

• cause may be due to assumptions that everyone believes

• symptom may be intermittent (e.g., concurrent systems)

symptomsymptomcausecause

27

Page 28: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Consequences of Bugs

• Bug Categories: function-related bugs, system-related bugs, data bugs, coding bugs, design bugs, documentation bugs, standards violations, etc.

Damage

mild annoying

disturbingserious

extremecatastrophic

infectious

Bug Type

28

Page 29: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Debugging Techniques• Brute force / testing

• Most common but least efficient—memory dumps are taken, run-time traces are invoked, and the program is loaded with output statements (e.g., printf)

• Backtracking• Fairly common, can be used successfully in small programs—beginning at the site where a symptom has been uncovered, the source code is traced backward (manually) until the cause is found.

• Cause elimination• Data related to the error occurrence are organized to isolated potential causes. A “cause hypothesis” is devised and the aforementioned data are used to prove or disprove the hypothesis.

29

Page 30: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Correcting the Error• Ask the following questions before making the “correction”

• Is the cause of the bug reproduced in another part of the program? In many situations, a program defect is caused by an erroneous pattern of logic that may be reproduced elsewhere.

• What "next bug" might be introduced by the fix I'm about to make? Before the correction is made, the source code (or, better, the design) should be evaluated to assess coupling of logic and data structures.

• What could we have done to prevent this bug in the first place? This question is the first step toward establishing a statistical software quality assurance approach. If you correct the process as well as the product, the bug will be removed from the current program and may be eliminated from all future programs.

30

Page 31: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Final Thoughts• Think—before you act to correct• Use tools to gain additional insight• If you’re at an impasse, get help from someone else• Once you correct the bug, use regression testing to uncover any unintended side effects

31

Page 32: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

Backup Slides

32

Page 33: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

WebApp Testing - I• The content model for the WebApp is reviewed to uncover errors.

• The interface model is reviewed to ensure that all use cases can be accommodated.

• The design model for the WebApp is reviewed to uncover navigation errors.

• The user interface is tested to uncover errors in presentation and/or navigation mechanics.

• Each functional component is unit tested.

33

Page 34: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

WebApp Testing - II• Navigation throughout the architecture is tested. • The WebApp is implemented in a variety of different environmental configurations and is tested for compatibility with each configuration.

• Security tests are conducted in an attempt to exploit vulnerabilities in the WebApp or within its environment.

• Performance tests are conducted.• The WebApp is tested by a controlled and monitored population of end users. The results of their interaction with the system are evaluated for content and navigation errors, usability concerns, compatibility concerns, and WebApp reliability and performance.

34

Page 35: Chapter 22 소프트웨어 테스팅 전략 Software Testing Strategies

MobileApp Testing• User experience testing – ensuring app meets stakeholder usability and accessibility expectations

• Device compatibility testing – testing on multiple devices• Performance testing – testing non-functional requirements

• Connectivity testing – testing ability of app to connect any needed networks or Web services reliably

• Security testing – ensuring app meets stakeholder security expectations

• Testing-in-the-wild – testing app on user devices in actual user environments

• Certification testing – ensuring app meets the standards established by the app stores that will distribute it

35