Do teams really practice strict test-driven development?

0
2
Asked By VelvetMango42 On

I've been reading about Test-Driven Development and want to know how often teams actually follow the classic red-green-refactor loop: write one failing test for a specific behavior, implement the simplest code that makes it pass, then refactor while keeping the tests green. I'm not asking about simply having good test coverage or adding tests after implementation. Are there companies or teams that use strict TDD most of the time? If so, what kinds of work is it best suited for, how does it hold up in large codebases, and what benefits or drawbacks have you seen?

4 Answers

Answered By RiverPebble29 On

The biggest benefit is not just catching bugs early. Starting with a test forces you to clarify the expected behavior and usually leads to smaller, more modular, testable components. The approach is especially valuable for complicated logic and long-lived systems. But it can become expensive when requirements are uncertain, tests are brittle, or developers start adding abstractions solely to satisfy a rigid testing style.

SilverKite51 -

Good refactoring and design skills matter a lot. Without them, strict TDD can produce over-mocked code, awkward interfaces, and a large suite that is difficult to change.

Answered By QuietHarbor7 On

Strict, company-wide TDD seems pretty uncommon. Many teams require tests with pull requests or maintain high coverage, but that is different from writing every test first. I have worked on teams with lots of automated tests without using the red-green-refactor cycle at all.

CopperLynx18 -

That has been my experience too. TDD is often presented as an ideal during interviews, while the day-to-day process is usually more pragmatic.

Answered By MossyOrbit3 On

TDD works best when the behavior and interface are reasonably clear beforehand: parsers, algorithms, calculations, APIs, complex business rules, and regression fixes are good examples. It is much less comfortable for exploratory work, user interfaces, infrastructure integration, or features where stakeholder requirements are still changing. In those cases, writing some code first can be part of discovering the design.

AmberNoodle64 -

Bug fixes are probably the clearest use case: reproduce the problem with a failing test, make the fix, and keep the test so the regression does not return.

Answered By BrightWalrus8 On

Some small teams and highly regulated or high-consequence projects do practice TDD seriously, sometimes alongside pair programming, continuous integration, and acceptance testing. It can scale technically if the tests are fast, focused, and maintained, but enforcing one exact workflow across a large organization is difficult. A common compromise is to use strict TDD for core logic and defects, while allowing exploratory or integration-heavy work to be implementation-first as long as solid tests are added before the change is finished.

CloudyRook36 -

The important distinction is between mandating the order of every keystroke and expecting reliable, well-designed tests. The latter is much easier to scale and review.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.