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

Similar documents
Aerospace Software Engineering

Introduction to Software Engineering

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

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

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

Lecture 15 Software Testing

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

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

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

Lecture 14: Chapter 18!

Verification and Validation

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

MTAT : Software Testing

Software Testing. Software Testing

Part 5. Verification and Validation

Software Engineering Software Testing Techniques

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

Darshan Institute of Engineering & Technology for Diploma Studies

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

Verification and Validation

Verification and Validation

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

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

Testing. Unit, integration, regression, validation, system. OO Testing techniques Application of traditional techniques to OO software

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

MTAT : Software Testing

Darshan Institute of Engineering & Technology Unit : 9

Chapter 14 Testing Tactics

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

MTAT : Software Testing

QUIZ #5 - Solutions (5pts each)

Verification and Validation

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

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

Software Testing. Software Testing. in the textbook. Chapter 8. Verification and Validation. Verification and Validation: Goals

Chapter 8 Software Testing. Chapter 8 Software testing

MTAT : Software Testing

Learning outcomes. Systems Engineering. Debugging Process. Debugging Process. Review

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

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

Verification and Validation. Verification and validation

SFWR ENG 3S03: Software Testing

The Fundamental Testing Process in Practical or Company environment

Sample Question Paper. Software Testing (ETIT 414)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS SOFTWARE ENGINEERING

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

MTAT : Software Testing

Objectives. Chapter 19. Verification vs. validation. Topics covered. Static and dynamic verification. The V&V process

Verification and Validation

Test design techniques

People tell me that testing is

An Introduction to Systematic Software Testing. Robert France CSU

Testing & Debugging TB-1

Chapter 10. Testing and Quality Assurance

International Journal of Engineering Research ISSN: & Management Technology

Topics in Software Testing

The testing process. Component testing. System testing

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

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

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

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

All the subjective part of 2011 papers solved complete reference numbers

Write perfect C code to solve the three problems below.

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

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

Software Testing. Massimo Felici IF

Software Engineering Fall 2014

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

ΗΜΥ 317 Τεχνολογία Υπολογισμού

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

Computer Science and Software Engineering University of Wisconsin - Platteville 9-Software Testing, Verification and Validation

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

Chapter 14 Software Testing Techniques

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

Program Correctness and Efficiency. Chapter 2

Importance of Predicatebased. Predicate-based Testing. Terms Defined. Terms Defined (2) Terms Defined (3) Assumptions. Thorough testing of C used to

Chapter 11, Testing. Using UML, Patterns, and Java. Object-Oriented Software Engineering

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

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

Chapter 9. Software Testing

UNIT 1-SOFTWARE PROCESS AND PROJECT MANAGEMENT

[IT6004-SOFTWARE TESTING] UNIT 2

Software Testing Strategies. Slides copyright 1996, 2001, 2005, 2009, 2014 by Roger S. Pressman. For non-profit educational use only

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

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

Software Engineering (CSC 4350/6350) Rao Casturi

Part I: Preliminaries 24

INTRODUCTION TO SOFTWARE ENGINEERING

CS159. Nathan Sprague. September 30, 2015

Improving Software Testability

Testing: Test design and testing process

Verification Various Testing Techniques

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

Chap 2. Introduction to Software Testing

INTRODUCTION TO SOFTWARE ENGINEERING

