Software Testing Fundamentals. Software Testing Techniques. Information Flow in Testing. Testing Objectives

Similar documents
Introduction to Software Engineering

Software Engineering Software Testing Techniques

Lecture 26: Testing. Software Engineering ITCS 3155 Fall Dr. Jamie Payton

Aerospace Software Engineering

Darshan Institute of Engineering & Technology Unit : 9

SOFTWARE ENGINEERING IT 0301 Semester V B.Nithya,G.Lakshmi Priya Asst Professor SRM University, Kattankulathur

Chapter 14 Testing Tactics

SE Notes Mr. D. K. Bhawnani, Lect (CSE) BIT

UNIT-4 Black Box & White Box Testing

UNIT-4 Black Box & White Box Testing

Lecture 14: Chapter 18!

Software Testing. Minsoo Ryu. Hanyang University. Real-Time Computing and Communications Lab., Hanyang University

! Is often referred to as verification and validation (V&V).

MTAT : Software Testing

Darshan Institute of Engineering & Technology for Diploma Studies

CS 451 Software Engineering Winter 2009

Verification and Validation

INTRODUCTION TO SOFTWARE ENGINEERING

Software Quality Assurance. David Janzen

Chapter 14 Software Testing Techniques

MTAT : Software Testing

MTAT : Software Testing

In this Lecture you will Learn: Testing in Software Development Process. What is Software Testing. Static Testing vs.

What is Structural Testing?

CS 4387/5387 SOFTWARE V&V LECTURE 4 BLACK-BOX TESTING

MTAT : Software Testing

MTAT : Software Testing

LECTURE 9 TEST DESIGN TECHNIQUES - II

Chapter 9. Software Testing

Software Testing. Lecturer: Sebastian Coope Ashton Building, Room G.18

Question 1: What is a code walk-through, and how is it performed?

Software Testing. 1. Testing is the process of demonstrating that errors are not present.

LECTURE 11 TEST DESIGN TECHNIQUES IV

Verification and Validation. Verification and validation

CS 520 Theory and Practice of Software Engineering Fall 2018

VETRI VINAYAHA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Topic: Software Verification, Validation and Testing Software Engineering. Faculty of Computing Universiti Teknologi Malaysia

Software Testing. Software Testing

Functional Testing (Black Box Testing)

Software Testing part II (white box) Lecturer: Giuseppe Santucci

linaye/gl.html

Testing! Prof. Leon Osterweil! CS 520/620! Spring 2013!

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS SOFTWARE ENGINEERING

Program Correctness and Efficiency. Chapter 2

Software Testing Prof. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur. Lecture 13 Path Testing

Equivalence Class Partitioning and Boundary Value Analysis -Black Box Testing Techniques

Topics in Software Testing

Software Testing for Developer Development Testing. Duvan Luong, Ph.D. Operational Excellence Networks

Lecture 20: SW Testing Presented by: Mohammad El-Ramly, PhD

Lecture 15 Software Testing

Verification and Validation. Assuring that a software system meets a user s needs. Verification vs Validation. The V & V Process

Linköping University, Sweden Last Modified 13 June 2011 Peter Bunus

Verification and Validation. Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 22 Slide 1

Sample Exam Syllabus

Introduction to Software Testing Chapter 5.1 Syntax-based Testing

Examination Questions Time allowed: 1 hour 15 minutes

MSc Software Testing and Maintenance MSc Prófun og viðhald hugbúnaðar

White-Box Testing Techniques

ABSTRACT I. INTRODUCTION

Overview. State-of-the-Art. Relative cost of error correction. CS 619 Introduction to OO Design and Development. Testing.

Feasibility of Testing to Code. Feasibility of Testing to Code. Feasibility of Testing to Code. Feasibility of Testing to Code (contd)

Chapter 7 Control Statements Continued

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Unit Testing. Emina Torlak

10. Software Testing Fundamental Concepts

Recap on SDLC Phases & Artefacts. Topic: Software Verification, Validation and Testing Software Engineering

Applying Reliability Engineering to Expert Systems*

Coding and Unit Testing! The Coding Phase! Coding vs. Code! Coding! Overall Coding Language Trends!

Second assignment came out Monday evening. Find defects in Hnefetafl rules written by your classmates. Topic: Code Inspection and Testing

1 Visible deviation from the specification or expected behavior for end-user is called: a) an error b) a fault c) a failure d) a defect e) a mistake

People tell me that testing is

Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn. 4. Testing

