Test Driven Development

14
Test Driven Development Ben Carey NuSoft Solutions

description

This was one of my first presentations that I gave in Columbus, Ohio at an event called "Day of .Net"

Transcript of Test Driven Development

Page 1: Test Driven Development

Test Driven Development

Ben CareyNuSoft Solutions

Page 2: Test Driven Development

The Presentation What is TDD? How do I do it? Why do it? Lessons learned Resources Q&A

What do you want to talk about? (please interrupt)

Page 3: Test Driven Development

What is TDD? Writing clean code that works The use of testing for…

Automated Feedback Incremental Design

It’s more than just unit testing Developer Tests Functional Tests Performance Tests Regression Tests Design in the context of today’s problem

Page 4: Test Driven Development

What is TDD?

Page 5: Test Driven Development

How do I do it? Think about what you want to do. Think about how to test it. Write a small test. Watch it fail. Write enough code to watch it pass. Refactor

Once and only once DRY

Repeat

Page 6: Test Driven Development

How do I do it? Demo

Page 7: Test Driven Development

Why do it? Feedback

Know what works Know what doesn’t

work Change things (and

know if it worked)

Page 8: Test Driven Development

Why do it? Communication

Executable documentation It’s always up to date How many of your requirements / design documents

can be proven? Give new team members code instead of word

documents Demonstrate intent Show usage

Page 9: Test Driven Development

Why do it?

Page 10: Test Driven Development

Why do it? Simplicity

Organic Architecture Empathetic code We (by habit) over-engineer our code Keep architecture / design in proportion to

today's needs Design based on feedback / experience

Page 11: Test Driven Development

Why do it? Courage vs. Fear

What are the implications of this change?

Did I break anything? Trust

Page 12: Test Driven Development

Lessons Learned Readable trumps well-factored Red / Green / Refactor = Flow Defects – Prove it, then fix it (forever) Adopt multiple levels of testing The 10 minute rule Use Mock objects

Page 13: Test Driven Development

Good Stuff Test Driven Development: By Example Test-Driven Development in Microsoft .Net Pragmatic Unit Testing in C# with NUnit

www.testdriven.com www.testingreflections.com www.c2.com

Page 14: Test Driven Development

The EndContact Info:

Ben [email protected] Solutions614-607-3754