views:

28

answers:

3

I'm preparing some educational/training material with respect to Unit Testing, and want to double check some vocabulary.

In an example I'm using the developer has tested a Facade for all possible inputs but hasn't tested the more granular units 'behind' it.

Would one still say that the tests have "full coverage" - given they cover the entire range of inputs? I feel like "full coverage" is generally used to denote coverage of code/units... but there would certainly be full something when testing all possible inputs.

What's the other word I'm looking for?

+2  A: 

If all possible inputs don't give you 100% code coverage, you have 100% scenario coverage, but not complete code coverage.

On that note, if you have 100% scenario coverage without full code coverage, you have dead code and you should think real hard about why it exists.

Kistaro Windrider
Thanks! I like this answer - the use of _scenario_ and _code_ seems like the most accessible option for a Unit Testing 101 type environment. This answer has also got me thinking about my definition of code coverage, and realizing that I'm confusing it a little with Independence! Thanks :D
LeguRi
+1  A: 

If you decide to use 'full coverage' then you might have troubles because most literature that speaks about coverage (and indeed, the tools that measure coverage as well) talk about the lines of code that are executed in the code under test after all tests are run.

The test cases that you propose would be said to cover the domain of the function (and assuming a function that is at least 1-to-1, they will cover the range as well).

SnOrfus
+1 Thanks! I'm going to go with "scenario coverage" as I found more about in with a quick Google Search, and feel it will be more accessible to people doing a kind Unit Testing 101.
LeguRi
A: 

it is full code coverage of the involved classes, but clearly not of the full system source. Tools can give this at different level.

note that it doesn't guarantee the code is correct, as it might have missed an scenario that needs to be handled altogether (both in test and feature code). Additionally the tests could trigger all code paths and not be asserting correctly.

eglasius
I forgot to mention that the Facade also has some "helper" methods which are not tested - ie it's deliberately not complete code coverage. Your second point is very true, and that's the purpose of the exercise; show them something which they'll want to think of as being "complete coverage" and then explain why its not :)
LeguRi