Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 1 Test-Driven Development An introduction for C# developers.

Slides:



Advertisements
Similar presentations
TDD patterns and *DD. General Patterns Isolated Test Should the running of the tests affect one another? Test List What should you test? Test First When.
Advertisements

Machine Learning on.NET F# FTW!. A few words about me  Mathias Brandewinder  Background: economics, operations research .NET developer.
Test-Driven Development José Almeida, Microsoft
A Brief Introduction to Test- Driven Development Shawn M. Jones.
Test-Driven Development. Why Testing is Important? “If you don’t have tests, how do you know your code is doing the thing right and doing the right thing?”
TEST-DRIVEN DEVELOPMENT Lecture 3. Definition Test-driven development (development through testing) is a technique of programming, in which the unit tests.
PS4: Test Driven Development Based on Test Driven Development by Example By Kent Beck.
EXtreme.NET Dr. Neil Roodyn. eXtreme.NET Who is Dr. Neil? MISSION: To increase the value of your Software Business Working with software for way too long.
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.
Based on Presentation by Mira Balaban Department of Computer Science Ben-Gurion university K. Beck: Test-Driven Development by Example slides of: Grenning.
How to Write Unit Tests in C#
An Agile View of Process
TEST-DRIVEN DEVELOPMENT 1. Test-Driven Development (TDD) Test-driven development (TDD) is a software development process that relies on the repetition.
Test-Driven Development “Test first, develop later!” –OCUnit.
Living Requirements using Behavior Driven Development
Test-Driven Development Gary Brown Building better software one test at a time.
Red-Green-Refactor! EclipseCon 2008 Kevin P. Taylor, Nicolaus Malnick Test-Driven Development (TDD) for Eclipse RCP.
TDD OVERVIEW OF TEST DRIVEN DEVELOPMENT by Paul M. code of the damned. com.
By for Test Driven Development: Industry practice and teaching tool Robert Vanderwall, Ph.D. 1 WISTPC-15.
October 2006 © Copyright 2006, Larry A. Beaty. Copying and distribution of this document is permitted in any medium, provided this notice is preserved.
Test-Driven Development With Visual Studio 2005 Erno de Weerd Info Support.
TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.
From 3 weeks to 30 minutes – a journey through the ups and downs of test automation.
Test Driven Development using Visual Studio Team System Ariel Gur-Arieh VP R&D – MCD Software Solutions
Test Driven Development TDD. Testing ”Testing can never demonstrate the absence of errors in software, only their presence” Edsger W. Dijkstra (but it.
Introduction to Unit Testing Jun-Ru Chang 2012/05/03.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
© Copyright 2005, thycotic. Test Driven Development Jonathan Cogley Maryland Cold Fusion User's Group 10/11/2005.
CSC 211 Introduction to Design Patterns. Intro to the course Syllabus About the textbook – Read the introduction and Chapter 1 Good attendance is the.
© ALEXANDRE CUVA  VERSION 2.00 Test Driven Design.
Test Driven Development Arrange, Act, Assert… Awesome Jason Offutt Software Engineer Central Christian Church
@DNNCon Don’t forget to include #DNNCon in your tweets! Effective Unit Testing for DNN James McKee Solutions Developer / Enterprise
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
By for Testing Tools: Test Automation and supporting tools Jariro Pava, Robert Vanderwall 1 WISTPC-14.
Logic Programming Module 2AIT202 Website Lecturer: Dave Sharp Room: AG15
Sofia Bulgaria Summer School IST eXPERT: Best Practice on e-Project Development 30 June - 2 July 2003 eXtreme programming.
Test driving to clean CODE Kenrick Chien CTO, Critical Phase.
Mock Objects in the Smalltalk World Dennis Schetinin.
A tool for test-driven development
CSCA48H Style and Testing. 2 Style The Zen of Python: import this Do the Goodger reading!
Copyright © 2005 Charlie Poole. All rights reserved Test First User Interfaces XP2005 Sheffield University June 18, 2005.
Test-Driven Development Eduard Miric ă. The problem.
Agile Software Development Jeff Sutherland, one of the developers started it In February 2001, 17 Tools: continuous integration, automated or xUnit test,
Refactoring - 1 CS494: Intro. to Refactoring Readings: –Refactoring for everyone: How and why to use Eclipse's automated refactoring features. By David.
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,
Test Driven Development Daniel Brown dxb17u. Introduction Originates from Extreme Programming (XP) Proposed by Kent Beck in Test Driven Development.
The Start Menu……..Exposed What you never knew existed.
1 Presentation Title Test-driven development (TDD) Overview David Wu.
Henrik Bærbak Christensen1 Test Driven Development “TDD” Summary.
Test-Driving ASP.NET Development Tampa Code Camp – July 15 th, 2006 Cory Foy
(1) Test Driven Development Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Mandatory 1 / AlphaCiv … Traps to be aware of …. Warn or not? I once asked Kent Beck the following –I have a lot of students in a course in design patterns.
Automated Testing in Sakai Testing applications and services in isolation and in context Josh Holtzman, UC Berkeley David Haines, University of Michigan.
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
Beginning Software Craftsmanship Brendan Enrick Steve Smith
Benjamin Unit Testing & Test-Driven Development for Mere Mortals.
TDD Unit tests from a slightly different point of view Katie Dwyer.
Unit Testing - solid fundamentals
Test-driven development
Test Driven Development
Test Driven Development 1 November Agenda  What is TDD ?  Steps to start  Refactoring  TDD terminology  Benefits  JUnit  Mocktio  Continuous.
Unit testing C# classes
Unit Testing & Test-Driven Development for Mere Mortals
Test Driven Development
TDD adoption plan 11/20/2018.
TDD & ATDD 1/15/2019.
Unit Testing & Test-Driven Development for Mere Mortals
Presentation transcript:

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 1 Test-Driven Development An introduction for C# developers

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 2 Who I am »Mathias Brandewinder – Background in business and quantitative analysis methods – Develop in C#/.NET for the past 5 years – Started my own business since over a year »

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 3 My goal for today »I would like you to be able to start as you leave the room

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 4 Approach »Interactive: write code live »Focus on C# »Focus primarily on NUnit – Covering also Visual Studio 2008 tools »Assuming little or no background in TDD/unit testing

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 5 The plan »What is TDD? »TDD in action: the basics – Using Nunit – Using VS2008 »Less basic TDD »Mocks »Beyond TDD »Questions

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 6 What is TDD?

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 7 Test-Driven Development »Is a development methodology – Not a testing methodology »Aims for “clean code that works, now” »Write the test first, then the code which satisfies the test

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 8 Source »Test-Driven Development By Example, Kent Beck (Addison Wesley)

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 9 The rules »Write new code only if an automated test has failed »Eliminate duplication

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 10 Red/Green/Refactor »Red: write a little test that doesn’t work, and perhaps doesn’t even compile at first »Green: make the test work quickly, committing whatever sins necessary in the process »Refactor: eliminate all of the duplication created in merely getting the test to work

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 11 Benefits: the obvious »Simple and predictable »Small steps »Fully tested code from the get-go »Very reassuring

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 12 TDD in action

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 13 It’s Monday morning, and…

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 14 Your mission, if you accept it »Add a functionality to an existing application, to compute the distance between cities

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 15 A quick math reminder »We will assume that “the world is flat” »Distance between 2 points:

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 16 Let’s get started!

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 17 What have we seen so far? »[TestFixture], [Test], Assert »One test at a time »Write “as if” you had the feature done »Write tests as “sentences” »3 patterns – Fake it ‘til you make it – Obvious implementation – Triangulate

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 18 What have we seen so far? »Separate projects »Debugging a test

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 19 Less basic TDD

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 20 Some classic useful test techniques »TestRow »Testing for exceptions »Setup & Teardown

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 21 Mocks

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 22 Mocks »“Subject under test” vs. Collaborators »Mocks to simplify your life – “Classicists”: by default, use the real thing »Mocks, the dark side of design patterns – “Mockists”: use Mocks in interactions

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 23 What have we seen so far? »When testing the interaction of a class with another class, Mocks are a convenient way to “fake” the collaborator »Focus on behavior and not state

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 24 Mocks and patterns IStrategy StrategyB StrategyA MyClass Strategy: IStrategy

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 25 Beyond TDD

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 26 A few questions »What are the benefits of TDD? »Does TDD slow you down? »How much testing is enough? »Does TDD mean no upfront design? »What are good tests? »Are TDD people terrorists?

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 27 Questions?

Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 28 To contact me…