2 ms·
Integration tests are still tests. There are definitely cases for tools where you can largely get by without unit tests in favor of integration tests. I've writ
by surajrmal 11mo ago
Integration tests are still tests. There are definitely cases for tools where you can largely get by without unit tests in favor of integration tests. I've written a lot of code generation tools this way for instance.
- mikepurvis 11mo agoUnit tests are for testing branchiness— what happens in condition X, what about condition Y? Does the internal state remain sane? Integration tests are for overall sanity— do a few happy paths basically work? what about when we make changes to the packaging metadata or roll dependencies forward? Going unit-test free makes total sense in the case of code that doesn't have much in the way of branching, or where the exceptional cases can just be an uncontrolled exit. Or if you feel confident that your type system's unions are forcing you to cover your bases. Either way, you don't need to test individual functions or modules if running the whole thing end to end gives you reasonable confidence in those.
- inetknght 11mo ago> Integration tests are still tests. I didn't say they're not. Integration tests definitely help towards "being tested". > There are definitely cases for tools where you can largely get by without unit tests in favor of integration tests. Very strong disagree. I think there are no cases where a strong integration test regime can allow a software project to forego unit tests. Now, that said, we're probably talking the same thing with different words. I think unit tests with mocks are practically useless. But mocks are the definition of most people's unit tests. Not to me; to me unit tests use real code and real objects. To me, a unit test is what a lot of people call an integration test. And, to me, what I call an integration test, is often what people call system tests or end-to-end tests.
- mystifyingpoi 11mo ago> I think unit tests with mocks are practically useless IMO that's on the extreme side too. I've seen a fair share of JUnit monstrosities with 10+ mocks injected "because the project has been written this way so we must continue this madness", but mocking can be done right, it's just overused so much that, well, maybe you're right - it's easier to preach it out than teach how to do it right.