The Art of Unit Testing

Size: px
Start display at page:

Download "The Art of Unit Testing"

Transcription

1 The Art of Unit Testing with Examplee in.net Roy Oeberove 11 MANNING Greenwich (74 w. long.)

2 Contents foreword t xv preface xvii acknowledgments xix about this book xx about the cover illustration XXIII PART 1 GETTING STARTED 1 1 The basics of unit testing 3 /. / Unit testing the classic definition 4 The importance of writing "good" unit tests all written unit tests (sort of) Properties of a good unit test Integration tests 7 Drawbacks of integration tests compared to automated unit tests 9 /.4 öms/ unit test a definition A simple unit test example Test-driven development Summary 19 5 о We've 2 A first unit test Frameworks for unit testing 22 What unit-testing frameworks offer frameworks о The xunit ix

3 x Contents 2.2 Introducing the Log An project Firet steps with NUnit 26 Installing NUnit 26 о Loading up the solution 26 о Using the NUnit attributes in your code 29 Z-4 Writing our first test 50 The Assert class 31 о Running our first test with NUnit 32 о Fixing our code and passing the test 33 о From red to green More NUnit attributes 54 Setup and teardown 34 о Checking for expected exceptions 36 о Ignoring tests 3S> о Setting test categories 39? Indirect testing of state Summary 44 PART 2 CORE TECHNIQUES 47 3 Using stubs to break dependencies 49 5/ Introducing stubs SO 5.2 Identifying a filesystem dependency in Log An Determining how to easily test LogAnalyzer Refactoring our design to be more testable 55 Extract an interface to allow replacing underlying implementation 55 о Inject stub implementation into a class under test 50 о Receive an interface at the constructor level [constructor injection) 55 о Receive an interface as a property get or set 64 о Getting a stub just before a method call Variations on refactoring techniques 74 Using Extract and Override to create stub results > Overcoming the encapsulation problem 77 Using internal and [InternalsVisibleTo] 70 о Using the [Conditional] attribute 79 о Using #if and #endif with conditional compilation 8>0 5.7 Summary 30

4 Contents 4 Interaction testing using mock objects &2 4.1 State-based versus interaction testing The difference between mocks and stubs A simple manual mock example Using a mock and a stub together One mock per test Stub chains: stubs that produce mocks or other stubs 4.7 The problems with handwritten mocks and stubs Summary 97 5 Isolation (mock object) frameworks Why use isolation frameworks? ЮО 5.2 Dynamically creating a fake object 102 Introducing Rhino Mocks into your tests 102 о Replacing a handwritten mock object with a dynamic one Strict versus nonstrict mock objects 106 Strict тоске Ю6 о Nonstrict mocks Returning values from fake objects ЮЗ 5.5 Creating smart stubs with an isolation framework 110 Creating a stub in Rhino Mocks 110 о Combining dynamic stubs and mocks Parameter constraints for mocks and stubs 115 Checking parameters with string constraints 115 Checking parameter object properties with constraints 11Ö о Executing callbacks for parameter verification Testing for event-related activities 121 Testing thatan event has been subscribed to 122 о Triggering events from mocks and stubs 123 о Testing whether an event was triggered Arrange-act-assert syntax for isolation Currentisolationframeworksfor.NET 130 NUnit.Mocks 130 о NMock 131 о NMock2 131 о Typemock Isolator 132 Rhino Mocks 132 о Moq 134

5 xii Contents 5.Ю Advantages of isolation frameworks Traps to avoid when using isolation frameworks 135 Unreadable test code 135 о Verifying the wrong things 136 о Having more than one mock per test 136 о Overspecifying the tests Summary 137 PART3 THE TE5T CODE Test hierarchies and organization 141 и 7 Having automated builds run automated tests 142 Anatomy of an automated build 142 о Triggering builds and continuous Integration 144 о Automated build types 144?.i? Mapping out tests based on speed and type 145 The human factor of separating unit from Integration tests 146 о The safe green zone Ensuring tests are part of source control Mapping test classes to code under test 143 Mapping tests to projects 145 о Mapping tests to classes 149 Mapping tests to specific methods uilding a test API for your application ' 150 Using test class Inheritance patterns 151 о Creating test utility classes and methods 167 Making your API known to developers Summary The pillars of good tests 171 Z7 Writing trustworthy tests 172 Deciding when to remove or change tests 172 о Avoiding logic in tests 175 о Testing only one thing 179 о Making tests easy to run 1&0 о Assuring code coverage Writing maintainable tests 131 Testing private or protected methods 182 о Removing duplication 184 о Using setup methods In a maintainable manner 188 о Enforcing test isolation 191 о Avoiding multiple asserts 198 о