Facts About Testing. Cost/benefit. Reveal faults. Bottom-up. Testing takes more than 50% of the total cost of software development

International Journal of Engineering Research ISSN: & Management Technology

QUIZ #5 - Solutions (5pts each)

What s Next INF 117 Project in Software Engineering

Sample Question Paper. Software Testing (ETIT 414)

Testing. Jessica Young Schmidt, Northeastern University College of Computer and Information Science

MSc Software Testing MSc Prófun hugbúnaðar

The testing process. Component testing. System testing

Testing Theory. Agenda - What will you learn today? A Software Life-cycle Model Which part will we talk about today? Theory Lecture Plan

Software testing. Ian Sommerville 2006 Software Engineering, 8th edition. Chapter 23 Slide 1

Literature. CHAPTER 5 Testing. When to Test? The Unified Process. When to Test?

Black Box Testing (revisited) Csci 565 Spring 2007

Verification Overview Testing Theory and Principles Testing in Practice. Verification. Miaoqing Huang University of Arkansas 1 / 80

Testing & Debugging TB-1

Test design: Part I. Software Testing: INF3121 / INF4121

Integrating the classification tree method with combinatorial testing: test selection strategy

Software Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm. Rao Casturi 11/10/2015

SOFTWARE ENGINEERING SOFTWARE VERIFICATION AND VALIDATION. Saulius Ragaišis.

Code Coverage Metrics And How to Use Them

Chapter 8 Software Testing. Chapter 8 Software testing

Abha Khandelwal Dept. of Computer Science, Hislop College, RTM Nagpur University, Nagpur, Maharashtra, India

Chapter 10. Testing and Quality Assurance

Software Engineering Fall 2014

Basic Concepts of Reliability

SFWR ENG 3S03: Software Testing

Module 3: New types of data

INTRODUCTION TO SOFTWARE ENGINEERING

No Source Code. EEC 521: Software Engineering. Specification-Based Testing. Advantages

White-Box Testing Techniques III

Transcription:

Software Testing Fundamentals Software Testing Techniques Peter Lo Software Testing is a critical element of software quality assurance and represents the ultimate review of specification, design and coding. It concerned with the actively identifying errors in software CS213 Peter Lo 2005 1 CS213 Peter Lo 2005 2 Testing Objectives Information Flow in Testing Testing is a process of executing a program with the intent of finding an error A good test case is one that has a high probability of finding an as yet undiscovered error. A successful test is one that uncovers an as yet undiscovered error. CS213 Peter Lo 2005 3 CS213 Peter Lo 2005 4

Information Flow in Testing Two classes of input are provided to the test process: A Software Configuration: includes a Software Requirements Specification, a Design Specification, and source code. A Test Configuration: includes a Test Plan and Procedure, any testing tools that are to be used, and test cases and their expected results. Attributes of a Good Test A good test has a high probability of finding an error. The tester must understand the software and attempt to develop a mental picture of how the software might fail. A good test is not redundant. Testing time and resources are limited. There is no point in conducting a test that has the same purpose as another test. A good test should be neither too simple nor too complex. Side effect of attempting to combine a series of tests into one test case is that this approach may mask errors. CS213 Peter Lo 2005 5 CS213 Peter Lo 2005 6 White Box Testing White box testing is a test case design method that uses the control structure of the procedural design to derive test cases. Benefit of White Box Testing Using white box testing methods, the software engineer can derive test cases that: Guarantee that all independent paths within a module have been exercised at least once; Exercise all logical decisions on their true or false sides; Execute all loops at their boundaries and within their operational bounds ; and Exercise internal data structures to ensure their validity. CS213 Peter Lo 2005 7 CS213 Peter Lo 2005 8

Process of White Box Testing Process of White Box Testing Tests are derived from an examination of the source code for the modules of the program. These are fed as input to the implementation, and the execution traces are used to determine if there is sufficient coverage of the program source code CS213 Peter Lo 2005 9 CS213 Peter Lo 2005 10 Reasons to Test the Program Logic Logic errors and incorrect assumptions are inversely proportional to the probability that a program path will evaluated Misconceptions that a logical path is unlikely to be executed when, in fact, it may be executed on a regular basis. Typographical errors are random. Basis Path Testing This testing technique makes use of simple flow graph notation. CS213 Peter Lo 2005 11 CS213 Peter Lo 2005 12

