Hacker News new | ask | show | jobs
by davethedevguy 1037 days ago
I think I'm disagreeing with the definition implied by the article. To me, an integration test involves integrating with another system.

Testing groups of functions or classes together is still a unit test, by Wikipedia's definition at least

"unit testing is a software testing method by which individual units of source code—sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures—are tested to determine whether they are fit for use" [1]

and by Michael Feather's definition

"A test is not a unit test if:

- It talks to the database

- It communicates across the network

- It touches the file system

- It can't run at the same time as any of your other unit tests

- You have to do special things to your environment (such as editing config files) to run it." [2]

Indeed, it's the inevitable result of doing TDD; the refactor step is likely to break out smaller classes/functions already covered by the existing tests. If we write new, more granular tests every time we do the refactor step, then we end up with brittle tests.

[1] https://en.wikipedia.org/wiki/Unit_testing

[2] https://www.artima.com/weblogs/viewpost.jsp?thread=126923

Edit: To clarify, I'm not talking about calling the public API over the network, I'm talking about the public methods that consumers (including your network layer) would call.

That might be where the confusion lies here.

1 comments

To me, an integration test involves integrating with another system.

That's not what it means, and the author clearly indicated it didn't?

When your colleagues are talking to you, you're going to be constantly misunderstanding them if you just make up your own definitions, even after they explained them!

When I was 14 I believed @ meant about and now I no longer use @ to mean about.