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

Similar documents
Software Testing. Testing: Our Experiences

MONIKA HEINER.

Software Testing. Software Testing

MTAT : Software Testing

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

Lecture 15 Software Testing

Why testing and analysis. Software Testing. A framework for software testing. Outline. Software Qualities. Dependability Properties

Introduction to Dynamic Analysis

Testing & Debugging TB-1

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

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

Subject Software Testing Structural Testing

Structural Testing. (c) 2007 Mauro Pezzè & Michal Young Ch 12, slide 1

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

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

Software Quality Assurance. David Janzen

Part I: Preliminaries 24

Aerospace Software Engineering

Program Analysis. Program Analysis

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

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

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

Chapter 8 Software Testing. Chapter 8 Software testing

Terminology. There are many different types of errors and different ways how we can deal with them.

Introduction to 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 10. Testing and Quality Assurance

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

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements

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

Chapter 9 Quality and Change Management

Darshan Institute of Engineering & Technology for Diploma Studies

Pearson Education 2007 Chapter 9 (RASD 3/e)

An Introduction to Systematic Software Testing. Robert France CSU

CS 520 Theory and Practice of Software Engineering Fall 2018

Quality Assurance = Testing? SOFTWARE QUALITY ASSURANCE. Meaning of Quality. How would you define software quality? Common Measures.

Verification and Validation. Verification and validation

Software Testing Interview Question and Answer

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

Testing is executing a system in order to identify any gaps, errors, or missing requirements in contrary to the actual requirements.

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

XVIII. Software Testing. Laurea Triennale in Informatica Corso di Ingegneria del Software I A.A. 2006/2007 Andrea Polini

Integration Testing. Conrad Hughes School of Informatics. Slides thanks to Stuart Anderson

Testing & Symbolic Execution

Testing: Test design and testing process

Testing! The material for this lecture is drawn, in part, from! The Practice of Programming (Kernighan & Pike) Chapter 6!

Testing! The material for this lecture is drawn, in part, from! The Practice of Programming (Kernighan & Pike) Chapter 6!

Software Testing TEST CASE SELECTION AND ADEQUECY TEST EXECUTION

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

MTAT : Software Testing

Testing Role in Unified Approach Coverage: Structural/Coverage Model Based Test Generation from Model Checking (project) Interaction of

Testing. CMSC 433 Programming Language Technologies and Paradigms Spring A Real Testing Example. Example (Black Box)?

Topics in Software Testing

Using the code to measure test adequacy (and derive test cases) Structural Testing

Integration Testing. Unit Test vs Integration Testing 1. Unit Testing vs Integration Testing 2. Unit testing: isolation, stub/mock objects

Written exam TDDD04 Software Testing

Program Verification! Goals of this Lecture! Words from the Wise! Testing!

Verification Black-box Testing & Testing in the Large

Part 5. Verification and Validation

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

Software Engineering (CSC 4350/6350) Rao Casturi

Combining Complementary Formal Verification Strategies to Improve Performance and Accuracy

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

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

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

Testing, Fuzzing, & Symbolic Execution

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

10. Software Testing Fundamental Concepts

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

Quality Assurance in Software Development