6 Contents xiii Avoiding testing multiple aspects of the same object 202 о Avoiding overspecification in tests 205 ZJ Writing readable teste 209 Naming unit tests 210 о Naming variables 211 о Asserting yourself with meaning 212 о Separating asserts from actions 214 о Setting up and tearing down 214 Z-4 Summary 215 PART 4 DESIGN AND PROCESS Integrating unit testing into the organization 219 Ä 7 Steps to becoming an agent of change 220 F3e prepared for the tough questions 220 о Convince insiders: champions and blockers 220 о Identify possible entry points 222 Äi? H^j/5 ft? succeed 223 Guerrilla implementation (bottom-up) 223 о Convincing management (top-down) 224 о Getting an outside champion 224 о Making progress visible 225 о Aiming for specific goals 227 о Realizing that there will be hurdles 22Ö 3.3 Ways to fail 229 Lack of a driving force 229 о Lack of political support 229 о 3ad implementations and first impressions 230 о Lack of team support Tough questions and answers 231 How much time will this add to the current process? 231 о Will my QA job be at risk because of this? 233 о How do we know this is actually working? 234 о Is there proof that unit testing helps? 234 о Why is the QA department still finding bugs? 235 о We have lots of code without tests: where do we start? 235 о We work in several languages: is unit testing feasible? 236 о What if we develop a combination of software and hardware? 236 о How can we know we don't have bugs in our tests? 236 о I see In my debugger that my code works fine: why do I need tests? 237 о Must we do TCP-style coding? Summary 233

7 xiv Contents 9 Working with legacy code Where do you start adding tests? Choosing a selection strategy 242 Pros and cons of the easy-first strategy 242 о Pros and cone of the hard-first strategy Writing integration tests before refactoring Important tools for legacy code unit testing 246 Isolate dependencies easily with Typemock Isolator 246 о Find testability problems with Depender 246 Use JMockit for Java legacy code 246 о Use Vise while refactoring your Java code 250 о Use FitNesse for acceptance tests before you refactor 251 о Read Michael Feathers' book on \egacy code 253 о Use NDepend to investigate your production code 253 о Use ReSharperto navigate and refactor production code 253 о Detect duplicate code {and bugs) with Simian 254 о Detect threading issues with Typemock Racer 254 Ä5 Summary 254 Appendix A Design and testability 256 Appendix 3 Extra toole and frameworks 268 Index 264

the art of with Examples in.net ROY OSHEROVE MANNING

the art of with Examples in.net ROY OSHEROVE MANNING the art of with Examples in.net MANNING ROY OSHEROVE Early Praise for The Art of Unit Testing The Art of Unit Testing provides a thorough, incremental introduction to writing tests as part of the programming

More information

Effective Unit Testing

Effective Unit Testing Effective Unit Testing A guide forjava developers LASSE KOSKELA 11 MANNING Shelter Island contents xv preface acknowledgments xvii about this book xix about the cover illustration xxiv Part 1 Foundations

More information

Want Better Software? TEST it! (and thenwrite it) Tame defects before they appear You Rise/Bugs Fall

Want Better Software? TEST it! (and thenwrite it) Tame defects before they appear You Rise/Bugs Fall Want Better Software? TEST it! (and thenwrite it) Tame defects before they appear You Rise/Bugs Fall Introduction TDD had its origins as an integral part of Extreme Programming TDD, BDD, DDD and the coming

More information

JAVA CONCEPTS Early Objects

JAVA CONCEPTS Early Objects INTERNATIONAL STUDENT VERSION JAVA CONCEPTS Early Objects Seventh Edition CAY HORSTMANN San Jose State University Wiley CONTENTS PREFACE v chapter i INTRODUCTION 1 1.1 Computer Programs 2 1.2 The Anatomy

More information

Philosophy of Unit Testing

Philosophy of Unit Testing Unit Testing in.net Philosophy of Unit Testing What? Where? Why? How? What it is not? Test individual components (units) in isolation isolate and validate verify to confirm preexisting specification. Inputs

More information

By Philip Japikse MVP, MCSD.Net, MCDBA, CSM Principal Consultant Pinnacle Solutions Group

By Philip Japikse MVP, MCSD.Net, MCDBA, CSM Principal Consultant Pinnacle Solutions Group By Philip Japikse Phil.Japikse@pinnsg.com MVP, MCSD.Net, MCDBA, CSM Principal Consultant Pinnacle Solutions Group Phone:513-619-6323 Fax:513-791-5202 1 Principal Consultant, Pinnacle Solutions Group, Inc.

More information

BDD in Action. Behavior-Driven Development for. the whole software lifecycle JOHN FERGUSON SMART MANNING. Shelter Island

BDD in Action. Behavior-Driven Development for. the whole software lifecycle JOHN FERGUSON SMART MANNING. Shelter Island BDD in Action Behavior-Driven Development for the whole software lifecycle JOHN FERGUSON SMART 11 MANNING Shelter Island contents foreword xvii preface xxi acknowledgements about this book xxv xxiii about

More information

Quality Code. Software Testing Principles, Practices, and Patterns. Stephen Vance. AAddison-Wesley

Quality Code. Software Testing Principles, Practices, and Patterns. Stephen Vance. AAddison-Wesley Quality Code Software Testing Principles, Practices, and Patterns Stephen Vance AAddison-Wesley Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid

More information

the art of with Examples in.net ROY OSHEROVE MANNING

the art of with Examples in.net ROY OSHEROVE MANNING the art of with Examples in.net MANNING ROY OSHEROVE The Art of Unit Testing with Examples in.net by Roy Osherove Chapter 1 Copyright 2009 Manning Publications Brief contents PART 1 GETTING STARTED 1 1

More information

SAP' ABAP. Handbook. Kogent Learning Solutions, Inc. Sudbury, Massachusetts JONES AND BARTLETT PUBLISHERS BOSTON TORONTO LONDON SINUAPORI:

