Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test code duplication issue #11

Open
karlosmid opened this issue Jan 15, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@karlosmid
Copy link

commented Jan 15, 2019

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.
As you stated, this creates duplicate testing code, but I think that the tradeoff is reasonable.

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.

Regards, Karlo.

@arp242

This comment has been minimized.

Copy link
Owner

commented Jan 15, 2019

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.

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.

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).

@dalelotts

This comment has been minimized.

Copy link

commented Jan 15, 2019

I disagree that testing is the source of the bad code and abstractions.

Developers that don't know what good software is will create bad abstractions and duplicate code even if they don't write tests. Why are you blaming testing for these outcomes?

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.