Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Test code duplication issue #11
Hi, great post!
Here I would like to point out one important benefit of tiny unit test code, and not just having Integration tests. When code is changed and unit test fails, the error is more close to the source code that caused the error.
In integration test, you need to spend more time to figure it out the cause.
Very similar when you need to put input verification checks both on client and server side. It is duplicate check, but in order to satisfy security features, it is a must.
I like very much the idea of making blog comments as github issue.
Yeah, I think unit tests can definitely add value for this, I think it depends on what you're doing and the complexity of it, how much duplication you're adding, as well as how much effort/abstraction it takes to add a unit test (sometimes it's easy, other times ... not so much).
I think unit tests can also be very useful as a development tool, as it gives you quick and direct feedback.
Funny you mention this example, as I wrote an article about this exact thing a few weeks ago. My view is that the frontend checks are mostly redundant, and should be removed in most cases (my point is a bit longer than that, I'll try and finish it up this week).
I disagree that testing is the source of the bad code and abstractions.
Developers that don't know what
Properly applied TDD (Acceptance, integration, and unit tests where appropriate) will result in simpler and easier to understand code. It takes a great deal of effort and intentional practice to properly apply TDD. On my first try I wrote ~1500 tests for a compiler...if you looked at it sideways about 500 tests would fail. Testing wasn't the problem, I was.
Can you elaborate a bit on your personal experience doing Test Driven Development?