Top Banner
TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo
15
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

TEST-DRIVEN DEVELOPMENT AND MVP

Cory Foy and Michael Russo

Page 2: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

What’s Ahead

Process Flavors Techniques Demo Introducing TDD Challenges Questions?

Page 3: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Process

Test versus Design Red, Green, Refactor No Production Code without a Failing

Test State Based versus Interaction Based

Tests

Page 4: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Flavors

Behavior-Driven Development Domain-Driven Design Acceptance-Test Driven Development Feature-Driven Development Example-Driven Development Hope-Driven Development

Page 5: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Techniques - Tools

xUnit Tools .NET – NUnit, MbUnit, xUnit.NET, Visual

Studio Test Tools, TD.NET, Resharper Java – JUnit, JBehave Ruby – test_unit, rSpec, Cucumber

Other Tools FitNesse/FIT AgileDocs/TestDocs

Page 6: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Techniques – Rules

Two main sources of “rules” Feather’s Rules – from Michael Feathers’

Working Effectively with Legacy Code North’s Rules – from Dan North’s BDD

sessions

Page 7: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Techniques – Feathers’ Rules Not a unit test if it

Talks to the database Communicates Across the Network Touches the File System Can’t run at the same time as your other

unit tests Have to do special things in your

environment to run it (config file changes, code changes, etc)

Page 8: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Techniques – North’s Rules

Come from Behavior-Driven Development Test Method Names should be sentences Keep Test Methods Focused It should be clear from the name what

the test is doing “Behavior” is more useful than “test” Acceptance Criteria should be executable BDD is an umbiqutious language for

analysis

Page 9: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Techniques - Spikes

When it absolutely, positively has to be there without tests

Useful for determining if something is even going to work

Timebox the Spike Throw away the code at the end and

redo it test-first

Page 10: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Techniques – Helpful Patterns Dependency Injection Separation of Concerns MVP/MVC

Model View Presenter Model View Controller

Page 11: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Demo

TDD / MVC Demo Starring

Michael Russo as “Newbie” Cory Foy as “Cory” The audience as “The Hecklers”

Page 12: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Introducing TDD

Legacy Code Pick up a copy of Working Effectively With

Legacy Code Write unit tests for bugs Write Characterization tests for features

Greenfield Project No production code without a failing test Executable Specifications Automated Acceptance Test Criteria

Page 13: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Challenges

Language Support Slow Tests Keeping up with the tests Developer Mindsets Management Mindsets Legacy Code

Page 14: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Questions?

Ask now Or, you know, ask later, afterwards, or

via email, or twitter, or we’ll give you our phone numbers. Come over for dinner. We’ll chat more then.

Page 15: TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.

Information

Agile Tampa – http://agiletampa.spaces.live.com

Cory’s Blog – http://www.cornetdesign.com

Agile Florida – http://www.agileflorida.com

NUnit – http://www.nunit.org FitNesse – http://www.fitnesse.org