Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 1.

Slides:



Advertisements
Similar presentations
Logical and Physical Design of an Information System
Advertisements

Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Chap 2 System Structures.
Lucene Part3‏. Lucene High Level Infrastructure When you look at building your search solution, you often find that the process is split into two main.
Chapter 12 ATM Case Study, Part 1: Object-Oriented Design with the UML
Object Oriented Design An object combines data and operations on that data (object is an instance of class) data: class variables operations: methods Three.
Copyright W. Howden1 Lecture 7: Functional and OO Design Descriptions.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
A Brief Introduction to Software Design and Design Quality By Laura Leventhal.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
Chapter 2: Input, Processing, and Output
1 Software Testing and Quality Assurance Lecture 30 – Testing Systems.
Software Lifecycle A series of steps through which a software product progresses Lifetimes vary from days to months to years Consists of –people –overall.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
© Copyright 2011 John Wiley & Sons, Inc.
Chapter 13: Object-Oriented Programming
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
1 Memory Model of A Program, Methods Overview l Memory Model of JVM »Method Area »Heap »Stack.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
UML Sequence Diagrams Michael L. Collard, Ph.D. Department of Computer Science Kent State University.
UML - Development Process 1 Software Development Process Using UML (2)
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
1 Object-Oriented Testing CIS 375 Bruce R. Maxim UM-Dearborn.
INTRODUCTION TO PROGRAMMING STRUCTURE Chapter 4 1.
Copyright R. Weber Machine Learning, Data Mining ISYS370 Dr. R. Weber.
Software Engineering Chapter 23 Software Testing Ku-Yaw Chang Assistant Professor Department of Computer Science and Information.
The Architecture of Secure Systems Jim Alves-Foss Laboratory for Applied Logic Department of Computer Science University of Idaho By, Nagaashwini Katta.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 3: Requirements Specification, C++ Basics.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Software Testing Testing types Testing strategy Testing principles.
SOFTWARE DESIGN (SWD) Instructor: Dr. Hany H. Ammar
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 3rd Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
Software Development Cycle What is Software? Instructions (computer programs) that when executed provide desired function and performance Data structures.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
C Functions Pepper. Objectives Create functions Function prototypes Parameters – Pass by value or reference – Sending a reference Return values Math functions.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Black Box Testing Techniques Chapter 7. Black Box Testing Techniques Prepared by: Kris C. Calpotura, CoE, MSME, MIT  Introduction Introduction  Equivalence.
1 Introduction to Software Engineering Lecture 1.
Requirements as Usecases Capturing the REQUIREMENT ANALYSIS DESIGN IMPLEMENTATION TEST.
ADTs and C++ Classes Classes and Members Constructors The header file and the implementation file Classes and Parameters Operator Overloading.
Requirements Engineering Methods for Requirements Engineering Lecture-30.
Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 1.
CIS 112 Exam Review. Exam Content 100 questions valued at 1 point each 100 questions valued at 1 point each 100 points total 100 points total 10 each.
Use Case Driven Analysis Requirements Use Case Use Case Description System Sequence Diagram Chapter 5.
1 Modeling System Requirements with Use Cases. 2 Why Do We Need Use Cases? Primary challenge in a system design process –ability to elicit correct and.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Copyright (c) 2014 Pearson Education, Inc. Introduction to DBMS.
Refactoring Agile Development Project. Lecture roadmap Refactoring Some issues to address when coding.
UML - Development Process 1 Software Development Process Using UML.
Outsourcing, subcontracting and COTS Tor Stålhane.
(C) 2010 Pearson Education, Inc. All rights reserved.  Best way to develop and maintain a large program is to construct it from small, simple pieces,
Chapter 29: Program Security Dr. Wayne Summers Department of Computer Science Columbus State University
1 Sections 6.4 – 6.5 Methods and Variables Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
System Components Operating System Services System Calls.
Systems Analysis and Design in a Changing World, Fourth Edition
1 Sections 7.2 – 7.7 Nested Control Statements Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Advanced Computer Systems
Functions Review.
Abstract Data Types and Encapsulation Concepts
Corresponds with Chapter 7
Verification and Validation Unit Testing
Dr. Awad Khalil Computer Science Department AUC
A-level Computer Science
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Introduction to Operating Systems
Chapter 29: Program Security
COP 3330 Object-oriented Programming in C++
Dr. Awad Khalil Computer Science Department AUC
Presentation transcript:

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 1

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 2 Features of classes: Attributes Behavior/Operations/Methods PRIVATE PART is INVISIBLE to the outside.

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 3  Feature of Classes (1)Attributes – private part data describing an object referred to as the STATE Attribute values determine BEHAVIOR, i.e., how the methods react to messages.

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 4  Feature of Classes contd - Typically functions (methods) are for manipulating the object: - Set operations -- store values into the state - Inquiry operations – return values of state variable(s) Computation operations – perform computation using state variable, without modifying state variables. Transformational operations – modify state variables. (2) Behavior/Operations/Methods :

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 5 Approaches: (1)Function-Driven. (Divide and Conquer). Test each function (method). If each method works, then the whole class must work. - Use function testing techniques on each method Document test of each function

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 6 Limitations of Function-Driven approach a)Class methods are not independent. Correctness of one requires correctness of other methods. b) Order in which to test methods. c) Ability to test internal/private functions. d)Ability to see the EFFECTS of a function call, when there is an internal state change.

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 7  (2) State-Driven. (State = internal/private variables inside class). -Identify relevant states (not every value of every variable is significant). -Ensure all state transitions have been exercised (state-transition coverage).

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 8 Limitations of State Driven approach a) Hard to identify significant states b)Must understand formal specification using state models. c) Hard to get visibility into current internal state.

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 9 (3) Semantics/Usage-Driven approach. (Semantics = the intended meaning/usage of objects of a class type) Example: Stack rules. Push before Pop Detection of empty/overflow. - Sequence of calls to public methods required to DO A JOB - valid and invalid sequences - Focus is on correct "external" behavior

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 10  Challenge #1 Why this is important ? Testing requires "finding" the results so that it can be compared to the expected result. When the result is trapped inside an object, one must be able to access it. Gaining access to the internal state

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 11  Challenge #1 contd What is required The class must be modified temporarily to permit access to the internal state. HOWEVER, the goal must be to minimize the intrusiveness of such modifications. Principle: If you modify what you are testing, then you're not testing the original (real) thing.

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 12 Approach to Gain Access to Internal State 1)Add "hooks" to the interface of the class (public section) - DATA TYPE: struct instate declaring all the internal state variables - INQUIRY FUNCTIONS: a) Get_State (instate &) -- returns values of all state variables (contd)

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 13 Approach to Gain Access to Internal State contd -SET FUNCTIONS: - a) Set_State (instate &) -- set state variables to the values contained in the state record being passed. - (2) LAST RESORT -- Make EVERYTHING PUBLIC.

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 14 Challenge: A function-driven test may require multiple drivers,one per function, along with tdi_ and trs_ and uts_ utl_ files. This creates a data management problem. Moreover, a function-driven test does not address the overall behavior of the class.

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 15 Strategy: Perform function-driven tests first. NEXT apply usage- driven testing. Strategy: Perform function-driven tests first. NEXT apply usage- driven testing.

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 16 APPROACH: (1) Usage-Driven class test driver - menu driven based on inputs in tdi_ file: -- each menu selection identifies the class method to be invoked. -- tdi_ file contains the "arguments“ needed for the call

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page tdi_ file contains the expected results actual values description of the effects -A single trs_ file is produced trs_ file echoes the tdi_ input trs_ file may contains results Or description of observed effects Additional effort may be required to verify that all the expected effects occurred.

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 18 Identify user tasks (end-to-end) Base tasks on the specification of the class Base other tasks on "boundary conditions“ Identify the sequence of public operations required to perform the task. APPROACH: 2) Usage-Driven Test Case Design

Florida A & M University Computer and Information Science e-learning Testing of Classes Copyright PCSA, Inc Cis4932 (Dr. Ed Jones)Page 19 Table of Contents Logic overview  What is a proposition  Proposition and logical operators  What are bit operators Negation Conjunction Disjunction Exclusive OR Implication Biconditional