1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.

Slides:



Advertisements
Similar presentations
1 Software Testing and Quality Assurance Lecture 13 - Planning for Testing (Chapter 3, A Practical Guide to Testing Object- Oriented Software)
Advertisements

Chapter 4 - Object-Oriented Analysis and Design in a Nutshell1 Chapter 4 Object-Oriented Analysis and Design in a Nutshell.
CS3773 Software Engineering Lecture 03 UML Use Cases.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
Introduction To System Analysis and Design
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
Systems Analysis and Design in a Changing World, Fourth Edition
L4-1-S1 UML Overview © M.E. Fayad SJSU -- CmpE Software Architectures Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I.
Testing L. Grewe Why test? Detect and eliminate errors in programDetect and eliminate errors in program Feedback to improve softwareFeedback to improve.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Software Development Study Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Unified Modeling Language (UML) Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© 2005 Prentice Hall4-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Program Testing Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 Software Engineering September 5, 2001 Introduction.
Unified Modeling Language (UML)
7. 2Object-Oriented Analysis and Design with the Unified Process Objectives  Detailed Object-Oriented Requirements Definitions  System Processes—A Use.
Objectives Explain the purpose and objectives of object- oriented design Develop design class diagrams Develop interaction diagrams based on the principles.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Object-Oriented Analysis and Design
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
CIT UPES | Sept 2013 | Unified Modeling Language - UML.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Conquering Complex and Changing Systems Object-Oriented Software Engineering Chapter 2, Modeling with UML.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
1 UML Basic Training. UML Basic training2 Agenda  Definitions: requirements, design  Basics of Unified Modeling Language 1.4  SysML.
Systems Analysis and Design in a Changing World, 3rd Edition
Software Construction Lecture 18 Software Testing.
Software Engineering Prof. Ing. Ivo Vondrak, CSc. Dept. of Computer Science Technical University of Ostrava
Unified Modeling Language* Keng Siau University of Nebraska-Lincoln *Adapted from “Software Architecture and the UML” by Grady Booch.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
Sept. 25, 2003CS WPI1 CS 509 Design of Software Systems Lecture #4 Thursday, Sept. 25, 2003.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
UML Review of diagram types. 2 Unified Modeling Language The Unified Modeling Language™ (UML) was developed jointly by Grady Booch, Ivar Jacobson, and.
An Introduction to the Unified Modeling Language
Object-Oriented Paradigm and UML1 Introduction to the Object- Oriented Paradigm.
2 2009/10 Object Oriented Technology 1 Topic 2: Introduction to Object-Oriented Approach Reference: u Ch.16 Current Trends in System Development (Satzinger:
UML as a Specification Language for Embedded Systems. By, Mir Ahmed Ali, Asst. Professor, ECM department, SNIST. By, Prof. Narsiah sir, Director of School.
Unified Modeling Language. Object Oriented Methods ► What are object-oriented (OO) methods?  OO methods provide a set of techniques for analyzing, decomposing,
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
7. 2Object-Oriented Analysis and Design with the Unified Process Objectives  Detailed Object-Oriented Requirements Definitions  System Processes—A Use.
Systems Analysis and Design in a Changing World, Fourth Edition
Lecture 9-1 : Intro. to UML (Unified Modeling Language)
COP 3331 OBJECT-ORIENTED ANALYSIS AND DESIGN Bob Myers Department of Computer Science.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
Prof. Hany H. Ammar, CSEE, WVU, and
UML Review of Use case diagrams. 2 Unified Modeling Language The Unified Modeling Language™ (UML) was developed jointly by Grady Booch, Ivar Jacobson,
UML - Development Process 1 Software Development Process Using UML.
Dynamic Testing.
UML Course Instructor: Rizwana Noor. Overview  Modeling  What is UML?  Why UML?  UML Diagrams  Use Case  Components  Relationships  Notations.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
Application Analysis. Application Interaction Model The purpose of analysis is to understand the problem so.
UML. Model An abstract representation of a system. Types of model 1.Use case model 2.Domain model 3.Analysis object model 4.Implementation model 5.Test.
Introduction to UML.
Unified Modeling Language (UML)
Object-Oriented Analysis and Design
Unified Modeling Language
Verification and Testing
Introduction to Unified Modeling Language (UML)
University of Central Florida COP 3330 Object Oriented Programming
Chapter 2, Modeling with UML
Lecture 09:Software Testing
Unified Modeling Language
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Presentation transcript:

1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park

2 Overview Testing Unified Modeling Language (UML) Models & views Class diagrams Sequence diagrams

3 Testing Goal Detect and eliminate errors in program Feedback to improve software Specification changes Add new functionality Extremely important for success!

4 Testing Empirical testing Test software with selected test cases More scalable than verification Not guaranteed to detect all errors

5 Testing – Terminology Test case Individual test Test suite Collection of test cases Test harness Program that executes a series of test cases Test framework Software that facilitates writing & running tests Example – JUnit

6 Testing – Terminology Test driver Program to create environment for running tests Declares variables, creates objects, assigns values Executes code and displays results of tests Stub Skeleton code in place of unfinished method / class Simply return if called Possibly print message indicating stub called Allows software testing to begin

7 Testing – Terminology Tester (Quality Assurance) Person devising and / or performing tests More effective if 2nd person writes tests Walkthrough Programmer explains code to 2 nd person

8 Types of Testing Clear box testing Allowed to examine code Attempt to improve thoroughness of tests Black box testing No knowledge of code Treat program as “black box” Test behavior in response to inputs

9 Levels (Stages) of Testing 1. Unit test 2. Integration test 3. System test 4. Acceptance test

10 Unit Test Test individual units extensively Classes Methods Central part of “eXtreme Programming” (XP) Extensive unit testing during development Pair programming (1 coder, 1 tester) Design unit tests along with specification Approach Test each method of class Test every possible flow path through method

11 Flow Path Unique execution sequence through program Example S1 while (B1) { if (B2) S2 else S3 } Flows S1 S1, S2 S1, S3 S1, S2, S2 S1, S2, S3 S1, S3, S2 S1, S3, S3 …

12 Unit Test – Flow Path Not possible to test all flow paths Many paths by combining conditionals, switches Infinite number of paths for loops New paths caused by exceptions Test coverage Alternative to flow path Ensure high % (if not all) of lines of code tested Does not capture all possible flow paths Even if all lines of code tested by some test case

13 Integration Test Test interaction between units Possible units fail when combined May find problems in specifications Approach Test units together Proceed bottom up, in increasing size Example test sequence 1. AB, AC, AD, CD, CE 2. ACD 3. ABCDE B A C D E

14 System Test Test entire software Include all components of software In context in which software will be used Ensure all pieces of software interact correctly

15 Acceptance Test Test full functionality of software Ensure program meets all requirements Approach Place software in user environment Test software with Real-world data Real users Typical operating conditions Test cases selected by users

16 Acceptance Test – Stages Alpha test Test components during development Usually clear box test Beta test Test in real user environment Always black box test

17 Regression Test Ensure functionality is not lost / changed As software is modified / extended Approach Save suite of tests and expected results Rerun test suite periodically after software changes Report any loss of functionality Typically run overnight Software is more stable when developers leave work

18 Developing Test Cases Quality of testing depends on test cases Tips on developing test cases Develop test data during analysis & design phases Attempt to exercise alternate program paths Check boundary conditions 1 st and last iterations of loop 1 st and last values added to data structure Pay close attention to problem specification UML use cases  test cases

19 UML UML (Unified Modeling Language) Graphic modeling language for describing object-oriented software Started in 1994 Combined notations from 3 leading OO methods OMT(James Rumbaugh) OOSE(Ivar Jacobson) Booch(Grady Booch) Industry standard Many features Large collection of notations Multiple views Multiple diagrams We focus mainly on Logical view of relationship between classes

20 UML Motivation Software growing larger & complex Difficult to analyze Need to describe software design Clearly Concisely Correctly UML equivalent to software “blueprint” Provides simple yet clear abstraction for software Computer-aided software engineering (CASE) Tools for generating & analyzing UML

21 (Some) UML Diagrams Class Describe static structure of the classes in system Sequence Describe dynamic behavior between users and objects Use case Describe functional behavior seen by (external) user State Describe dynamic behavior of objects as finite state machine Activity Model dynamic behavior of a system as a flowchart

22 Sequence Diagram Object Message Activation Sequence diagrams represent behavior as interactions blinkHours() blinkMinutes() incrementMinutes() refresh() commitNewTime() stopBlinking() pressButton1() pressButton2() pressButtons1And2() pressButton1() :WatchUser :Time:LCDDisplay:SimpleWatch

23 Use Case Diagrams WatchUserWatchRepairPerson ReadTime SetTime ChangeBattery Actor Use case Package SimpleWatch Use case diagrams represent functionality of system from external user’s point of view

24 button1&2Pressed button1Pressed button2Pressed button1Pressed button1&2Pressed Increment Minutes Increment Hours Blink Hours Blink Seconds Blink Minutes Increment Seconds Stop Blinking State Diagrams State Initial state Final state Transition Event

25 UML Class Diagrams Represent the (static) structure of the system During analysis Used to model problem domain concepts During detailed design Used to model classes

26 Class Diagrams Class contains Name State Behavior Visibility Specifiers + public - private # protected ~ package

27 UML Class Diagrams  Java Code Different representation of same information Name, state, behavior of class Relationship(s) between classes Should be able to derive one from the other Motivation UML  Java Implement code based on design written in UML Java  UML Create UML to document design of existing code

28 Java  UML : Clock Example Java class Clock { // name // state private int seconds; private int minutes; private int hours; // behavior public void start(); public void adjustTime(int value); public void reset(); } Java Code Class Diagram