Software Engineering Lecture 19: Object-Oriented Testing & Technical Metrics.

Slides:



Advertisements
Similar presentations
Unit Testing in the OO Context(Chapter 19-Roger P)
Advertisements

Metrics for OO Design Distinct & measurable characteristics of OO design:- Size:-it is defined as – population,volume,length & functionality Population.
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Software Metrics for Object Oriented Design
Design Concepts and Principles
Figures – Chapter 24.
Metrics for Object Oriented Design Shyam R. Chidamber Chris F. Kemerer Presented by Ambikadevi Damodaran.
Applying and Interpreting Object Oriented Metrics
March 25, R. McFadyen1 Metrics Fan-in/fan-out Lines of code Cyclomatic complexity Comment percentage Length of identifiers Depth of conditional.
Nov R. McFadyen1 Metrics Fan-in/fan-out Lines of code Cyclomatic complexity* Comment percentage Length of identifiers Depth of conditional.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Page 1 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Chapter 7 Role-Based Component Engineering.
Introduction To System Analysis and Design
Object-Oriented Metrics. Characteristics of OO ● Localization ● Encapsulation ● Information hiding ● Inheritence ● Object abstraction.
Design Metrics Software Engineering Fall 2003 Aditya P. Mathur Last update: October 28, 2003.
Object-oriented Testing SIM3302. Objectives To cover the strategies and tools associated with object oriented testing  Analysis and Design Testing 
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Object-Oriented Metrics
March R. McFadyen1 Software Metrics Software metrics help evaluate development and testing efforts needed, understandability, maintainability.
Chapter 10 Class and Method Design
These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill 2009). Slides copyright 2009 by Roger Pressman.1.
1 Object-Oriented Testing CIS 375 Bruce R. Maxim UM-Dearborn.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Refactoring.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Software Measurement & Metrics
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 15b: Product Metrics for Software Software Engineering: A Practitioner’s Approach, 6/e Chapter.
Version control – Project repository, version management capability, make facility, issue/bug tracking Change control Configuration audit – compliments.
1 Chapter 15 Product Metrics for Software Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Software Design Deriving a solution which satisfies software requirements.
The CK Metrics Suite. Weighted Methods Per Class b To use this metric, the software engineer must repeat this process n times, where n is the number of.
The CK Metrics Suite. Weighted Methods Per Class b To use this metric, the software engineer must repeat this process n times, where n is the number of.
Concepts of Software Quality Yonglei Tao 1. Software Quality Attributes  Reliability  correctness, completeness, consistency, robustness  Testability.
Software Testing Reference: Software Engineering, Ian Sommerville, 6 th edition, Chapter 20.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Information System Design (IT60105) Lecture 26 Object-Oriented System Testing.
1 Metrics and lessons learned for OO projects Kan Ch 12 Steve Chenoweth, RHIT Above – New chapter, same Halstead. He also predicted various other project.
Computing and SE II Chapter 9: Design Methods and Design Models Er-Yu Ding Software Institute, NJU.
CSc 461/561 Information Systems Engineering Lecture 5 – Software Metrics.
Measurement and quality assessment Framework for product metrics – Measure, measurement, and metrics – Formulation, collection, analysis, interpretation,
Chapter : 19 Testing Object-Oriented Applications.
Lecture 18: Object-Oriented Design
LECTURE 19 23/11/15 Software Quality and Testing.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Chapter 24 객체지향 응용프로그램 테스팅 Testing Object-Oriented Applications 임현승 강원대학교 Revised from the slides by Roger S. Pressman and Bruce R. Maxim for the book.
1 Lecture 15: Chapter 19 Testing Object-Oriented Applications Slide Set to accompany Software Engineering: A Practitioner’s Approach, 7/e by Roger S. Pressman.
Object-Oriented (OO) estimation Martin Vigo Gabriel H. Lozano M.
Ontology Support for Abstraction Layer Modularization Hyun Cho, Jeff Gray Department of Computer Science University of Alabama
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Object Oriented Metrics
1 OO Technical Metrics CIS 375 Bruce R. Maxim UM-Dearborn.
Software Engineering Object Oriented Metrics. Objectives 1.To describe the distinguishing characteristics of Object-Oriented Metrics. 2.To introduce metrics.
OBJECT-ORIENTED TESTING. TESTING OOA AND OOD MODELS Analysis and design models cannot be tested in the conventional sense. However, formal technical reviews.
Design Metrics CS 406 Software Engineering I Fall 2001 Aditya P. Mathur Last update: October 23, 2001.
Object Oriented Metrics
A Hierarchical Model for Object-Oriented Design Quality Assessment
Software Metrics 1.
Course Notes Set 12: Object-Oriented Metrics
Lecture 9- Design Concepts and Principles
Object-Oriented Metrics
Design Metrics Software Engineering Fall 2003
Design Metrics Software Engineering Fall 2003
Mei-Huei Tang October 25, 2000 Computer Science Department SUNY Albany
Chapter 24 Testing Object-Oriented Applications
Lecture 9- Design Concepts and Principles
Chapter 19 Testing Object-Oriented Applications
Chapter 19 Testing Object-Oriented Applications
Software Metrics SAD ::: Fall 2015 Sabbir Muhammad Saleh.
Software Engineering: A Practitioner’s Approach, 6/e Chapter 15 Product Metrics for Software copyright © 1996, 2001, 2005 R.S. Pressman & Associates,
Presentation transcript:

