ISSTA 2002, Rome, Italy 1 Investigating the Use of Analysis Contracts to Support Fault Isolation in Object-Oriented Code Lionel Briand, Yvan Labiche, Hong.

Slides:



Advertisements
Similar presentations
Ensuring the Dependability of Software Systems
Advertisements

Design by Contract.
Copyright W. Howden1 Programming by Contract CSE 111 6/4/2014.
Karlstad University Computer Science Design Contracts and Error Management Design Contracts and Errors A Software Development Strategy Eivind J. Nordby.
An Analysis and Survey of the Development of Mutation Testing by Yue Jia and Mark Harmon A Quick Summary For SWE6673.
Introduction to Software Testing Chapter 9.2 Challenges in Testing Software – Software Testability Paul Ammann & Jeff Offutt
Software Construction
Error Management with Design Contracts Karlstad University Computer Science Error Management with Design Contracts Eivind J. Nordby, Martin Blom, Anna.
Feb 2003 R McFadyen1 Contracts (Ch 13) Used to help understand requirements more completely based on assertions; assertions are applicable to any.
Software Engineering and Design Principles Chapter 1.
Introduction To System Analysis and Design
Jan 2005 Ron McFadyen1 Contracts Used to help understand requirements more completely (and so may not always be necessary) based on assertions;
On the Relation between Design Contracts and Errors Karlstad University Computer Science On the Relation Between Design Contracts and Errors A Software.
Software Testing and Quality Assurance: The Testing Perspective Reading Assignment: –John McGregor and David A. Sykes, A Practical Guide to Testing Object-Oriented.
Software Testing and Quality Assurance
Static and Dynamic Contract Verifiers For Java Hongming Liu.
Detail Design Extending UML and Object Design. Object Design.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
An Experimental Evaluation on Reliability Features of N-Version Programming Xia Cai, Michael R. Lyu and Mladen A. Vouk ISSRE’2005.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
CS350/550 Software Engineering Lecture 1. Class Work The main part of the class is a practical software engineering project, in teams of 3-5 people There.
CSC 395 – Software Engineering Lecture 21: Overview of the Term & What Goes in a Data Dictionary.
Describing Syntax and Semantics
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Benoit Baudry – 2000 : Masters degree at the Univ. de Rennes 1 in – june 2003 : PhD thesis, « Testable assembly and component validation » with Yves.
MCA –Software Engineering Kantipur City College. Topics include  Formal Methods Concept  Formal Specification Language Test plan creation Test-case.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
State coverage: an empirical analysis based on a user study Dries Vanoverberghe, Emma Eyckmans, and Frank Piessens.
Your Interactive Guide to the Digital World Discovering Computers 2012.
Dr. Pedro Mejia Alvarez Software Testing Slide 1 Software Testing: Building Test Cases.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Object-Oriented Software Testing. C-S 5462 Object-Oriented Software Testing Research confirms that testing methods proposed for procedural approach are.
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Experimentation in Computer Science (Part 1). Outline  Empirical Strategies  Measurement  Experiment Process.
Composition of UML Described Refactoring Rules Presented by Chin-Yi Tsai.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Software Engineering in the Academy Bertrand Meyer IEEE Computer, May 2001.
1 Context-dependent Product Line Practice for Constructing Reliable Embedded Systems Naoyasu UbayashiKyushu University, Japan Shin NakajimaNational Institute.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
MNP1163/MANP1163 (Software Construction).  Minimizing complexity  Anticipating change  Constructing for verification  Reuse  Standards in software.
Computer Science 1 Systematic Structural Testing of Firewall Policies JeeHyun Hwang 1, Tao Xie 1, Fei Chen 2, and Alex Liu 2 North Carolina State University.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
Formal Specification.
Generating Automated Tests from Behavior Models
Introduction to JUnit CS 4501 / 6501 Software Testing
Software Testing An Introduction.
Software Engineering in the Academy
Verification and Testing
Software Engineering in the Academy
Paul Ammann & Jeff Offutt
Programming Languages 2nd edition Tucker and Noonan
Introduction to JUnit CS 4501 / 6501 Software Testing
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Software Engineering System Modeling Chapter 5 (Part 1) Dr.Doaa Sami
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
By Hyunsook Do, Sebastian Elbaum, Gregg Rothermel
Programming Languages 2nd edition Tucker and Noonan
Presentation transcript:

ISSTA 2002, Rome, Italy 1 Investigating the Use of Analysis Contracts to Support Fault Isolation in Object-Oriented Code Lionel Briand, Yvan Labiche, Hong Sun Software Quality Engineering Laboratory Systems and Computer Engineering Carleton University Ottawa, Canada

ISSTA 2002, Rome, Italy 2 Fault Isolation in OO Programs Diagnosis of failure is time-consuming in OO software because of the distribution of functionality and the complexity of methods interactions How can Analysis contracts (invariant, pre and post-conditions) be (re)used to instrument the code with assertions so as to help the isolation of faults?  What is an Analysis contract?  How can we measure the benefits of using contracts for fault isolation?

ISSTA 2002, Rome, Italy 3 Related Work [Meyer 92]: Design by Contract [Rosenblum 95]: Most effective assertions in C programs [Voas 95]: Testing with assertions –Needs very large numbers of assertions and executions [Binder 96]: Suggests the use of Built-in Test support to help testing [Baudry 01]: use of contracts to locate faults in classes –Class level testing –Unclear definition of contracts –Unclear measurement of the benefits (diagnosability)  Carefully designed case studies are needed  Precise, operational measure for diagnosability

