83
SC12 Educator’s Session November 13, 2012 Test-Driven Development

Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Embed Size (px)

Citation preview

Page 1: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator’s Session November 13, 2012

Test-Driven Development

Page 2: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Outline

Software Quality

Overview of Testing

Automated Testing Tools

Test-Driven Development

SC12 Educator's Session 2

Page 3: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SOFTWARE QUALITY

SC12 Educator's Session 3

Page 4: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Software Quality

Multiple Definitions

Developer’s View vs. User’s View Developers = Users =

SC12 Educator's Session 4

Page 5: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Definitions

Software must do the right things Perform the right functions Often referred to as

Software must do things right

Perform intended functions without problems Often referred to as

SC12 Educator's Session 5

Page 6: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Quality Definitions: Defects

Failure

Fault

Error

6 SC12

Educator's Session

Page 7: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

7

Quality Definitions: Defects

SC12 Educator's Session

Page 8: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Quality Focus

Customers/Users

Developers

8 SC12

Educator's Session

Page 9: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 9

QA Activities: Types

Defect Prevention

Defect Reduction

Defect Containment

Page 10: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 10

QA Activities: Timing

Pre-release Defect Prevention & Reduction Remove as many defects as possible before release

Post-release

Repair failures Reduces defects Significantly more expensive than pre-release Bad PR

Contain defects Minimize impact Expensive, so limited in application

Page 11: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 11

Defect Prevention: Introduction

Reduce the chance of fault injection

Approach depends on source

There may be specific tools or technologies that can also help

Important to establish the correct root-cause

Page 12: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 12

Defect Prevention: Education and Training

People are most important factor in quality and success

Education and Training can improve the quality of the work done by practitioners

Elimination of misconceptions will reduce the probability of defect injection

Page 13: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 13

Defect Prevention: Education and Training

Product and Domain Specific Knowledge

Software Development Expertise

Knowledge about tools, methods, techniques

Development Process Knowledge

Page 14: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 14

Defect Prevention: Formal Methods

Formal Methods

Formal Specification Formal Verification

Help eliminate error sources and verify the absence of faults

Page 15: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 15

Formal Methods: Axiomatic Approach

Code

Axiom 1

Axiom 2

Axiom 3 Program

Conditions Describing Program State Before Execution

Conditions Describing Program State After Execution

Meaning

Biggest obstacle to use of formal methods:

Page 16: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 16

Defect Prevention: Other Techniques

Use of additional software development methodologies (besides Formal Methods) Prevent extra functionality Reduce complexity

Better management Concrete process definition Enforcement of standards

Use of specific tools Enforce coding standards

Page 17: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 17

QA Activities: Defect Prevention

Page 18: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 18

Defect Reduction: Introduction

Unrealistic to expect Defect Prevention step to stop all defects

Different approaches

Page 19: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 19

Defect Reduction: Testing

Execution of software and checking results Locates failures Isolate and fix the fault(s) that led to the

failure

When to test Need some executable Unit tests of components through acceptance

test of entire system Can also use prototypes

Page 20: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 20

Defect Reduction: What to Test

Functional (black box)

Structural (white box)

Page 21: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 21

Defect Reduction: When to Stop Testing

Can use coverage criteria Assumption:

Reliability goals

Page 22: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 22

Defect Reduction: Observations

Many other techniques available

In-field measurement and repair not normally considered part of QA

Important to determine risky components

Page 23: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 23

QA Activities: Defect Reduction

Page 24: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 24

Defect Containment: Introduction

Important for systems where the impact of failures is substantial

Not all faults can be eliminated (cost, time)

Page 25: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 25

Defect Containment: Fault Tolerance

Different from manufacturing

Approaches

Does not focus on identifying and removing the

faults that cause the failures

Page 26: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 26

Defect Containment: Safety Assurance

Safety-critical systems:

Address even low probability failures

Safety Assurance techniques

Page 27: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 27

QA Activities: Defect Containment

Page 28: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

INTRODUCTION TO TESTING

SC12 Educator's Session 28

Page 29: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Types of Testing

SC12 Educator's Session 29

Page 30: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 30

Unit Testing What?

Who?

What is the focus?

What type of testing techniques do we use?

Page 31: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 31