Basis Path Testing Basis Path Testing is a white box testing techniques proposed by Tom McCabe. Enables that test case designer to derive a logical complexity measure of a procedural design and use this measure as a guide for defining a basis set of execution paths. Test cases derived to exercise the basis set are guaranteed to execute every statement in the program at least one time during testing. Basis Path Testing The basis path testing can be applied as a series of steps: Using the design or code as foundation, draw a corresponding flow graph. Determine the cyclomatic complexity of the resultant flow graph. Determine a basis set of linearly independent paths. Prepare test cases that will force execution of each path in the basis set. CS213 Peter Lo 2005 13 CS213 Peter Lo 2005 14 Cyclomatic Complexity V(G) Example Cyclomatic Complexity V(G) is a software metric that provides a quantitative measure of the logical complexity of a program. Complexity can be computed in one of several ways: V(G) = Number of regions of the flow graph V(G) = E N + 2; where E is the number of flow graph edges and N is the number of flow graph nodes. V(G) = P + 1 where P is the number of predicate nodes contained in the flow graph G. Predicate notes are characterized by two or more edges emanating from it. CS213 Peter Lo 2005 15 CS213 Peter Lo 2005 16

Answer: Graph Answer: V(G) Calculation The flow has 4 regions (marked as R1, R2, R3 and R4); hence V(G) = 4 V(G) = E - N + 2 = 11 edges - 9 nodes + 2 = 4 V(G) = P + 1 = 3 Predicate Notes + 1 = 4 (Predicate nodes are: node (2,3), node (1), and node (6). CS213 Peter Lo 2005 17 CS213 Peter Lo 2005 18 Answer: Independent Path Thus, the value of V(G) provides us with an upper bound for the number of independent paths...(etc...) The set of independent paths are: Path 1: 1-11 Path 2: 1-2-3-4-5-10-1-11 Path 3: 1-2-3-6-8-9-10-1-11 Path 4: 1-2-3-6-7-9-10-1-11 Condition Testing Simple condition is a Boolean variable or relational expression Condition testing is a test case design method that exercises the logical conditions contained in a program module, and therefore focuses on testing each condition in the program. CS213 Peter Lo 2005 19 CS213 Peter Lo 2005 20

Data Flow Testing The Data flow testing method selects test paths of a program according to the locations of definitions and uses of variables in the program Loop Testing Loop testing is a white-box testing technique that focuses exclusively on the validity of loop constructs Four classes of loops: 1. Simple loops 2. Concatenated loops 3. Nested loops 4. Unstructured loops CS213 Peter Lo 2005 21 CS213 Peter Lo 2005 22 Loop Testing Test Cases for Simple Loops Where n is the maximum number of allowable passes through the loop: Skip the loop entirely Only one pass through the loop Two passes through the loop m passes through the loop where m < n n-1, n, n+1 passes through the loop CS213 Peter Lo 2005 23 CS213 Peter Lo 2005 24

Test Cases for Nested Loops Test Cases for Concatenated Loops 1) Start at the innermost loops. Set all other loops to minimum values 2) Conduct simple loop tests for the innermost loop while holding the outer loops at their minimum iteration parameter values. Add other tests for out-of -range or excluded values 3) Work outward, conducting tests for the next loop but keeping all other outer loops at minimum values and other nested loops to "typical" values 4) Continue until all loops have been tested If each of the loops is independent of the others, perform simple loop tests for each loop If the loops are dependent, apply the nested loop tests CS213 Peter Lo 2005 25 CS213 Peter Lo 2005 26 Test Cases for Unstructured Loops Whenever possible, redesign this class of loops to reflect the structured programming constructs Black Box Testing Black box testing methods focus on the functional requirements of the software, i.e. derives sets of input conditions that will fully exercise all functional requirements for a program. Black box or functional testing is based upon the specification of a module rather than the implementation of the module. Determines whether the required functionality is present, but since it is independent of the actual program code it cannot test parts of the program that are not covered by the specification. CS213 Peter Lo 2005 27 CS213 Peter Lo 2005 28