SAP' ABAP. Handbook. Kogent Learning Solutions, Inc. Sudbury, Massachusetts JONES AND BARTLETT PUBLISHERS BOSTON TORONTO LONDON SINUAPORI: SAP' ABAP Handbook Kogent Learning Solutions, Inc. JONES AND BARTLETT PUBLISHERS Sudbury, Massachusetts BOSTON TORONTO LONDON SINUAPORI: Table of Contents Introduction xxi About This Book How to Use This

More information

object/relational persistence What is persistence? 5

object/relational persistence What is persistence? 5 contents foreword to the revised edition xix foreword to the first edition xxi preface to the revised edition xxiii preface to the first edition xxv acknowledgments xxviii about this book xxix about the

More information

COPYRIGHTED MATERIAL. Contents. Part One: Team Architect 1. Chapter 1: Introducing the Visual Designers 3

COPYRIGHTED MATERIAL. Contents. Part One: Team Architect 1. Chapter 1: Introducing the Visual Designers 3 About the Authors Acknowledgments Introduction Part One: Team Architect 1 Chapter 1: Introducing the Visual Designers 3 Why Design Visually? 4 Microsoft s Modeling Strategy 5 Model-driven development 5

More information

"Charting the Course... Java Programming Language. Course Summary

Charting the Course... Java Programming Language. Course Summary Course Summary Description This course emphasizes becoming productive quickly as a Java application developer. This course quickly covers the Java language syntax and then moves into the object-oriented

More information

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

More information

Pro XAML with C# From Design to Deployment on WPF, Windows Store, and Windows Phone. Buddy James. Lori Lalonde

Pro XAML with C# From Design to Deployment on WPF, Windows Store, and Windows Phone. Buddy James. Lori Lalonde Pro XAML with C# From Design to Deployment on WPF, Windows Store, and Windows Phone Buddy James Lori Lalonde Contents J About the Authors About the Technical Reviewer Acknowledgments Introduction xiii

More information

Unit testing basics & more...

Unit testing basics & more... Unit testing basics & more... by Papapetrou P.Patroklos Twitter hashtag : Thessaloniki Java Meetup - December 2014 Agenda Unit testing introduction Differences with other types of tests Key concepts Rules

More information

POJOs in Action DEVELOPING ENTERPRISE APPLICATIONS WITH LIGHTWEIGHT FRAMEWORKS CHRIS RICHARDSON MANNING. Greenwich (74 w. long.)

POJOs in Action DEVELOPING ENTERPRISE APPLICATIONS WITH LIGHTWEIGHT FRAMEWORKS CHRIS RICHARDSON MANNING. Greenwich (74 w. long.) POJOs in Action DEVELOPING ENTERPRISE APPLICATIONS WITH LIGHTWEIGHT FRAMEWORKS CHRIS RICHARDSON MANNING Greenwich (74 w. long.) contents PART 1 1 preface xix acknowledgments xxi about this book xxiii about

More information

Jim Jackson II Ian Gilman

Jim Jackson II Ian Gilman Single page web apps, JavaScript, and semantic markup Jim Jackson II Ian Gilman FOREWORD BY Scott Hanselman MANNING contents 1 HTML5 foreword xv preface xvii acknowledgments xx about this book xxii about

More information

Contents. Acknowledgments

Contents. Acknowledgments Contents Acknowledgments Introduction Why Another Book About Web Application Development? How Is This Book Arranged? Intended Audience Do I Need to Start from Scratch? Choosing Development Tools Summary

More information

Contents in Detail. Foreword by Xavier Noria

Contents in Detail. Foreword by Xavier Noria Contents in Detail Foreword by Xavier Noria Acknowledgments xv xvii Introduction xix Who This Book Is For................................................ xx Overview...xx Installation.... xxi Ruby, Rails,

More information

JUnit 3.8.1, 64. keep it simple stupid (KISS), 48

JUnit 3.8.1, 64. keep it simple stupid (KISS), 48 Index A accessor methods, 11, 152 add parameter technique, 189 190 add() method, 286 287, 291 algorithm, substituting, 104 105 AND logical operator, 172 architectural design patterns, 277 278 architecture,

More information

Unit Testing with NUnit

Unit Testing with NUnit Unit Testing with NUnit About Codemanship Software development training & coaching Founded in 2009 in London Clients include BBC, UBS, Waters, Sage, John Lewis, NHS & Salesforce Organiser of original Software

More information

"Charting the Course... Comprehensive Angular. Course Summary

Charting the Course... Comprehensive Angular. Course Summary Description Course Summary Angular is a powerful client-side JavaScript framework from Google that supports simple, maintainable, responsive, and modular applications. It uses modern web platform capabilities

More information

VERIFICATION AND VALIDATION FOR QUALITY OF UML 2.0 MODELS

VERIFICATION AND VALIDATION FOR QUALITY OF UML 2.0 MODELS VERIFICATION AND VALIDATION FOR QUALITY OF UML 2.0 MODELS BHUVAN UNHELKAR, PHD WILEY- INTERSCIENCE A Wiley-lnterscience Publication JOHN WILEY & SONS, INC. Contents Figures Foreword Preface Acknowledgments

More information

The basics of unit testing

The basics of unit testing The basics of unit testing This chapter covers Defining a unit test Contrasting unit testing with integration testing Exploring a simple unit testing example Understanding test-driven development There

More information

Completely

Completely Completely Test-Driven ian.truslove@nsidc.org @iantruslove UCAR Software Engineering Assembly, Feb 21, 2012 What s In It For Me? So, that TDD sounds great and all, but what about ? See some techniques