ISSTA 2002, Rome, Italy 4 Analysis Contracts Contracts defined during Analysis: –Using OCL in the context of UML –Only for problem domain classes –Class invariants, method pre and post-conditions Elements used in contracts ElementsInvariantPreconditionPost-condition AttributeXXX Input parameterXX Output parameterX Return valueX AssociationXXX

ISSTA 2002, Rome, Italy 5 Additional Issues Oracles are expensive parts of the test drivers. Can they be substituted with assertions instrumenting contracts? Can contract assertions help detect additional failures? (I.e., improve observability over oracles alone) Why do certain faults remain undetected when using contract assertions? What are the issues related to instrumenting contracts in Java systems? How does the level of precision of contracts affect the results?

ISSTA 2002, Rome, Italy 6 Level of Precision in Analysis Contracts Problem: Contract instrumentation has a cost. Question: Can we simplify the instrumentation? Constraint: Be systematic. Three levels of detail in post-conditions: –Highest (as defined during Analysis) if A1 then B1 else if A2 then B2 else B3 –Intermediate (check the condition for the standard situation) if A1 then B1 else B2 or B3 –Lowest (ignore the conditions, check only the possible results) B1 or B2 or B3

ISSTA 2002, Rome, Italy 7 Diagnosability measure Exception raisedMethods analyzedMeasure at e ’s entrya, b, c3 during e, before the call to f e, a, b, c4 during e, after the call to f e, f, a, b, c5

ISSTA 2002, Rome, Italy 8 Contract Instrumentation Instrumentation effort depends on: –The language used for writing analysis contracts (i.e., OCL) –The tool and language used for the instrumentation programming language dependent Translate OCL contracts to code Javadoc assertions Instrument the code based on Javadoc assertions Instrumentation issues: –Access to attribute values => requires the addition of ‘get’ methods –Collections => requires to write search algorithms in assertions –Delegation => where to place assertions? –Contracts using methods that read data from a user or a device => requires to use assertions in the body of the method and split postcondition assertions

ISSTA 2002, Rome, Italy 9 Experimental Setting Case study: an Automated Teller Machine –21 classes, 2200 LOCs –with Analysis contracts (defined using OCL) Seeding of faults: 112 faults (OO and non-OO) –17 mutation operators (Java mutation operators by Kim et al) –Faults seeded in 11 classes (non-GUI, non-device interface, core classes) Test cases: category-partition Execution: –5 different ATM case studies: without contracts (only oracles), with contracts at three different levels of details, with contracts and oracles. –Diagnosability measure for each mutant in each test execution that kills it.

ISSTA 2002, Rome, Italy 10 Results 112 mutants –99 mutants killed by oracles –84 mutants killed by contracts (5 equivalent mutants killed) Using contracts (at any level of detail) significantly improves diagnosability (one order of magnitude)  Significant effort savings during debugging Using simple contracts is sufficient # of mutants consideredAverage diagnosability Oracle only ContractsHighest Intermediate Lowest741.37

ISSTA 2002, Rome, Italy 11 Results

ISSTA 2002, Rome, Italy 12 Conclusion Instrumented Analysis contracts are useful for fault isolation –Significant effort savings during debugging –Reuse of contracts defined during UML/OCL Analysis Other results (in technical report) –When combined with oracles, contracts help detect additional mutants (+5, 104/112 mutants detected) –Contracts are good substitute to hard-coded oracles for 84% of mutants  Experiments needed in realistic contexts with actual software developers  Better instrumentation tools (supporting OCL)

ISSTA 2002, Rome, Italy 13 Investigating the Use of Analysis Contracts to Support Fault Isolation in Object-Oriented Code Lionel Briand, Yvan Labiche, Hong Sun Software Quality Engineering Laboratory Systems and Computer Engineering Carleton University Ottawa, Canada

ISSTA 2002, Rome, Italy 14 Analysis Contract: Example context: Bank::initiateWithdrawl(cardNumber:int, PIN:int, serialNumber:int, from:int, amount:Money, newBalance:Money, availableBalance:Money):int pre: serialNumber > 0 and from = CHECKING or from = SAVINGS or from = MONEY_MARKET post: if not self.card->exists(_cardNumber = cardNumber) then result = Status.UNKNOWN_CARD else if PIN <> self._currentTransactionCard._PIN then result = Status.INVALID_PIN else if not self._currentTransactionAccount._available then result = Status.NO_SUCH_ACCOUNT else if from = SAVINGS then result = Status.CANT_WITHDRAW_FROM_ACCOUNT else if self._currenttransactionAccount._availableBalance.less(amount) then result = Status.INSUFFICIENT_AVAILABLE_BALANCE else if (MAXIMUM_WITHDRAWL_AMOUNT_PER_DAY.less(Money.add(self._currentTransactionCard. _withdrawlsToday, amount)) then result = Status.DAILY_WITHDRAWL_LIMIT_EXCEEDED else result = Status.SUCCESS and _currentTransactionAmount.equals(amount) and newBalance.getValue()=self._currentTransactionAcount._currentBalance.getValue()– amount.getValue() and availableBalance.getValue()=self._currentTransactionAccount. _availableBalance.getValue() – amount.getValue() endif