TDD: How to Do it Properly and Why It's Easy
Free!
With Membership
$9.99
Suggested price

TDD: How to Do it Properly and Why It's Easy

A short practical guide you can apply right away

About the Book

If you are a software developer, you have probably heard of test-driven development (TDD). Some people even insist that you can't write good quality software without it!

We will not argue about whether or not TDD is essential. What this short booklet will do is show you how to apply TDD in real-life projects. By the time you finish reading it, you will also understand that, at the very least, TDD can be very useful. Also, it's not as complicated as many people think. Once you do it a few times, you will see that it's actually easy.

There are many approaches to doing TDD. There are also many opinions on what TDD is and isn't. In this booklet, we will not discuss any of this. We will just focus on the TDD approach that works. This booklet distills all the philosophy, arguments, etc. into a small number of fundamental principles you can learn easily and apply right away.

There are many good TDD books out there, such as "Test-Driven Development by Example" by Kent Beck. However, such a book will take you hours to read. I know you are busy. You may not have a few hours to spare. And this is precisely why I created this booklet for you.

The information provided here will take you less than an hour to read. And you can apply it right away. Then, if you still want to expand your theoretical knowledge of TDD, you can still read a book about it.

After all, TDD is not complicated at all. Let me show you exactly why.

Here is a list of the take-away skills this booklet will give you:

  • Understanding of fundamental TDD principles
  • Knowing how to follow the TDD process from beginning to end
  • Knowing how to apply TDD to new software
  • Knowing how to apply TDD while modifying the existing software
  • Knowing how to easily overcome problems and blockers while doing TDD

But most importantly, the information is presented to you in such a way that you will be able to apply all of these right away.

About the Author

Fiodar Sazanavets
Fiodar Sazanavets

I am a Microsoft MVP and a lead/senior software engineer with over a decade of professional experience. I primarily specialize in .NET and Microsoft stack. I am enthusiastic about creating well-crafted software that fully meets business needs.

Throughout my career, I have successfully developed software of various types and various levels of complexity in multiple industries. This includes a passenger information management system for a railway, distributed smart clusters of IoT devices, e-commerce systems, financial transaction processing systems, and more. I have also successfully led and mentored teams of software developers.

I enjoy sharing my knowledge with the community. This motivates me to mentor aspiring developers and create educational content, which includes blog posts, technical books, and online courses. My books include "SignalR on .NET 6 - the complete guide", "The battle hardened developer", and "The easiest way to learn design patterns". I regularly write about software development on my personal website, scientificprogrammer.net.

Table of Contents

    • Getting Started
      • Prerequisites
      • Practical examples
    • The Fundamental Rules of TDD
      • Kent Beck’s TDD rules
      • Uncle Bob’s TDD rules
      • Industry-standard TDD flow
      • Conclusion
    • A Practical Example of TDD
      • Step 1: Outlining the test cases
      • Step 1: Writing tests
      • Step 2: Writing the initial implementation
      • Adding the next test
    • What is the Scope of a Test in TDD?
      • Introduction to testing pyramid
      • The scope of TDD
      • Example of defining the scope of tests
      • What is the “unit”?
      • The concept of gears
    • Mocking: Testing the Untestable
      • Mocking basics
      • Mocking example
      • Mocking best practices
    • Where to Go From Here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub