Debate: Is TDD alive?

TDD is not writing unit tests, TDD is a way of writing code.

The Three Rules of TDD 

  • You are not allowed to write any production code unless it is to make a failing unit test pass.

  • You are not allowed to write any more of a unit test than is sufficient to fail. And compilation failures are failures.

  • You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

I've already done the solution, why do I need unit test now...

 

TDD makes me slower.

 

It is a waste of time and effort

So TDD is hard...

So TDD is hard...

TDD is a discipline and disciplines are hard to learn

All the code was working some minutes ago...

We follow TDD...

All the code was working some minutes ago...

We follow TDD...

Do you want your kids to be debuggers?

All the code was working some minutes ago...

We follow TDD...

Do you want your kids to be debuggers?

Tests are the best documentation, because they are described with programmers´ natural language, code.

Simpler code that meets business requirement.

We follow TDD...

Simpler code that meets business requirement.

We follow TDD...

Confidence

Simpler code that meets business requirement.

We follow TDD...

Confidence

You still have to do unit tests...

Measuring unit test coverage?

Our coverage is 100%

Bad unit tests

Have you ever changed some code, run unit tests, some of them started to fail.
You went to the tests and it was something like this...

Bad unit tests

Have you ever changed some code, run unit tests, some of them started to fail.
​You went to the tests and it was something horrible test.

Bad unit tests

Have you ever changed some code, run unit tests, some of them started to fail.
​You went to the tests and it was something horrible test.

TDD works for everything?

Can you predict an answer? Styling?

TDD works for everything?

Can you predict an answer? Styling?

BDD or TDD

Given I am logged in on "US" site
When I am viewing a 1939 transcript with females
Then I should see the female icon in the sex column
class When_creating_advanced_suggest_model : TestsContext<AdvancedSuggestModelFactory>
{
     Because of = () => 
                           _result = sut.CreateItem(_criteriaProvider, _searchArea);

     It should_return_advanced_suggest_with_search_criteria = () => 
                            _result.SearchFacets.ShouldContainOnly(_clonedFacet1, _clonedFacet2);
}

BDD or TDD

Differences?

BDD or TDD

Differences?

Audience:

Unit tests are written by developers to developers

Acceptance tests are written by the business for the business

TDD is a discipline

Buildings

Accounters

Code?

TDD

By Juan Antonio Vicaria