Ingegneria del Software II academic year: Course Web-site: [

What is Structural Testing?

UNIT-4 Black Box & White Box Testing

CS6403 SOFTWARE ENGINEERING Year / Sem : II / IV Sub. Code &Subject : CS6403 SOFTWARE ENGINEERING QUESTION BANKWITH ANSWERS

PESIT Bangalore South Campus SOLUTION

Transcription:

Lecture 26: Testing Software Engineering ITCS 3155 Fall 2008 Dr. Jamie Payton Department of Computer Science University of North Carolina at Charlotte Dec. 9, 2008

Verification vs validation Verification: Are we building the product right? The software should conform to its specification Validation: Are we building the right product? The software should do what the user really requires 2

The V&V Process V & V must be applied at each stage in the software process Two principal objectives: Discover defects in a system Assess whether or not the system is useful and useable in an operational situation 3

V&V Goals Verification and validation should establish confidence that the software is fit for purpose This does NOT mean completely free of defects Not an exhaustive process Making an exhaustive determination is impossible Rather, software must be good enough for its intended use 4

V & V Confidence How good is good enough? Depends on system s purpose, user expectations, and marketing environment Software function The level of confidence depends on how critical the software is to an organization User expectations Users may have low expectations of certain kinds of software Marketing environment Getting a product to market early may be more important than finding defects in the program 5

Static and Dynamic Verification Two complementary approaches to system checking and analysis: Software inspections A form of static verification Analysis of static system representation to discover problems Software testing A form of dynamic verification Exercising and observing product behavior 6

Testing Strategy First: Unit testing Test individual software units in isolation Second: Integration testing Focus is on design and construction of the architecture Third: Validation testing Focus is on user-visible actions and output from system to determine if requirements are satisfied Finally: System testing Entire software system is tested as a whole 7

Unit Testing Unit testing Idea: Test individual software units (components, modules) in isolation Tests usually exercise important paths in the control structure Tests focus on internal logic and data structures of unit Test case design Should design test cases to discover errors due to: Erroneous computations Incorrect comparisons Improper control flow Boundary testing! n th time through the loop Min/max element accessed in the array Min/max allowable value assigned to variable Often performed by developer 8

Integration Testing Best practice: incremental integration Program is constructed and tested in small increments Incremental testing approaches Top-down Integrate modules by moving downward through control hierarchy Depth-first Breadth-first Higher level modules are used as drivers, must write stubs Bottom up Begins construction and testing with atomic modules Must write higher-level drivers Regression testing after each integration 9

Test Characteristics A good test: Has a high probability of finding an error Test classes designed around ideas on how software might fail Is not redundant Test classes test for different errors Is the best of breed Choose the best test out of similar ones Is not too simple or too complex Combining tests can save time, effort Combining tests can create side effects that mask errors 10

Testing Approaches White-box testing Uses knowledge about the internals of the program to create tests and test data Tests demonstrate each function is fully operational and error-free Black-box testing No knowledge of internals (control flow, data structure) Tests are constructed using only the interface 11

White Box Testing Can derive test cases that: Guarantee that all independent paths have been exercised Exercise all logical decisions on true and false sides Execute loops at their boundaries and within bounds Exercise internal data structures to ensure validity Techniques Basis path testing Control structure testing 12

Basis Path Testing 1. Create a flow graph that depicts logical flow of control 2. Determine cyclomatic complexity of flow graph Provides a quantitative measure of the logical complexity of a program 3. Determine basis set of linearly independent paths 4. Prepare test cases that force execution of each path in basis set 13

Flow Graph Depicts logical control flow Node represents a statement Predicate nodes represent conditionals Will have two or more outgoing edges Not every node with two outgoing edges is a predicate node Compound predicates may be broken up into two nodes Edge represents flow of control Areas bounded by edges and nodes are called regions Flowchart 11 6 6 7 8 9 7 8 R3 1 2,3 1 2 3 R2 4 5 10 4,5 R1 Flowgraph 9 10 R4 11 14

Finding Independent Paths Independent path Any path that introduces at least one new set of processing statements or condition In flow graph: Moves along an edge that has not been traversed before path was defined Basis set Set of paths that covers every statement in the 1 program Example independent paths: 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 Flowgraph 6 7 8 11 9 2,3 10 4,5 15

Determining Basis Set How do we know when we ve found all the paths? Cyclomatic complexity Defines number of independent paths in the basis set Provides upper bound on number of tests Approaches to computing cyclomatic complexity Number of regions corresponds to cyclomatic complexity V(G) = E N + 2 V(G) = P + 1 Where P is the number of predicate nodes 16

Cyclomatic Complexity Approaches to computing cyclomatic complexity Number of regions corresponds to cyclomatic complexity V(G) = E N + 2 V(G) = P + 1 Where P is the number of predicate nodes 6 7 8 R3 1 2,3 R2 4,5 R1 9 10 R4 11 17

Creating Basis Path Test Cases Choose data to set conditions at predicate nodes to test each path in basis set Each test case is executed and results are compared to expected results 18

White Box Testing Can derive test cases that: Guarantee that all independent paths have been exercised Exercise all logical decisions on true and false sides Execute loops at their boundaries and within bounds Exercise internal data structures to ensure validity Techniques Basis path testing Control structure testing 19

Control Structure Testing General techniques Condition testing Exercises each logical condition in the program Data flow testing Selects tests according to the location of definitions and uses of variables Loop testing Focuses on validity of loop constructs 20

Condition testing Testing conditional statements in program Use to find condition components that may be incorrect Boolean operator Boolean variable errors Boolean parenthesis errors Relational operator errors Arithmetic expression errors 21

Data Flow Testing Selects tests according to the location of definitions and uses of variables Each statement is numbered For each statement s, define: DEF(s) = {x s contains a definition of x} USE(s) = {x s contains a use of x} Definition use chain for variable x : [x, s, x ] X in def(s) and use(s ) Strategy Cover every definition use chain for every variable Limitation: does not necessarily cover all branches 22

Loop Testing Different testing approaches defined for different types of loops Simple loops Skip the loop entirely Only one pass through Two passes through m passes through, m< n n-1, n, n+1 passes through Nested loops Concatenated loops Unstructured loops 23

Loop Testing Different testing approaches defined for different types of loops Nested loops Start at innermost loop. Set all other loops to minimum values Conduct simple loop test for innermost loop Work outward, conducting tests for the next loop Continue until all loops have been tested Concatenated loops If independent, use approach for simple loops Otherwise, use approach for nested loops Unstructured loops Don t test redesign! 24

Testing Approaches White-box testing Uses knowledge about the internals of the program to create tests and test data Tests demonstrate each function is fully operational and error-free Black-box testing No knowledge of internals (control flow, data structure) Tests are constructed using only the interface 25

Black Box Testing Focuses on functional requirements No knowledge of internals (control flow, data structure) Tests are constructed using only the interface Complementary to white-box testing Attempts to find errors due to: Incorrect/missing functions Interface errors Errors in data structures or external database access Behavior or performance errors Initialization and termination errors 26

Black Box Testing Techniques Graph-based testing methods Creates a graph of important objects and relationships Devising set of tests that cover paths through graph Equivalence partitioning Divides input domain into classes of data to derive test cases Ideal test case covers entire class Boundary value analysis Selects test cases at edges of equivalence classes 27

Equivalence 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 program behaves in equivalent way for each member Test cases should be chosen from each partition 28

Binary Search Equivalence Classes Sequence Single value Single value More than 1 value More than 1 value More than 1 value More than 1 value Element In sequence Not in sequence First element in sequence Last element in sequence Middle element in sequence Not in sequence 29

Structuring a Software Test Plan Elements of a test plan Testing process Requirements traceability Tested items Testing schedule Test recording procedures Hardware and software requirements Constraints 30