More information

Design patterns using Spring and Guice

Design patterns using Spring and Guice Design patterns using Spring and Guice Dhanji R. Prasanna MANNING contents 1 Dependency 2 Time preface xv acknowledgments xvii about this book xix about the cover illustration xxii injection: what s all

More information

Foundations of object orientation

Foundations of object orientation Foreword Preface List of projects discussed in detail in this book Acknowledgments Part 1 Chapter 1 Chapter 2 Foundations of object orientation Objects and classes 1.1 Objects and classes 1.2 Creating

More information

Acknowledgments Introduction. Part I: Programming Access Applications 1. Chapter 1: Overview of Programming for Access 3

Acknowledgments Introduction. Part I: Programming Access Applications 1. Chapter 1: Overview of Programming for Access 3 74029ftoc.qxd:WroxPro 9/27/07 1:40 PM Page xiii Acknowledgments Introduction x xxv Part I: Programming Access Applications 1 Chapter 1: Overview of Programming for Access 3 Writing Code for Access 3 The

More information

Whom Is This Book For?... xxiv How Is This Book Organized?... xxiv Additional Resources... xxvi

Whom Is This Book For?... xxiv How Is This Book Organized?... xxiv Additional Resources... xxvi Foreword by Bryan Hunter xv Preface xix Acknowledgments xxi Introduction xxiii Whom Is This Book For?... xxiv How Is This Book Organized?... xxiv Additional Resources... xxvi 1 Meet F# 1 F# in Visual Studio...

More information

Fundamentals of the Java Programming Language

Fundamentals of the Java Programming Language Fundamentals of the Java Programming Language Student Guide SL-110 REV E D61798GC10 Edition 1.0 2009 D62399 Copyright 2006, 2009, Oracle and/or its affiliates. All rights reserved. Disclaimer This document

More information

Objects First with Java

Objects First with Java ^ Objects First with Java A Practical Introduction using BlueJ David J. Barnes and Michael Kolling Second edition PEARSON Prentice Hall Harlow, England London New York Boston San Francisco Toronto Sydney

More information

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration

foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration contents foreword to the first edition preface xxi acknowledgments xxiii about this book xxv about the cover illustration xix xxxii PART 1 GETTING STARTED WITH ORM...1 1 2 Understanding object/relational

More information

CITY UNIVERSITY OF NEW YORK. Creating a New Project in IRBNet. i. After logging in, click Create New Project on left side of the page.

CITY UNIVERSITY OF NEW YORK. Creating a New Project in IRBNet. i. After logging in, click Create New Project on left side of the page. CITY UNIVERSITY OF NEW YORK Creating a New Project in IRBNet i. After logging in, click Create New Project on left side of the page. ii. Enter the title of the project, the principle investigator s (PI)

More information

A Separation of Concerns Clean Architecture on Android

A Separation of Concerns Clean Architecture on Android A Separation of Concerns Clean Architecture on Android Kamal Kamal Mohamed Android Developer, //TODO Find Better Title @ Outware Mobile Ryan Hodgman Official Despiser of Utils Classes @ Outware Mobile

More information

"Charting the Course... Comprehensive Angular 5. Course Summary

Charting the Course... Comprehensive Angular 5. Course Summary Course Summary Description Comprehensive Angular teaches students the skills and best practices they need to design, build, test, and deploy applications that provide rich end-user experiences similar

More information

Excel Programming with VBA (Macro Programming) 24 hours Getting Started

Excel Programming with VBA (Macro Programming) 24 hours Getting Started Excel Programming with VBA (Macro Programming) 24 hours Getting Started Introducing Visual Basic for Applications Displaying the Developer Tab in the Ribbon Recording a Macro Saving a Macro-Enabled Workbook

More information

Introduction to C++/CLI 3. What C++/CLI can do for you 6 The rationale behind the new syntax Hello World in C++/CLI 13

Introduction to C++/CLI 3. What C++/CLI can do for you 6 The rationale behind the new syntax Hello World in C++/CLI 13 contents preface xv acknowledgments xvii about this book xix PART 1 THE C++/CLI LANGUAGE... 1 1 Introduction to C++/CLI 3 1.1 The role of C++/CLI 4 What C++/CLI can do for you 6 The rationale behind the

More information

C# Programming: From Problem Analysis to Program Design. Fourth Edition

C# Programming: From Problem Analysis to Program Design. Fourth Edition C# Programming: From Problem Analysis to Program Design Fourth Edition Preface xxi INTRODUCTION TO COMPUTING AND PROGRAMMING 1 History of Computers 2 System and Application Software 4 System Software 4

More information

Test Driven Development (TDD), and Working with Legacy Code Using C# Workshop ( 4 days)

Test Driven Development (TDD), and Working with Legacy Code Using C# Workshop ( 4 days) Test Driven Development (TDD), and Working with Legacy Code Using C# Workshop ( 4 days) HOTEL DUBAI GRAND April 16 to 19-2018 Monday to Thursday ) (4 days) 9 am to 4 pm ISIDUS TECH TEAM FZE PO Box 9798

More information

Unit Testing. SWEN-261 Introduction to Software Engineering. Department of Software Engineering Rochester Institute of Technology

