4 ms·
That's not a problem, that's a hangup you have. We don't need a global definition of what a unit is, we just need to know what unit is being tested by a given
by kerkeslager 3y ago
That's not a problem, that's a hangup you have.
We don't need a global definition of what a unit is, we just need to know what unit is being tested by a given unit test. This is important because it's how we understand coverage:
1. We need to understand what's within the unit (covered by the test) so we don't write redundant tests, and...
2. ...we need to understand what's not within the unit (not covered by the test) so we can write separate tests to cover that unit.
The unit can be anything, as long as we know what the unit we're testing when we read/write/run the test.
An integration test also needs to know what it's testing, but now you're looking at it from an outside perspective. You no longer care which specific areas of code (units) are within the integration, you just care what features are within the integration. Sometimes a refactor will mean that feature A no longer causes class B to call class C: that probably means changes to B's unit tests, because the code unit changed, but it doesn't mean changes to the integration test because the feature didn't change.
The important thing is to understand what's being tested by a given test.
For example, a project I'm working on has integration tests which are written with Selenium and run in a headless browser. Most of these tests involve users, but most of these tests aren't testing user creation, so I don't care how the users get created. Instead of going through the signup interface using Selenium, I'm just injecting the users into the database directly because that's faster and easier. The one exception is I'm not injecting the users into the database in my signup/login integration tests, because whether the user gets created is part of the feature under test.
Of course there are significant overlaps between these two categories, that is to say, there are some unit tests that are also integration tests.
- Ma8ee 3y agoIt certainly doesn’t bother me, but considering the length of your rant, which I won’t bother to read after your first sentence, you certainly seem to have quite a few hangups.
- kerkeslager 3y agoNot wanting to respond to things you haven't read is a hangup you should have, but don't, apparently. Nothing says "doesn't bother me" like having to tell everyone you aren't bothered.
- Ma8ee 3y agoSomeone woke up on the wrong side today, or need to go get something to eat.
- throwaway8877 3y agoI'll also recommend you to read HN guidelines.
- kerkeslager 3y agoGo eat, then. :)