Black Box Testing Black box testing attempts to find errors in the following categories: Incorrect or missing functions Interface errors Errors in data structures or external databases access Performance errors Initialization and termination errors. Black Box Test Cases Test cases need to satisfy the following criteria: Test cases that reduce, by a count that is greater than 1, the number of additional test cases that must be designed to achieve reasonable testing; and Tests cases that tell us something about the presence or absence of classes of errors, rather than an error associated only with the specific test at hand. CS213 Peter Lo 2005 29 CS213 Peter Lo 2005 30 Black Box Testing Equivalence Partitioning Divides the input domain of a program into classes of data. Strives to define a test case that uncovers classes of errors Equivalence classes may be defined according to the following guidelines: If an input condition specifies a range, one valid and two invalid equivalence classes are defined. If an input condition requires a specific value, one valid and two invalid equivalence classes are defined. If an input condition specifies a member of a set, one valid and one invalid class are defined If an input condition is Boolean, one valid and one invalid class are defined CS213 Peter Lo 2005 31 CS213 Peter Lo 2005 32

Equivalence Partitioning Input Data variable is Employment Age, as used in a company database system. Employment age is defined as an integer variable, and has an acceptable range of 16 to 65 (years old). Since this is a range, there will be one valid, and two invalid equivalence classes. The Valid Class: Employment age = from 16 to 65, inclusive. An example of a test case falling into this class would be Employment age = 30. The First Invalid Class: Employment age < 16. An example of a test case falling into this class would be Employment age = 10. The Second Invalid Class: Employment age > 65. An example of a test case falling into this class would be Employment age = 80. Boundary Value Analysis Boundary value analysis (BVA) select test cases at the "edges", and thus exercises bounding values. BVA leads to the selection of test cases at the edges of the class. CS213 Peter Lo 2005 33 CS213 Peter Lo 2005 34 Boundary Value Analysis Guidelines of designing test cases If an input condition specifies a range bounded by values a and b, test cases should be designed with values a and b, just above and below a and b, respectively If an input condition specifies a number of values, test cases should be developed that exercise the minimum and maximum numbers. Values just above and below minimum and maximum are also tested. Boundary Value Analysis Input Data variable is Employment Age, as used in a company database system. Employment age is defined as an integer variable, and has an acceptable range of 16 to 65 (years old). The two edges are 16 and 65. Hence, the six test cases would be: Employment Age = 15, 16, 17, and 64, 65, and 66. CS213 Peter Lo 2005 35 CS213 Peter Lo 2005 36

Comparison Testing Used when the reliability of software is absolutely critical. Multiple and independent versions of software is developed for critical applications, even when only a single version will be used in the delivered computer-based system Each version is tested with the same test data to ensure that all provide identical output. Comparison Testing All the versions are executed in parallel with a real-time comparison of results to ensure consistency. If the output from each version is the same, then it is assumed that all implementations are correct. If the output is different, each of the applications is investigated to determine if a defect in one or more versions is responsible for the difference. CS213 Peter Lo 2005 37 CS213 Peter Lo 2005 38 Automated Testing Tools Code auditors Assertion processors Test file generators Test data generators Test verifiers Output comparators Code Auditors These special-purpose filters are used to check the quality of software to ensure that it meets minimum coding standards. CS213 Peter Lo 2005 39 CS213 Peter Lo 2005 40

Assertion Processors These pre-processors / postprocessors systems are employed to tell whether programmer-supplied claims, called assertions, about a program's behavior are actually met during real program executions. Test File Generators These processors generate, and fill with predetermined values, typical input files for programs that are undergoing testing. CS213 Peter Lo 2005 41 CS213 Peter Lo 2005 42 Test Data Generators These automated analysis systems assist a user in selecting test data that make a program behave in a particular fashion. Test Verifiers These tools measure internal test coverage, often expressed in terms that are related to the control structure of the test object, and report the coverage value to the quality assurance expert CS213 Peter Lo 2005 43 CS213 Peter Lo 2005 44

Output Comparators This tool makes it possible to compare one set of outputs from a program with another (previously archived) set to determine the difference between them. Basis Path Testing: An Exercise 1. While (x>0) and (data <> 0) do 2. if (x>5) then 3. y = x + 3 4. else 5. y = 5 6. endif 7. x = x - 1 8. data = data - 1 9. end While 10. If data = 0 then 11. write ( Goodbye ) 12. else 13. write ( Error ) 14. endif 15. write ( End of Program ) CS213 Peter Lo 2005 45 CS213 Peter Lo 2005 46 Basis Path Testing: An Exercise Carefully consider the pseudo-code above, and draw the corresponding Flow Graph. In your answer, also indicate the pseudo-code statement that each node is representing. Calculate the value of Cyclomatic Complexity V(G). Calculate this number using the Number of Regions method. Using the Cyclomatic Complexity, design a set of test cases that will adequately test the entire program. CS213 Peter Lo 2005 47