Software Engineering Lecture 19: Object-Oriented Testing & Technical Metrics

Today’s Topics l Evaluating OOA and OOD Models l Unit, Class & Integration Testing l OO Design Metrics l Class-Oriented Metrics l Operation-Oriented Metrics l Testing Metrics l Project Metrics

O-O Programs are Different l High Degree of Reuse Does this mean more, or less testing? l Unit Testing vs. Class Testing What is the right “unit” in OO testing? l Review of Analysis & Design Classes appear early, so defects can be recognized early as well

Testing OOA and OOD Models l Correctness (of each model element) Syntactic (notation, conventions) review by modeling experts Semantic (conforms to real problem) review by domain experts l Consistency (of each class) Revisit CRC & Class Diagram Trace delegated responsibilities Examine / adjust cohesion of responsibilities

Model Testing [2] l Evaluating the Design Compare behavioral model to class model Compare behavioral & class models to the use cases Inspect the detailed design for each class (algorithms & data structures)

Unit Testing l What is a “Unit”? Traditional: a “single operation” O-O: encapsulated data & operations l Smallest testable unit = class many operations l Inheritance testing “in isolation” is impossible operations must be tested every place they are used

Testing under Inheritance Shape move() Circle resize() Square resize() Ellipse resize() Q: What if implementation of resize() for each subclass calls inherited operation move() ? A: Shape cannot be completely tested unless we also test Circle, Square, & Ellipse!

Integration Testing l O-O Integration: Not Hierarchical Coupling is not via subroutine “Top-down” and “Bottom-up” have little meaning l Integrating one operation at a time is difficult Indirect interactions among operations

O-O Integration Testing l Thread-Based Testing Integrate set of classes required to respond to one input or event Integrate one thread at a time l Example: Event-Dispatching Thread vs. Event Handlers in Java Implement & test all GUI events first Add event handlers one at a time

O-O Integration [2] l Use-Based Testing Implement & test independent classes first Then implement dependent classes (layer by layer, or cluster- based) Simple driver classes or methods sometimes required to test lower layers

Validation Testing l Details of objects not visible l Focus on user-observable input and output l Methods: Utilize use cases to derive tests (both manual & automatic) Black-box testing for automatic tests

Test Case Design l Focus: “Designing sequences of operations to exercise the states of a class instance” l Challenge: Observability Do we have methods that allow us to inspect the inner state of an object? l Challenge: Inheritance Can test cases for a superclass be used to test a subclass?

Test Case Checklist [Berard ’93] l Identify unique tests & associate with a particular class l Describe purpose of the test l Develop list of testing steps: Specified states to be tested Operations (methods) to be tested Exceptions that might occur External conditions & changes thereto Supplemental information (if needed)