Component Testing

What?

Who?

What type of testing techniques do we use?

COTS and CBSD

Page 32: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 32

Integration Testing What?

Who?

What is the focus?

What type of testing techniques do we use?

Merged with System Testing?

Page 33: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 33

System Testing What?

Who?

What is the focus?

What type of testing techniques do we use?

Embedded systems?

Page 34: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 34

Acceptance Testing

What?

Who?

What is the focus?

What type of testing techniques do we use?

Page 35: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 35

Functional vs. Structural

Page 36: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 36

Functional vs. Structural

Individual elements

Interactions of elements

Inputs and outputs – functional

Page 37: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 37

Black Box (Functional) Testing: Overview

Page 38: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 38

Black Box (Functional) Testing: Process

Planning

Execution

Analysis

Page 39: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 39

White Box (Structural) Testing: Overview

Page 40: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 40

Stopping Criteria: Coverage-Based

Ensures some item has been covered

Assumes that

Approaches

Page 41: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 41

Coverage Based Testing: Process

Define the model

Check the model elements

Define the coverage criteria

Derive the test cases

Page 42: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test Activities

Test Planning

Test Execution

Analysis and Follow-up

SC12 Educator's Session 42

Page 43: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 43

Test Planning

High level goal:

Make the following decisions

Have to account for personnel

Page 44: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 44

Test Planning: Test Case Creation

What is needed?

How are they generated?

Page 45: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 45

Test Planning: Test Suite Preparation

What is a test suite?

How are they created?

Expensive should be maintained for future use

Page 46: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 46

Test Planning: Preparation of Procedure

Ordering of test cases

One test case should leave the system ready

to execute the next

Assignment of personnel

Page 47: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 47

Test Execution: Overview

Major steps:

Prevent failed test cases from halting

execution

Environment

Page 48: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Specific Approaches to Testing

Control Flow Testing

Partition-based Testing

Usage-based Testing

Data-flow Testing

SC12 Educator's Session 48

Page 49: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 49

Systematic Testing

Drawbacks to ad hoc testing

One way to structure is to build a checklist

Page 50: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 50

Control Flow Testing: Overview

Model of the software is a graph

Use

first

A

B

C E D

F

G

last

Page 51: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 51

Control Flow Testing: Model Construction

Page 52: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 52

Control Flow Testing: Model Construction

Can also be done with black box testing

Elements

Page 53: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 53

Control Flow Testing: Path Selection

Page 54: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 54

Control Flow Testing: Path Selection

Page 55: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Control Flow Testing: Model Construction

L1: input(a,b,c) L2: d b*b – 4*a*c L3: If (d>0) then L4: r 2 L5: else_if (d=0) L6: r 1 L7: else_if (d<0) L8: r 0 L9: output (r)

SC12 Educator's Session 55

Page 56: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 56

Control Flow Testing: Creating Test Cases

If each decision is based on an independent variable, then just choose appropriate values Can use the idea of equivalence classes

If decisions are not independent, some branches may be eliminated as infeasible

Some decisions may be based on processing between decisions nodes – may be hard to develop test cases

Page 57: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 57

Loops

Loops complicate the CFT idea. Why?

Parts of a loop:

Page 58: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 58

Loops

While (C) do {B} For (I; C; U) do {B}

Page 59: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 59

Loop Testing: Difficulties

When loops are nested, number of paths quickly grows unmanageable

Complete path coverage not possible, have to be selective

Where do most problems occur?

What types of test cases do we need and why?

Page 60: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 60

Loop Testing: Difficulties

Concatenation/Nesting of loops

How can we reduce number of test cases?

Page 61: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Specific Approaches to Testing

Control Flow Testing

Partition-based Testing

Usage-based Testing

Data-flow Testing

SC12 Educator's Session 61

Page 62: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 62

Partition Based Testing

Benefits Increased coverage Reduced overlap

Examples:

Solve for root of ax2 + bx + c = 0

Thermostat

Page 63: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

SC12 Educator's Session 63

Partition Testing: Theory

A set S contains a list of unique elements

Partition of S creates subsets G1, G2, … Gn such that Sets are mutually exclusive Sets are collectively exhaustive

G1..Gn are equivalence classes if created based on

some definition of equality

