tdd vs. atdd - what, why, which, when & where
TRANSCRIPT
Who I am?Business Improvement ConsultantAgile Practitioner/DeveloperInnovatorHackerMakerCub MasterProfessional Snowboard Instructor
Where I’ve been?AAA Life
DelphiGeneral Motors
Blue Cross Blue ShieldCengage Learning
Delta DentalGordon Food Service (GFS)
CintasFarm Bureau Insurance
TDD vs. ATDD
Would you prefer to…
build the thing right
or build the right thing?
Seeding A Question -TDD vs. ATDD
Before we get into the “Which, When & Where” first lets cover the high level “What & Why” of
each to understand the base differences.
TDD vs. ATDD
What -
TDD or Test Driven Development (also sometimes referred to as Test Driven Design) is a software development approach in which a test is written before writing the code. Once the new code passes the test, it is refactored to an acceptable standard.
TDD vs. ATDD
What -
TDD ensures that the source code is thoroughly unit tested and leads to modularized, flexible and extensible code. It focuses on writing only the code necessary to pass tests, making the design simple and clear.
TDD vs. ATDD
What -
ATDD or Acceptance Test Driven Development is an extension/revision of TDD. Its purpose is to help aid the folks devising the system (i.e., the developers) identify the appropriate code to write -- that is, code that reflects the outcomes desired. These tests tend to be written and supported directly by testers and/or the stakeholders.
TDD vs. ATDD
What -
Behavior Driven Development (BDD) has a very similar context to ATDD, however these tests tend to be driven out by the developers themselves. For today’s talk we’ll consider them one and the same, as they both intend to achieve the same goal.
TDD vs. ATDD
What -
- Using the blank side of the 3x5 card in front of you as an example.
- Spend a couple minutes brainstorming ways that the following requirement could be TDD’d.
- “I need 11 parallel lines drawn on one side the card.”
- Discuss ideas as a group. - Assert the card orientation. - Assert first line direction. - Assert first line length. - Assert second line length. - Assert second lines distance away from the first. - Assert the color of the lines. - etc…
- Flip the card over.
- Discuss how the ruled side of the card has already been ATDD’d for us.
TDD vs. ATDD
Experimentation Exercise -
They support us by building in small, incremental and iterative pieces.
Assume you add some new functional code, compile, and test it. Chances are pretty good that your previous tests may be broken by defects that exist in the new code. It is much easier to find, and then fix, those defects if you've written just two new lines of code rather than two thousand.
TDD vs. ATDD
Why -
http://agiledata.org/essays/tdd.html#PartingThoughts
Scope Creep.
From what you ask…
TDD vs. ATDD
Why -
PROTECTION!
Anything and Everything!
Changing Requirements.
Missed Requirements.
& Most importantly… YOURSELF!
Goldplating.
With TDD the purpose is to assert that the product, system or process is being built correctly. It’s testing the independent small units or objects to make sure each works as intended.
It depends on your testing purpose…
TDD vs. ATDD
Which, When & Where -
With ATDD however, the intent is broader, as the purpose is to assert that the product, system or process being built is actually correct. It’s a mechanism to facilitate the conversation between developers and product owners about the requirements and validate the expected expectations are met.
It depends on your testing purpose…
TDD vs. ATDD
Which, When & Where -
As hinted to earlier, ATDD is often considered a superset of TDD, not a replacement for it. If your goals are only to assert the validity of the independent small units or objects then TDD should suffice.
It also depends on your testing goals…
TDD vs. ATDD
Which, When & Where -
Yet, if your goals are to also focus on the goals of your users/stakeholders and the steps they take to achieve those goals, then ATDD should be used preceding TDD. You’re no longer starting with tests of small units and therefore are less inclined to speculate on fine-grained usage or design details. Rather, you’re documenting executable specifications that prove out the product, system or process.
TDD vs. ATDD
Which, When & Where -
It also depends on your testing goals…
xTDD Pro TDD Con ATDD Pro ATDD Con
Complex X X
Verbose X X
Reuse/Inherit X X
Plain Text X X
Maintainable X X
Creates Focus X X
TDD vs. ATDD
Advantages & Dis-Avantages
Tools used for TDD… - (n)Unit Frameworks - JUnit (Java) - xUnit or nUnit (C, .Net, etc…)
Tools used for ATDD… - Cucumber, JBehave, Fit/FitNesse
Tools used for either/both… - RSpec (Ruby) - Jasmine (JavaScript) - Selenium (Web)
TDD vs. ATDD
A Few Common Tools
Code Katas - Helps hone skills through practice and repetition.
- cyber-dojo.org
- codekata.com
- thePrimeFactorsKata ~ butUncleBob.com
TDD vs. ATDD
Ways To Learn & Support
TDD vs. ATDD
Ways To Learn & Support
Pair Programming - Drives shared knowledge and collective understanding. Allows for focused learning in collaboration with an instant feedback loop.
- Across the experience: • Expert with Expert
• Expert with Novice
• Novice with Novice
- Amongst the team: • Business with Development
• Development with Testing
• Testing with Business
TDD vs. ATDD
Ways To Learn & Support
Online Training -
skillshare - Master real-world skills with hands-on projects. Hundreds of online classes to chose from.
pluralsight - A rich library of full-length online training courses for developers and IT pros, created by the best authors in the industry.
Local Training -Code Craftsman Saturdays (CodeRetreats) - Every month, on the 2nd Saturday, software devs of every stripe and level get together for a full day of pairing, test driving, food, and fun. No presentations, no vendors, and no recruiters, just software craftspeople learning from each other.
Local User Groups - sem.js Study Group
• A simple view towards the difference could be that ATDD is looking at it from “Outside In” where as TDD is looking at it from the “Inside Out”.
• With respect to aspects like…
- Code Craftsmanship - Test Coverage - Cyclomatic Complexity - etc…
it’s my belief that a high value is usually put on TDD, but we usually lack in what ATDD offers.
TDD vs. ATDD
Noteworthy Points
Both of course! It’s just knowing which to use where and when.
Would you prefer to…
build the thing right
or build the right thing? ATDDTDD
So to answer our original seeded question…
TDD vs. ATDD
Answering The Question
Business Solutions Consultancy For those who value... value.
Clients collaborate with us to solve business problems.
The first step is figuring out how we can either make or save them money.
BUSINESS AGILITY
Thank you!
Daniel Davis
@daniel_davis
linkedin.com/in/davisdaniel