by lcarlson · 10y ago · 0 comments
These are important questions, whether you call a test integration, functional, or unit, is not an important question.
Suppose you want to test a function that capitalizes the first letter of words in a string: I would test
'' => ''
'a' => 'A'
'aa bb' => 'Aa Bb'
3 tests, which does not mean 3 functions (that will have the overhead of setup and teardown)
The overhead of setup/teardown should be practically zero. Even having them as 3 separate functions should be take fractions of a millisecond.
The important thing is, it should be obvious why a test failed, you don't want more then 1 or two asserts.