Unit Testing. SWEN-261 Introduction to Software Engineering. Department of Software Engineering Rochester Institute of Technology Unit Testing SWEN-261 Introduction to Software Engineering Department of Software Engineering Rochester Institute of Technology There are many levels of software testing. The developer of the software

More information

Introduction. Assessment Test. Part I The Programmer s Exam 1

Introduction. Assessment Test. Part I The Programmer s Exam 1 4276FM.fm Page ix Thursday, October 2, 2003 11:22 AM at a Glance Introduction Assessment Test xix xxv Part I The Programmer s Exam 1 Chapter 1 Language Fundamentals 3 Chapter 2 Operators and Assignments

More information

SQL Queries. for. Mere Mortals. Third Edition. A Hands-On Guide to Data Manipulation in SQL. John L. Viescas Michael J. Hernandez

SQL Queries. for. Mere Mortals. Third Edition. A Hands-On Guide to Data Manipulation in SQL. John L. Viescas Michael J. Hernandez SQL Queries for Mere Mortals Third Edition A Hands-On Guide to Data Manipulation in SQL John L. Viescas Michael J. Hernandez r A TT TAddison-Wesley Upper Saddle River, NJ Boston Indianapolis San Francisco

More information

Utilizing Fast Testing to Transform Java Development into an Agile, Quick Release, Low Risk Process

Utilizing Fast Testing to Transform Java Development into an Agile, Quick Release, Low Risk Process Utilizing Fast Testing to Transform Java Development into an Agile, Quick Release, Low Risk Process Introduction System tests, often called slow tests, play a crucial role in nearly every Java development

More information

Refactoring Without Ropes

Refactoring Without Ropes Refactoring Without Ropes Roger Orr OR/2 Limited The term 'refactoring' has become popular in recent years; but how do we do it safely in actual practice? Refactoring... Improving the design of existing

More information

STQA Mini Project No. 1

STQA Mini Project No. 1 STQA Mini Project No. 1 R (2) C (4) V (2) T (2) Total (10) Dated Sign 1.1 Title Mini-Project 1: Create a small application by selecting relevant system environment/ platform and programming languages.

More information

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17 List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code

More information

CITY UNIVERSITY OF NEW YORK. i. Visit:

CITY UNIVERSITY OF NEW YORK. i. Visit: CITY UNIVERSITY OF NEW YORK I. ACCESSING IRB NET (New Registration) i. Visit: https://www.irbnet.org/release/index.html ii. New users: Click on New Registration in the top right corner iii. Fill-out the

More information

C# in Depth SECOND EDITION JON SKEET. MANNING Greenwich (74 w. long.)

C# in Depth SECOND EDITION JON SKEET. MANNING Greenwich (74 w. long.) C# in Depth SECOND EDITION JON SKEET II MANNING Greenwich (74 w. long.) brief contents PART 1 PREPARING FOR THE JOURNEY 1 The changing face of C# development 2 Core foundations: building on C# 1 27 PART

More information

JUnit Testing Patterns: Mocking and Doubles

JUnit Testing Patterns: Mocking and Doubles JUnit Testing Patterns: Mocking and Doubles Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhán Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/ Unit Test Patterns:

More information

List of Code Samples. xiii

List of Code Samples. xiii xiii List of Code Samples Sample 1-1 Driving the APB pins 16 Sample 1-2 A task to drive the APB pins 17 Sample 1-3 Low-level Verilog test 17 Sample 1-4 Basic transactor code 21 Sample 2-1 Using the logic

More information

PATTERN-ORIENTED SOFTWARE ARCHITECTURE

PATTERN-ORIENTED SOFTWARE ARCHITECTURE PATTERN-ORIENTED SOFTWARE ARCHITECTURE A Pattern Language for Distributed Computing Volume 4 Frank Buschmann, Siemens, Munich, Germany Kevlin Henney, Curbralan, Bristol, UK Douglas C. Schmidt, Vanderbilt

More information

Introduction to PTC Windchill ProjectLink 11.0

Introduction to PTC Windchill ProjectLink 11.0 Introduction to PTC Windchill ProjectLink 11.0 Overview Course Code Course Length TRN-4756-T 8 Hours In this course, you will learn how to participate in and manage projects using Windchill ProjectLink

More information

Analysis of the Test Driven Development by Example

Analysis of the Test Driven Development by Example Computer Science and Applications 1 (2013) 5-13 Aleksandar Bulajic and Radoslav Stojic The Faculty of Information Technology, Metropolitan University, Belgrade, 11000, Serbia Received: June 18, 2013 /

More information

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, November 2017

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, November 2017 News in RSA-RTE 10.1 updated for sprint 2017.46 Mattias Mohlin, November 2017 Overview Now based on Eclipse Neon.3 (4.6.3) Many general improvements since Eclipse Mars Contains everything from RSARTE 10

More information

COPYRIGHTED MATERIAL. Table of Contents. Foreword... xv. About This Book... xvii. About The Authors... xxiii. Guide To The Reader...

COPYRIGHTED MATERIAL. Table of Contents. Foreword... xv. About This Book... xvii. About The Authors... xxiii. Guide To The Reader... Table of Contents Foreword..................... xv About This Book... xvii About The Authors............... xxiii Guide To The Reader.............. xxvii Part I Some Concepts.................. 1 1 On Patterns

More information

Agile Model-Driven Development with UML 2.0 SCOTT W. AM BLER. Foreword by Randy Miller UNIFIED 1420 MODELING LANGUAGE. gile 1.

