Skip to content

TDD misunderstood #6464

@allanlykkechristensen

Description

@allanlykkechristensen

Hi there,

It seems that you've misunderstood TDD in terms of fail first. Yes, a test must fail the first time, but it is not because it is written wrong, it's because the business logic should not yet have been implemented. Once the test fails you then fix your business logic or method and once you've done that properly your test will pass.

My recommendation:

  • Start by implementing the stubs of WordCount
  • Write the correct tests the first time. The test will fail because you haven't implemented the actual WordCount only empty stubs.
  • Implement WordCount so that the tests pass

= TDD

Writing a wrong test that fails and then correcting the test to pass is not TDD - I'm pretty sure it doesn't have a name or purpose.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions