Chapter 8 Testing the Programs. Chapter 8 Learning Objectives Be able to …  Define different types of faults and how to classify them  Define the purpose.

Slides:



Advertisements
Similar presentations
Copyright Insight Test Services Testing From The Start – Test Driven Development TM Summit Fran OHara, Insight Test Services
Advertisements

Test process essentials Riitta Viitamäki,
What is Unit Testing? How TDD Works? Tsvyatko Konov Telerik Corporation
COMP 121 Week 7: Object-Oriented Design and Efficiency of Algorithms.
ISBN Prentice-Hall, 2006 Chapter 8 Testing the Programs Copyright 2006 Pearson/Prentice Hall. All rights reserved.
Requirements and Design
Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. Chapter Three - Implementing Classes.
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.
Classes. Object-Oriented Design Method for designing computer programs Consider “objects” interacting in the program –Example: a zoo, a gradebook.
JUnit. What is unit testing? A unit is the smallest testable part of an application. A unit test automatically verifies the correctness of the unit. There.
Software Testing and Quality Assurance
TDD Test-Driven Development. JUnit 4.0 To use annotations need to import org.junit.Test To use assertion need to import org.junit.Assert.* No need to.
Unit testing C# classes “If it isn’t tested it doesn’t work” Unit testing C# classes1.
Chapter 1 Program Design
Equivalence Partitioning Identify the inputs, behaviors, or other factors that you want to test based on the functionality and specifications Group these.
Bottom-Up Integration Testing After unit testing of individual components the components are combined together into a system. Bottom-Up Integration: each.
TDD OVERVIEW OF TEST DRIVEN DEVELOPMENT by Paul M. code of the damned. com.
© Dr. A. Williams, Fall Present Software Quality Assurance – JUnit Lab 1 JUnit A unit test framework for Java –Authors: Erich Gamma, Kent Beck Objective:
Lecture 6 Software Testing and jUnit CS140 Dick Steflik.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill 2009). Slides copyright 2009 by Roger Pressman.1.
Introduction to Unit Testing Jun-Ru Chang 2012/05/03.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 13b: Software Testing Strategies Software Engineering: A Practitioner’s Approach, 6/e Chapter.
Software Waterfall Life Cycle Requirements Construction Design Testing Delivery and Installation Operations and Maintenance Concept Exploration Prototype.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Integration testing l Tests complete systems or subsystems composed of integrated.
INT-Evry (Masters IT– Soft Eng)IntegrationTesting.1 (OO) Integration Testing What: Integration testing is a phase of software testing in which.
Week 4 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
CSC Programming I Lecture 8 September 9, 2002.
Chapter 6: Iteration Part 1. To be able to program loops with the while, for, and do statements To avoid infinite loops and off-by-one errors To understand.
Testing Basics of Testing Presented by: Vijay.C.G – Glister Tech.
Software Engineering 1 Object-oriented Analysis and Design Chap 21 Test-Driven Development and Refactoring.
Unit 7 Chapter 8 Testing the Programs. Unit 7 Requirements Read Chapters 8 and 9 Respond to the Unit 7 Discussion Board (25 points) Attend seminar/Take.
Unit Testing Building Rock-Solid Software SoftUni Team Technical Trainers Software University
A Practical Guide To Unit Testing John E. Boal TestDrivenDeveloper.com.
Week 4 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Review – Final Test Chapters 8,10,11. Locate error in following statement try i = Integer.pareseInt(str); catch(NumberFormatException e) System.out.println(“Input.
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
CSC 480 Software Engineering Lecture 15 Oct 21, 2002.
Chapter 21 Test-Driven Development 1CS6359 Fall 2011 John Cole.
Scalatest. 2 Test-Driven Development (TDD) TDD is a technique in which you write the tests before you write the code you want to test This seems backward,
LECTURE 19 23/11/15 Software Quality and Testing.
1 Unit Test in VS 2010 Presented by ZAN ZAN KOE. 2 Types of testing provided by VS  Unit test  Manual test  Web Performance Test  Coded UI Test 
Protocols Software Engineering II Wirfs Brock et al, Designing Object-Oriented Software, Prentice Hall, Mitchell, R., and McKim, Design by Contract,
Review TEST 2 Chapters 4,5,7. QUESTION For which type of operands does the == operator always work correctly: (a) int, (b) double, or (c) String?
1 Presentation Title Test-driven development (TDD) Overview David Wu.
Chapter 8 Testing. Principles of Object-Oriented Testing Å Object-oriented systems are built out of two or more interrelated objects Å Determining the.
Class Design I Class Contracts Readings: 2 nd Ed: Section 9.5, Advanced Topic nd Ed: Section 8.5, Advanced Topic 8.2 Some ideas come from: “Practical.
How to Test Methods Computer Science 3 Gerb Objective: Test methods properly.
ISBN Prentice-Hall, 2006 Chapter 8 Testing the Programs Copyright 2006 Pearson/Prentice Hall. All rights reserved.
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.
CSSE501 Object-Oriented Development. Chapter 10: Subclasses and Subtypes  In this chapter we will explore the relationships between the two concepts.
Unit Testing with FlexUnit
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
Chapter 8 Testing the Programs. Integration Testing  Combine individual comp., into a working s/m.  Test strategy gives why & how comp., are combined.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Mapping Designs to Code. It specify how to map the design into object oriented language The UML artifacts created during the design work, the interaction.
Building Rock-Solid Software
Test-driven development
TESTING TEST DRIVEN DEVELOPMENT
Smalltalk Testing - SUnit
Unit testing C# classes
Chapter Three - Implementing Classes
History, Characteristics and Frameworks
Introduction to JUnit CS 4501 / 6501 Software Testing
Programming in Java Assertion.
Unit Testing Good Practices
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
Presentation transcript:

Chapter 8 Testing the Programs

Chapter 8 Learning Objectives Be able to …  Define different types of faults and how to classify them  Define the purpose of testing

Discussion Questions  What are some different types of program faults?  What is the difference between a program fault versus a program failure?

Discussion Questions  Why do we test for program faults?  Who does the testing?

Chapter 8 Learning Objectives Be able to …  Describe unit testing  Describe integration testing  Explain the difference between them

Unit Testing  unit testing is a procedure used to validate that individual units of source code are working properly  A unit is the smallest testable part of an application In procedural programming a unit is a function, procedure, subroutine, etc. In object-oriented programming, a unit is a method  The goal is to show that the individual parts are correct

Integration Testing Top-down testing Bottom-up testing Sandwich testing Big-bang testing

Discussion Question What are some differences between integration testing of object-oriented programs versus procedural programs?

OO Integration Testing Strategies  Thread-based testing: integrates classes required to respond to event  Use-based testing: integrates classes required by one use case  Cluster testing: integrates classes required to demonstrate one collaboration

Discussion Question  How do we know when we can stop testing?

Unit Testing with xUnit  Test fixture : a class that contains one or more test methods  Test method : a method that executes a specific test  Test runner : an application that finds and executes test methods on test fixtures  Assertion : a Boolean expression that describes what must be true when some action has been executed

public class Account { private double balance = 0.0; public Account(double b) { balance = b; } public double Balance { get { return balance; } } public void Withdraw(double amount) { if (balance >= amount) balance -= amount; } public void Deposit(double amount) { // TO DO } Class to be unit tested

[TestClass()] public class AccountTest {... [TestMethod()] public void WithdrawTestWithSufficientFunds() { Account acct = new Account(100.0); acct.Withdraw(50.00); Assert.AreEqual(50.0, acct.Balance); } [TestMethod()] public void WithdrawTestWithInsufficientFunds() { Account acct = new Account(100.0); acct.Withdraw(150.00); Assert.AreEqual(100.0, acct.Balance); } Test Fixture

Test Runner

Test-Driven Development  Never write a single line of code unless you have a failing automated test  Refactor to eliminate duplication

Red/Green/Refactor 1.Write the test code 2.Compile the test code (It should fail because you haven’t implemented anything yet.) 3.Implement just enough to compile. 4.Run the test and see it fail. 5.Implement just enough to make the test pass. 6.Run the test and see it pass. 7.Refactor for clarity and to eliminate duplication. 8.Repeat from the top.