Agile Model-Driven Development with UML 2.0 SCOTT W. AM BLER. Foreword by Randy Miller UNIFIED 1420 MODELING LANGUAGE. gile 1. THE OBJECT PRIMER THIRD EDITION Agile Model-Driven Development with UML 2.0 SCOTT W. AM BLER Foreword by Randy Miller UNIFIED 1420 MODELING LANGUAGE gile 1 odeling Contents Acknowledgments Foreword Preface

More information

Hovedopgave. Bringing a Legacy System under Test Control. Master i informationsteknologi Linien i softwarekonstruktion

Hovedopgave. Bringing a Legacy System under Test Control. Master i informationsteknologi Linien i softwarekonstruktion DATALOGISK INSSTITUT DET NATURVIDENSKABELIGE FAKULTET AARHUS UNIVERSITET Hovedopgave Master i informationsteknologi Linien i softwarekonstruktion Bringing a Legacy System under Test Control Af Niels Hauge

More information

Unit Testing & Testability

Unit Testing & Testability CMPT 473 Software Quality Assurance Unit Testing & Testability Nick Sumner - Fall 2014 Levels of Testing Recall that we discussed different levels of testing for test planning: Unit Tests Integration Tests

More information

GitHub code samples. Appendix B

GitHub code samples. Appendix B Appendix B GitHub code samples The vast majority of the code samples in this book were taken from Microsoft Visual Studio 2013 solutions. Although not all of them are directly runnable, they can all be

More information

Introduction. Part I: jquery API 1. Chapter 1: Introduction to jquery 3

Introduction. Part I: jquery API 1. Chapter 1: Introduction to jquery 3 Introduction xix Part I: jquery API 1 Chapter 1: Introduction to jquery 3 What Does jquery Do for Me? 4 Who Develops jquery? 5 Obtaining jquery 5 Installing jquery 5 Programming Conventions 8 XHTML and

More information

CSE wi Final Exam 3/12/18. Name UW ID#

CSE wi Final Exam 3/12/18. Name UW ID# Name UW ID# There are 13 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,

More information

mvn package -Dmaven.test.skip=false //builds DSpace and runs tests

mvn package -Dmaven.test.skip=false //builds DSpace and runs tests DSpace Testing 1 Introduction 2 Quick Start 2.1 Maven 2.2 JUnit 2.3 JMockit 2.4 ContiPerf 2.5 H2 3 Unit Tests Implementation 3.1 Structure 3.2 Limitations 3.3 How to build new tests 3.4 How to run the

More information

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the

More information

IN PRACTICE. Daniele Bochicchio Stefano Mostarda Marco De Sanctis. Includes 106 practical techniques MANNING

IN PRACTICE. Daniele Bochicchio Stefano Mostarda Marco De Sanctis. Includes 106 practical techniques MANNING IN PRACTICE Daniele Bochicchio Stefano Mostarda Marco De Sanctis Includes 106 practical techniques MANNING contents preface xv acknowledgments xvii about this book xix about the authors xxiii about the

More information

Quick guide to Moq. 1 - About. 2 - Moq basics What is it? Licensing Homepage Contributors. 2.

