Ben Petersen's Software Development blog

TDD is unknown to many developers especially because the advantages and important aspects aren’t known. I describe what these aspects are and when test driven development adds value to the project.
code | 2017-05-03
Tags: TDD Development Test

What types of stories benefit from TDD?

I find that .NET projects are separated by test projects and the running project, in the same solution. This makes switching between the test file and other files like stubbing difficult. There are some JS libraries like react-virtualized which have the test inside the component, this makes it easier to switch contexts between the test and your working files.

This reasoning is mainly because stubbing is time consuming to setup and when your test is located in the same file, it takes little context-switching to reflect the acceptance criteria in your test cases and component.

Test Driven Development in the real world

Dumb or pure components in react make testing really simple, while Angular or .NET you have to stub services or data classes to do your testing. You can achieve the same resolve, but it's easier using react-virtualized.

Why don't most develops know test driven development and it's often done wrong if at all?

Timelines and cost should also be considered. So when it’s time to get started it shouldn’t be difficult to add your test into acceptance and your build tool. These criteria really make you ask, when is test driven development actually useful or valuable?

Personally, the goal of software is to behave what you expect it to even when edge cases are present. Tests can take time to write and will cause stories to have a higher effort and cost to them. I see a large benefit of tests when refactoring code, usually any developer can manually test a number of items, however test driven developer is great when adding additional functionality or refactoring. This is because re-running tests ensure any existing functionality is not altered.