Object-Oriented Metrics l Five characteristics [Berard ’95]: Localization operations used in many classes Encapsulation metrics for classes, not modules Information Hiding should be measured & improved Inheritance adds complexity, should be measured Object Abstraction metrics represent level of abstraction

Design Metrics [Whitmire ’97] l Size Population (# of classes, operations) Volume (dynamic object count) Length (e.g., depth of inheritance) Functionality (# of user functions) l Complexity How classes are interrelated

Design Metrics [2] l Coupling # of collaborations between classes, number of method calls, etc. l Sufficiency Does a class reflect the necessary properties of the problem domain? l Completeness Does a class reflect all the properties of the problem domain? (for reuse)

Design Metrics [3] l Cohesion Do the attributes and operations in a class achieve a single, well-defined purpose in the problem domain? l Primitiveness (Simplicity) Degree to which class operations can’t be composed from other operations

Design Metrics [4] l Similarity Comparison of structure, function, behavior of two or more classes l Volatility The likelihood that a change will occur in the design or implementation of a class

Class-Oriented Metrics l Of central importance in evaluating object- oriented design (which is inherently class-based) l A variety of metrics proposed: Chidamber & Kemerer (1994) Lorenz & Kidd (1994) Harrison, Counsell & Hithi (1998)

Weighted Methods per Class l Assume class C has n methods, complexity measures c 0 …c i WMC(C) =  c i l Complexity is a function of the # of methods and their complexity l Issues: How to count methods? (inheritance) Normalize c i to 1.0

Depth of Inheritance Tree l Maximum length from a node C to the root of the tree l PRO: inheritance = reuse l CON: Greater depth implies greater complexity Hard to predict behavior under inheritance Greater design complexity (effort)

DIT Example [from SEPA 5/e] DIT = 4 (Longest path from root to child node in hierarchy)

Number of Children l Subclasses immediately subordinate to class C are its children l As # of children (NOC) increases: PRO: more reuse CON: parent becomes less abstract CON: more testing required

Coupling Between Objects l Number of collaborations for a given class C l As CBO increases: CON: reusability decreases CON: harder to modify, test l CBO should be minimized

Response For A Class l Response Set: the set of methods than can potentially execute in response to some message l RFC: The # of methods in the response set l As RFC increases: CON: Effort for testing increases CON: Design complexity increases

Lack of Cohesion in Methods l LCOM: # of methods that access one or more of the same attributes l When LCOM is high: More coupling between methods Additional design complexity l When LCOM is low: Lack of cohesion? e.g.: control panel gauges Reduced design complexity

Class Size l Number of operations Inherited & Local l Number of attributes Inherited & Local l These may be added, but… l They lack the weighting for complexity which WMC provides

Method Inheritance Factor l Proportion of inherited methods to total methods available in a class MIF =  M i (Ci) /  M a (Ci) l A way to measure inheritance (and the additional design & testing complexity)

Operation-Oriented Metrics l Average Operation Size (OS avg ) LOC not a good measure Better: number of messages sent Should strive to minimize l Operation Complexity (OC) E.g., Function Points; minimize l Average # Parameters (NP avg ) Larger = more complex collaborations between objects; try to minimize

O-O Testing Metrics l Percent Public & Protected (PAP) Comparison of attribute types Higher: greater chance of side-effects l Public Access to Data (PAD) # of classes that can access data in another (encapsulation violation) Higher: greater chance of side-effects

Testing Metrics [2] l Number of Root Classes (NOR) # of distinct class hierarchies Higher: increased testing effort, since test cases must be defined for each l Fan-In (FIN) In O-O context = multiple inheritance FIN > 1 should be avoided! (Java)

Project Metrics l Number of Scenario Scripts (NSS) Proportional to # classes, methods… Strong indicator of program size l Number of Key Classes (NKC) Unique to solution (not reused) Higher: substantial development work l Number of Subsystems (NSUB) Impact: resource allocation, parallel scheduling, integration effort

Questions?