Properties Symmetric Transitive Reflexive

Page 64: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

AUTOMATED TESTING TOOLS

SC12 Educator's Session 64

Page 65: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Automated Testing Frameworks

Enable set of tests to be executed repeatedly

Family of tools jUnit cUnit … (xUnit)

Demo SC12

Educator's Session 65

Page 66: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

cUnit

http://cUnit.sourceforge.net

Framework to create and execute tests

Assertions CU_ASSERT CU_ASSERT_TRUE CU_ASSERT_FALSE CU_ASSERT_EQUAL CU_ASSERT_NOT_EQUAL …

SC12 Educator's Session 66

Page 67: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

cUnit: Test Registry

Repository of test suites and tests

Using the test registry Create Clean up

Adding tests Create a test suite Add tests to the test suite

SC12 Educator's Session 67

Page 68: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

cUnit: Running Tests

Can run: All tests Individual suites Individual tests

Modes Automated – non-automated / XML output Basic – non-automated / stdout output Console – interactive console under user

control SC12

Educator's Session 68

Page 69: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

TEST-DRIVEN DEVELOPMENT

SC12 Educator's Session 69

Page 70: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Introduction & Background

Basic idea:

Part of the agile software development approach

Pair programming

SC12 Educator's Session 70

Page 71: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Overview

Focus on unit tests

Often require

Can be automated or manual

Can be performed by developers or testers

SC12 Educator's Session 71

Page 72: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Motivation

Programming practice that instructs developers to:

Test-Driven Development

SC12 Educator's Session 72

Page 73: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Definition

From the Agile Alliance

Test-driven development (TDD) is the craft of producing automated tests for production code, and using that process to drive design and programming. For every tiny bit of functionality in the production code, you first develop a test that specifies and validates what the code will do. You then produce exactly as much code as will enable that test to pass. Then you refactor (simplify and clarify) both the production code and the test code.

SC12 Educator's Session 73

Page 74: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Additional Thoughts

Refactoring

Not a software development methodology

Provides automated test

SC12

Educator's Session 74

Page 75: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Process

SC12 Educator's Session 75

Page 76: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Example Story

SC12 Educator's Session 76

Page 77: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Automated Testing

TDD assumes the presence of an automated testing framework

Test Harnesses

xUnit Lets users write tests to initialize, execute,

and make assertions about code being tested Tests can serve as documentation

SC12 Educator's Session 77

Page 78: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Evaluation

Performed in Industry and Academia

Industrial studies 4 studies in small companies Measured defect density Results

Programmers using TDD produced code that passed 18% - 50% more tests

TDD programmers spent less time debugging TDD decreased productivity – but they wrote more test

cases SC12

Educator's Session 78

Page 79: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Challenges to Adoption

SC12 Educator's Session 79

Page 80: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Test-Driven Development: Example

Design a system to perform financial transactions with money that may be in different currencies

For example – If the exchange rate from Swiss Francs to US

Dollars is 2 to 1, then we can calculate 5 USD + 10 CHF = 10 USD 5 USD + 10 CHF = 20 CHF

SC12 Educator's Session 80

Page 81: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

References Slides adapted from materials in:

Roger Pressman. Software Engineering: A Practitioner’s Approach. 7th edition.

Jeff Tian. Software Quality Engineering: Testing, Quality Assurance and Quantifiable Improvement.

Jansen, D. and Saiedian, H. “Test-Driven Development: Concepts, Taxonomy, and Future Direction.” Computer. Sept. 2005. p. 43-50

Erdogmus, H., Morisio, M., and Torchiano, M. “On the Effectiveness of the Test-First Approach to Programming.” IEEE Transactions on Software Engineering. 31(5): 226-237. March 2006.

Example taken from Kenneth Anderson, Univ. of Colorado, Boulder

SC12 Educator's Session 81

Page 82: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

Materials

Updated slides and handouts available on the web

http://carver.cs.ua.edu/SC12_Tutorial/

SC12 Educator's Session 82

Page 83: Transparency Masters for Software Engineering: A ...sc12.supercomputing.org/hpceducator/TestDriven...References Slides adapted from materials in: Roger Pressman. Software Engineering:

HANDS-ON TIME

SC12 Educator's Session 83