, 36 tweets, 36 min read Read on Twitter
Getting started with Want to succeed with #TDD ? Stop writing tests! @BurkHufnagel #TDD #DevNexus devnexus.com/presentations/…
We work with software that's way more complex than a simple shape like this. Reasonable people may see the same thing in different ways, based on their perspective! @BurkHufnagel #TDD #DevNexus
You have a goal that you share with me: you want delivering better code faster
... not *writing* code more quickly! @BurkHufnagel #TDD #DevNexus
Solving the business problem is not enough ... we also need to build it the right way! Easily understood, well documented, maintainable, understandable, etc @BurkHufnagel #TDD #DevNexus
Do it now - we'll clean it up later? After a year & a half, making a simple change took a month to get through process (one change would break many things) @BurkHufnagel #TDD #DevNexus
What is #TDD ? Write tests first, then write code to make it pass. Then refactor. ... I'm still going to tell you to stop writing tests... @BurkHufnagel #TDD #DevNexus
Back in the 60s on mainframe: for this input, the output tape should look like this. Hand-code output tape data, run input through, and see whether it matched. @BurkHufnagel #TDD #DevNexus
#ExtremeProgramming Explained - most people haven't read that book (includes #TDD explanation) #xp Write failing tests. Make the test pass. Refactor only to clean up the code (no behavior change!) #RedGreenRefactor @BurkHufnagel #TDD #DevNexus
3 laws of #TDD ? Must have failing unit test to write production code. Write only enough unit test to fail (not compiling counts!). Only write enough production code to make failing test pass - can't write a whole library! @BurkHufnagel #TDD #DevNexus
Benefits of #TDD ? Fewer bugs, spend less time in debugger @BurkHufnagel #TDD #DevNexus
OH: A bug is like a special mystery made for you! 😂😂😂 <-- Thank you, session attendee <3
A lot of #TechnicalDebt is rebuilding the context of what was I doing when I wrote that mess! @BurkHufnagel #TDD #DevNexus
Benefits of #TDD ? Fewer bugs, spend less time in debugger, deliver to production faster, better code #quality, highly cohesive & loosely coupled... it's not a magic wand! TDD is a highly efficient way of doing what you already have to do anyway! @BurkHufnagel #TDD #DevNexus
"There ain't no such thing as a free lunch" - Robert Heinlein
To get the benefits of #TDD have to pay for it with something else? You have to work at it! @BurkHufnagel #TDD #DevNexus
With #TDD your performance will drop for a little bit - having to think through what to do. Now you're consciously incompetent --> becoming consciously competent!
Going through the valley of suck (any time you're #learning something new!) @BurkHufnagel #TDD #DevNexus
You're only doing 3 things in #TDD so how hard can that be?!? Changing habits is hard! You have to do the work of thinking about which test to write, how to know when done, what to call a method when refactoring @BurkHufnagel #TDD #DevNexus // Test selection is a huge area!!
Asked: how do you know what to test?
An answer I got back: if you don't know what tests to write, you don't know what code to write. @BurkHufnagel #TDD #DevNexus #testing
In #TDD "test" is the wrong word - #testing is something you do on an existing application
Right word? Specification (describes what something is supposed to do)
@BurkHufnagel #TDD #DevNexus
In order for something to go out to production, you need to know what to do in every circumstance that's interesting to the business - and to the developers! (multiple perspectives) @BurkHufnagel #TDD #DevNexus
Instead of our normal viewpoint writing the code, with #TDD we get to specify what should happen. @BurkHufnagel #TDD #DevNexus
#Cucumber was invented as a #collaboration tool. #Gherkin syntax (given, when, then) used to describe an executable specification #BDD @BurkHufnagel #TDD #DevNexus // Thinking of my awesome training with @aslak_hellesoy 🧠⌨️
#BDD and #TDD cycle: specify from the top down and everything is designed to fit together - highly efficient @BurkHufnagel #DevNexus
#Cucumber ? Scenario describes high-level behavior. Step definitions describe lower-level behavior (after matching human-readable using regex) @BurkHufnagel #TDD #DevNexus
#Spock is for the JVM, written in #Groovy , designed to be compatible with #Java (doesn't understand streams currently)
Given when then Java labels w/strings --> business person, external developer, or new team member can understand code intention! @BurkHufnagel #TDD #DevNexus
We should separate the (code) design from the implementation - #BDD as a very practical way to do that! @BurkHufnagel #TDD #DevNexus
If you have these #BDD dividers (given-when-then) of setup, execution, and assertion, it's easier to read
They back-ported this behavior from #Spock to #Groovy
@BurkHufnagel #TDD #DevNexus
If you go through this big long chain of events to get what you needed, that's yak shaving @BurkHufnagel #TDD #DevNexus
^^^ Spreading "yak shaving" to today's lucky 10,000 <3 <3 <3 c.f. xkcd.com/1053/
#Spock (HTML) report - more business people will read this than will write a #Cucumber specification @BurkHufnagel #TDD #DevNexus
Write specifications and run tests! By writing specifications, you find out much sooner than you would have otherwise! @BurkHufnagel #TDD #DevNexus
Purpose of #BDD ? @tastapod came up with BDD to help developers focus on the behavior (same idea as the specifications) @BurkHufnagel #TDD #DevNexus
Business doesn't care about logging ... until something happens! If we were tracking the transactions from the front to back, then we could see what happens... Educate the business people that "transaction monitoring" is logging --> Oh, we want that! @BurkHufnagel #TDD #DevNexus
#UnitTests test just the one method (nothing else is live). Mock out everything else! A unit test should fail for only 1 reason - because your code is broken @BurkHufnagel #TDD #DevNexus
You have fewer integration tests because they take longer to run and they're not as accurate (multiple ways to fail) <-- see #testing pyramid (example martinfowler.com/bliki/TestPyra… ) @BurkHufnagel #TDD #DevNexus
#API level #unittest ? You can have a unit test for any class, e.g. Spring controller (mocks out other service). Unit test doesn't mean lowest level class - it can be anything! It's just that one piece of code in isolation, testing the logic. @BurkHufnagel #TDD #DevNexus
One of the cool things about #Groovy is you're an adult you're responsible so you can call a private method (mocking and spying built in) @BurkHufnagel #TDD #DevNexus
OH: What's the difference between theory and practice? In theory, there's no difference, but in practice there is! @BurkHufnagel #TDD #DevNexus
Shout out to @atlantajug ajug.org

Parting thought: write specs, run tests! @BurkHufnagel #TDD #DevNexus
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Claire Moss @ DevNexus
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!

This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!