Quick guide to Moq. 1 - About. 2 - Moq basics What is it? Licensing Homepage Contributors. 2. Quick guide to Moq 1 - About 1.1 - What is it? The author says: Moq (pronounced "Mock-you" or just "Mock") is the only mocking library for.net developed from scratch to take full advantage of.net 3.5 (i.e.

More information

Pro JPA 2. Mastering the Java Persistence API. Apress* Mike Keith and Merrick Schnicariol

Pro JPA 2. Mastering the Java Persistence API. Apress* Mike Keith and Merrick Schnicariol Pro JPA 2 Mastering the Java Persistence API Mike Keith and Merrick Schnicariol Apress* Gootents at a Glance g V Contents... ; v Foreword _ ^ Afooyt the Author XXj About the Technical Reviewer.. *....

More information

Introduction to Testing and Maintainable code

Introduction to Testing and Maintainable code Introduction to Testing and Maintainable code Reasons not to write unit tests 1. I don't know how to write tests. 2. Writing tests is too hard. 3. I don't have enough time to write tests. 4. Testing is

More information

Foreword by Katie Moussouris... Acknowledgments... xvii. Introduction...xix. Chapter 1: The Basics of Networking... 1

Foreword by Katie Moussouris... Acknowledgments... xvii. Introduction...xix. Chapter 1: The Basics of Networking... 1 Brief Contents Foreword by Katie Moussouris.... xv Acknowledgments... xvii Introduction...xix Chapter 1: The Basics of Networking... 1 Chapter 2: Capturing Application Traffic... 11 Chapter 3: Network

More information

CSE 403 Lecture 16. Continuous Integration; Integration Testing. Reading:

CSE 403 Lecture 16. Continuous Integration; Integration Testing. Reading: CSE 403 Lecture 16 Continuous Integration; Integration Testing Reading: Continuous Integration (Fowler) The Art of Unit Testing, Ch. 1, 3, 4-5 (Osherove) Code Complete, Ch. 29 (McConnell) slides created

More information

Growing Embedded Applications Organically with Ceedling and Friends. Greg Williams

Growing Embedded Applications Organically with Ceedling and Friends. Greg Williams Growing Embedded Applications Organically with Ceedling and Friends Greg Williams Embedded Development... Limited Memory Limited Processing Power Language Limitations Short Timelines Growing Complexity

More information

OSGi in Action. RICHARD S. HALL KARL PAULS STUART McCULLOCH DAVID SAVAGE CREATING MODULAR APPLICATIONS IN JAVA MANNING. Greenwich (74 w. long.

OSGi in Action. RICHARD S. HALL KARL PAULS STUART McCULLOCH DAVID SAVAGE CREATING MODULAR APPLICATIONS IN JAVA MANNING. Greenwich (74 w. long. OSGi in Action CREATING MODULAR APPLICATIONS IN JAVA RICHARD S. HALL KARL PAULS STUART McCULLOCH DAVID SAVAGE 11 MANNING Greenwich (74 w. long.) contents foreword xiv preface xvii acknowledgments xix about

More information

C ONTENTS PART I FUNDAMENTALS OF PROGRAMMING 1. and Java 3. Chapter 1 Introduction to Computers, Programs,

C ONTENTS PART I FUNDAMENTALS OF PROGRAMMING 1. and Java 3. Chapter 1 Introduction to Computers, Programs, C ONTENTS PART I FUNDAMENTALS OF PROGRAMMING 1 Chapter 1 Introduction to Computers, Programs, and Java 3 1.1 Introduction 4 1.2 What Is acomputer? 4 1.3 Programs 7 1.4 Operating Systems 9 1.5 Number Systems

More information

Build Testable Client and Service Applications

Build Testable Client and Service Applications Build Testable Client and Service Applications Brian Noyes IDesign Inc (www.idesign.net) brian.noyes@idesign.net About Brian Chief Architect IDesign Inc. (www.idesign.net) Microsoft Regional Director MVP

More information

Rational Functional Tester - Tips and Tricks

Rational Functional Tester - Tips and Tricks IBM Rational Software Development Conference 2006 Rational Functional Tester - Tips and Tricks Suma Byrappa IBM Rational Swathi Rao 2006 IBM Corporation Agenda IBM Rational Software Development Conference

More information

Course Outline. ProTech Professional Technical Services, Inc. Comprehensive Angular 7 Course Summary. Description

Course Outline. ProTech Professional Technical Services, Inc. Comprehensive Angular 7 Course Summary. Description Course Summary Description Use Angular 7 to easily build web applications that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server. Learn

More information

Unit Testing. SWEN-610 Foundations of Software Engineering. Department of Software Engineering Rochester Institute of Technology

Unit Testing. SWEN-610 Foundations of Software Engineering. Department of Software Engineering Rochester Institute of Technology Unit Testing SWEN-610 Foundations of Software Engineering Department of Software Engineering Rochester Institute of Technology There are many levels of software testing. The developer of the software has

More information

Mockito is a mocking framework that tastes really good.

Mockito is a mocking framework that tastes really good. Mockito Mockito is a mocking framework that tastes really good. It lets you write beautiful tests with clean & simple API. Mockito doesn't give you ha angover because the tests are very readable and they

More information

Test Driven Development: Pair programming to the max. Klaas van Gend, 040coders.nl, March 15, 2018

Test Driven Development: Pair programming to the max. Klaas van Gend, 040coders.nl, March 15, 2018 Test Driven Development: Pair programming to the max Klaas van Gend, 040coders.nl, March 15, 2018 1 Klaas van Gend Hobby: Hobby: {040coders.nl} Hobby: 2 3 1949 1953 4 source optics 4 meter stage more optics

More information

Test Driven Development For Embedded C (Pragmatic Programmers) PDF

Test Driven Development For Embedded C (Pragmatic Programmers) PDF Test Driven Development For Embedded C (Pragmatic Programmers) PDF Another day without Test-Driven Development means more time wasted chasing bugs and watching your code deteriorate. You thought TDD was

More information

jquery Cookbook jquery Community Experts O'REILLY8 Tokyo Taipei Sebastopol Beijing Cambridge Farnham Koln

jquery Cookbook jquery Community Experts O'REILLY8 Tokyo Taipei Sebastopol Beijing Cambridge Farnham Koln jquery Cookbook jquery Community Experts O'REILLY8 Beijing Cambridge Farnham Koln Sebastopol Taipei Tokyo Foreword xi Contributors xiii Preface xvii 1. jquery Basics 1 1.1 Including the jquery Library

More information

Xcode 6 Start to Finish

Xcode 6 Start to Finish Xcode 6 Start to Finish ios and OS X Development Fritz Anderson VAddison-Wesley New York Boston Indianapolis San Francisco Toronto Montreal Capetown Sydney London Munich Paris Madrid Tokyo Singapore Mexico

More information

CHAPTER 1: INTRODUCING C# 3

CHAPTER 1: INTRODUCING C# 3 INTRODUCTION xix PART I: THE OOP LANGUAGE CHAPTER 1: INTRODUCING C# 3 What Is the.net Framework? 4 What s in the.net Framework? 4 Writing Applications Using the.net Framework 5 What Is C#? 8 Applications

More information

8. Quality Assurance

8. Quality Assurance 8. Quality Assurance Prof. Dr. Dirk Riehle, M.B.A. Friedrich Alexander-University Erlangen-Nürnberg Version of 22.03.2012 Agile Methods by Dirk Riehle is licensed under a Creative Commons Attribution-

More information

Eclipse Summit Europe Summary

Eclipse Summit Europe Summary Eclipse Summit Europe 2007 Symposia Integrating Test-Driven Development in the Development Process Summary Christine Mitterbauer, George Mesesan MicroDoc Computersysteme GmbH Elektrastrasse 6 D-81925 München

More information

Programming in Scala Second Edition

Programming in Scala Second Edition Programming in Scala Second Edition Martin Odersky, Lex Spoon, Bill Venners artima ARTIMA PRESS WALNUT CREEK, CALIFORNIA Contents Contents List of Figures List of Tables List of Listings Foreword Foreword

More information

Functional Testing (Testování funkčnosti)

Functional Testing (Testování funkčnosti) Functional Testing (Testování funkčnosti) http://d3s.mff.cuni.cz Pavel Parízek parizek@d3s.mff.cuni.cz CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Nástroje pro vývoj software Functional

More information

Program Correctness and Efficiency. Chapter 2

Program Correctness and Efficiency. Chapter 2 Program Correctness and Efficiency Chapter 2 Chapter Objectives To understand the differences between the three categories of program errors To understand the effect of an uncaught exception and why you

More information

C# in Depth THIRD EDITION

C# in Depth THIRD EDITION C# in Depth THIRD EDITION JON SKEET MANNING SHELTER ISLAND brief contents PART 1 PREPARING FOR THE JOURNEY...1 1 The changing face of C# development 3 2 Core foundations: building on C# 1 29 PART 2 C#

More information

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, January 2018

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, January 2018 News in RSA-RTE 10.1 updated for sprint 2018.03 Mattias Mohlin, January 2018 Overview Now based on Eclipse Neon.3 (4.6.3) Many general improvements since Eclipse Mars Contains everything from RSARTE 10

More information

JUnit in EDA Introduction. 2 JUnit 4.3

JUnit in EDA Introduction. 2 JUnit 4.3 Lunds tekniska högskola Datavetenskap, Nov 25, 2010 Görel Hedin EDA260 Programvaruutveckling i grupp projekt Labb 3 (Test First): Bakgrundsmaterial JUnit in EDA260 1 Introduction The JUnit framework is

More information

C++/CLI in Action NISHANT SIVAKUMAR MANNING. Greenwich (74 w. long.)

C++/CLI in Action NISHANT SIVAKUMAR MANNING. Greenwich (74 w. long.) C++/CLI in Action NISHANT SIVAKUMAR 11 MANNING Greenwich (74 w. long.) brief contents PART 1 THE C++/CLI LANGUAGE 1 1 IntroductiontoC++/CLI 3 2 Getting into the CLI: properties, delegates and arrays 46

More information

Welcome to Starting Out with Programming Logic and Design, Third Edition.

Welcome to Starting Out with Programming Logic and Design, Third Edition. Welcome to Starting Out with Programming Logic and Design, Third Edition. This book uses a language-independent approach to teach programming concepts and problem-solving skills, without assuming any previous

More information

CONTENTS. INTRODUCTION xvii

CONTENTS. INTRODUCTION xvii INTRODUCTION xvii SECTION I: AN INTRODUCTION TO JAVA FOR RPG PROGRAMMERS 1 CHAPTER 1: JAVA FOR RPG PROGRAMMERS 3 AS/400 LIBRARIES AND JAVA PACKAGES 3 IMPORT 6 A PROGRAM WITH CLASS 7 LET S START HERE 7

More information

Friendship in Service of Testing

Friendship in Service of Testing Friendship in Service of Testing Gábor Márton, martongabesz@gmail.com Zoltán Porkoláb, gsd@elte.hu 1 / 47 Agenda Introduction, principals Case study Making the example better Vision 2 / 47 Functional Programming

More information

Learning C# 3.0. Jesse Liberty and Brian MacDonald O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo

Learning C# 3.0. Jesse Liberty and Brian MacDonald O'REILLY. Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo Learning C# 3.0 Jesse Liberty and Brian MacDonald O'REILLY Beijing Cambridge Farnham Köln Sebastopol Taipei Tokyo Table of Contents Preface xv 1. C# and.net Programming 1 Installing C# Express 2 C# 3.0

More information

CHAPTER 1: INTRODUCTION TO THE IDE 3

CHAPTER 1: INTRODUCTION TO THE IDE 3 INTRODUCTION xxvii PART I: IDE CHAPTER 1: INTRODUCTION TO THE IDE 3 Introducing the IDE 3 Different IDE Appearances 4 IDE Configurations 5 Projects and Solutions 6 Starting the IDE 6 Creating a Project

More information

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, July 2017

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, July 2017 News in RSA-RTE 10.1 updated for sprint 2017.28 Mattias Mohlin, July 2017 Overview Now based on Eclipse Neon.3 (4.6.3) Many general improvements since Eclipse Mars Contains everything from RSARTE 10 and

More information

Software Engineering

Software Engineering Software Engineering Lecture 13: Testing and Debugging Testing Peter Thiemann University of Freiburg, Germany SS 2014 Recap Recap Testing detect the presence of bugs by observing failures Recap Testing

More information

Collective Intelligence in Action

Collective Intelligence in Action Collective Intelligence in Action SATNAM ALAG II MANNING Greenwich (74 w. long.) contents foreword xv preface xvii acknowledgments xix about this book xxi PART 1 GATHERING DATA FOR INTELLIGENCE 1 "1 Understanding

More information