(See related materials in textbook.) CSE 435: Software Engineering (slides adapted from Ghezzi et al & Stirewalt

Software Engineering Fall 2014

Object-Oriented Software Engineering Conquering Complex and Changing Systems. Chapter 9, Testing

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

Examination Questions Time allowed: 1 hour 15 minutes

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

Testing: Coverage and Structural Coverage

Sample Exam Syllabus

Chapter 9. Software Testing

Verification and Validation

Software Testing. Massimo Felici IF

Manuel Oriol, CHCRC-C, Software Testing ABB

Ingegneria del Software Corso di Laurea in Informatica per il Management

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

Verification and Validation

Verification and Validation

Bridge Course On Software Testing

Software Engineering 2 A practical course in software engineering. Ekkart Kindler

QUIZ #5 - Solutions (5pts each)

[IT6004-SOFTWARE TESTING] UNIT 2

Chap 2. Introduction to Software Testing

Testing. Outline. What is this? Terminology. Erroneous State ( Error ) Algorithmic Fault

Test Oracles and Mutation Testing. CSCE Lecture 23-11/18/2015

TDDD04: Integration and System level testing. Lena Buffoni

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

It is primarily checking of the code and/or manually reviewing the code or document to find errors This type of testing can be used by the developer

Darshan Institute of Engineering & Technology Unit : 9

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

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

STRUCTURAL TESTING. AKA White Box Testing. Thanks go to Andreas Zeller for allowing incorporation of his materials. F. Tip and M.

Transcription:

Reveal faults Goals of testing Correctness Reliability Usability Robustness Performance Top-down/Bottom-up Bottom-up Lowest level modules tested first Don t depend on any other modules Driver Auxiliary code that calls the module Top-down Executive module tested first Stub Auxiliary code that simulates the results of a routine Facts About Testing Question does program P obey specification S is undecidable! Every testing technique embodies some compromise between accuracy and computational cost Facts Inaccuracy is not a limitation of the technique It is theoretically impossible to devise a completely accurate technique Every practical technique must sacrifice accuracy in some way Cost/benefit Testing takes more than 50% of the total cost of software development More for critical software Software quality will become the dominant success criterion 1

Types of Verification Execution-based Verification Non-execution based Verification Discussion Execution-based Verification Generating and executing test cases on the software Types of testing Testing to specifications Black-box testing Testing to code Glass-box (white-box) testing Remember: difference is in generating test cases only! Verification of correctness is usually done via specifications in both cases Black-box Testing Discussion: MAC/ATM machine example Specs Cannot withdraw more than $300 Cannot withdraw more than your account balance Balance Example White-box Testing x: 1..1000; 1 INPUT-FROM-USER(x); If (x <= 300) { 2 INPUT-FROM-FILE(BALANCE); If (x <= BALANCE) 3 GiveMoney x; x Software 4 5 else else Print You don t have $x in your account!! } Print You cannot withdraw more than $300 ; 6 Eject Card; 2

Discussion Which is superior? Neither can be done exhaustively Too many test cases Each technique has its strengths use both Generally, first use black-box Then white-box for missed code Accept that all faults cannot be detected When to stop? Determining Adequacy Statement coverage Statements Branch coverage Both IF and ELSE Path coverage All-def-use-path coverage Philosophy: what does it all mean? Does coverage guarantee absence of faults? Can we always get 100% coverage? Surprise Quiz Determine test cases so that each print statement is executed at least once input(x); if (x < 100) print Line 1 ; else { if (x < 50) print Line 2 else print Line 3 ; } begin if x<100 x>=100 1 x>=100 if x<50 2 3 x>=100 x>=50 Sampling the State Space If (i == j) Do something wrong Else Do the right thing Endif Uniform sampling of the input space Test adequacy criteria Designed to insure behaviors chosen are appropriately distributed to increase the likelihood of revealing errors end 3

Non-execution Based Key idea Review by a team of experts: syntax checker? Code readings Walkthroughs Manual simulation by team leader Inspections Developer narrates the reading Formal verification of correctness Very expensive Justified in critical applications Semi-formal: some assertions JPL Non-execution Based On the average, 2 hour inspection 4 major and 14 minor faults Saved $25,000 per inspection Rate of faults Decreases exponentially by phase Cleanroom approach Incremental development, formal specs and design, readings, inspections Simulation Integration with system hardware is central to the design Model the external hardware Model the interface Examples Discussion Boundary-value Analysis Partition the program domain into input classes Choose test data that lies both inside each input class and at the boundary of each class Select input that causes output at each class boundary and within each class Also known as stress testing 4

Testing Approaches Top-down Bottom-up Big bang Unit testing Integration testing Stubs System testing Glossary Fault An incorrect step, process, or data definition in a computer program Error (ISO) A discrepancy between a computed, observed, or measured value or condition and the true, specified, or theoretically correct value or condition Failure (IEEE) The inability of a system or component to perform its required functions within specified performance requirements Glossary Exception (IEEE) An event that causes suspension of normal program operation. Types include addressing exception, data exception, operation exception, overflow exception, protection exception, underflow exception Anomaly (IEEE) Anything observed in the documentation or operation of software that deviates from expectations based on previously verified software products or reference documents Structural Testing Coverage-based testing Test cases to satisfy statement coverage Or branch coverage, etc Complexity-based testing Cyclomatic complexity Graph representation Find the basis set # Of braches + 1 5

Mutation Testing Errors are introduced in the program to produce mutants Run test suite on all mutants and the original program Test Case Generation Test input to the software Some researchers/authors also define the test case to contain the expected output for the test input Category-partition Method Key idea Method for creating functional test suites Role of test engineer Analyze the system specification Write a series of formal test specifications Automatic generator Produces test descriptions Key idea AI Planning Method Input to command-driven software is a sequence of commands The sequence is like a plan Scenario to test Initial state Goal state 6

Example VCR command-line software Commands Rewind If at the end of tape Play If fully rewound Eject If at the end of tape Load If VCR has no tape Preconditions & Effects Rewind Precondition: if at end of tape Effects: at beginning of tape Play Precondition: if at beginning of tape Effects: at end of tape Eject Precondition: if at end of tape Effects: VCR has no tape Load Precondition: if VCR has no tape Effects: VCR has tape Preconditions & Effects Rewind Precondition: end_of_tape Effects: end_of_tape Play Precondition: end_of_tape Effects: end_of_tape Eject Precondition: end_of_tape Effects: has_tape Load Precondition: has_tape Effects: has_tape Initial and Goal States Initial state end_of_tape Goal state end_of_tape Plan? Rewind 7

Initial and Goal States Initial state end_of_tape & has_tape Goal state has_tape Plan? Play Eject Iterative Relaxation Key idea Path-oriented testing Problem: generation of test data that causes a program to follow a given path Technique Choose arbitrary input Iteratively refine it until all the branch predicates on the given path evaluate to the desired outcome Example Program 0 1 BEGIN read(x,y,z) u=(x-y)*2 0 1 BEGIN read(x,y,z) u=(x-y)*2 input variables x, y, z P1 x>y P1 x>y 2 w=u 3 w=y 2 w=u 3 w=y 4 P2 x=x-2 (w+z)>100 P3 x 2 +z 2 100 (2x-2y+z)>100 4 P2 x=x-2 (w+z)>100 P3 x 2 +z 2 100 5 y=y+w 7 y=x*z+1 5 y=y+w 7 y=x*z+1 6 write( linear ) 8 write( nl:quad ) 6 write( linear ) 8 write( nl:quad ) P4 u>0 P4 u>0 9 write(u) P5 (y-sin(z))>0 9 write(u) P5 (y-sin(z))>0 10 write( nl:sine ) 10 write( nl:sine ) END END 8

Test Coverage & Adequacy How much testing is enough? When to stop testing Test data selection criteria Test data adequacy criteria Stopping rule Degree of adequacy Test coverage criteria Objective measurement of test quality Preliminaries Test data selection What test cases Test data adequacy criteria When to stop testing Examples Statement coverage Branch coverage Def-use coverage Path coverage Goodenough & Gerhart [ 75] What is a software test adequacy criterion Predicate that defines what properties of a program must be exercised to constitute a thorough test, i.e., One whose successful execution implies no errors in a tested program Uses of Test Adequacy Objectives of testing In terms that can be measured For example branch coverage Two levels of testing First as a stopping rule Then as a guideline for additional test cases 9

Categories of Criteria Specification based All-combination criterion Choices Each-choice-used criterion Program based Statement Branch Note that in both the above types, the correctness of the output must be checked against the specifications Others Random testing Statistical testing Classification according to underlying testing approach Structural testing Coverage of a particular set of elements in the structure of the program Fault-based testing Some measurement of the fault detecting ability of test sets Error-based testing Check on some error-prone points Structural Testing Program-based structural testing Control-flow based adequacy criteria Statement coverage Branch coverage Path coverage Length-i path coverage Multiple condition coverage All possible combinations of truth values of predicates Data-flow based adequacy criteria 10

Structural Testing Data-flow based adequacy criteria All definitions criterion Each definition to some reachable use All uses criterion Definition to each reachable use All def-use criterion Each definition to each reachable use Fault-based Adequacy Error seeding Introducing artificial faults to estimate the actual number of faults Program mutation testing Distinguishing between original and mutants Competent programmer assumption Mutants are close to the program Coupling effect assumption Simple and complex errors are coupled Test Oracles Discussion Automation of oracle necessary Expected behavior given Necessary parts of an oracle Test Oracle A test oracle determines whether a system behaves correctly for test execution Webster dictionary - oracle A person giving wise or authoritative decisions or opinions An authoritative or wise expression or answer 11

Purpose of Test Oracle Sequential systems Check functionality Reactive (event-driven) systems Check functionality Timing Safety Reactive Systems Complete specification requires use of multiple computational paradigms Oracles must judge all behavioral aspects in comparison with all system specifications and requirements Hence oracles may be developed directly from formal specifications Parts of an Oracle Oracle information Specifies what constitutes correct behavior Examples: input/output pairs, embedded assertions Oracle procedure Verifies the test execution results with respect to the oracle information Examples: equality Test monitor Captures the execution information from the run-time environment Examples Simple systems: directly from output Reactive systems: events, timing information, stimuli, and responses Regression Testing Developed first version of software Adequately tested the first version Modified the software; Version 2 now needs to be tested How to test version 2? Approaches Retest entire software from scratch Only test the changed parts, ignoring unchanged parts since they have already been tested Could modifications have adversely affected unchanged parts of the software? 12

Regression Testing Software maintenance task performed on a modified program to instill confidence that changes are correct and have not adversely affected unchanged portions of the program. Regression Testing Vs. Development Testing During regression testing, an established test set may be available for reuse Approaches Retest all Selective retest (selective regression testing) main focus of research Formal Definition Given a program P, Its modified version P, and A test set T Used previously to test P Find a way, making use of T to gain sufficient confidence in the correctness of P Selective Retesting T Tests to rerun Tests not to rerun Tests to rerun Select those tests that will produce different output when run on P Modification-revealing test cases It is impossible to always find the set of modification-revealing test cases (we cannot predict when P will halt for a test) Select modification-traversing test cases If it executes a new or modified statement in P or misses a statement in P that it executed in P 13

21 3 132 31 2 12 3 23 2 3 31 3 3 3 13 31 2 T = {t2, t3} Cost of Regression Testing Factors to Consider Cost = C x Analysis + Selective Retest Retest All Cost = C y Testing costs Fault-detection ability Test suite size vs. Fault-detection ability Specific situations where one technique is superior to another We want C x < C y Key is the test selection algorithm/technique We want to maintain the same quality of testing 14

Data-flow Testing 1: read(x, y) 2: x := x + 2; 3: y := 2; 4: y := y * 2; 5: x := x + 2; 6: x := y + 2; 7: x := y + 2; 8: x := x + y + 2; 15