In todays software development, unit testing become synonym for software testing. It is even worse, when one unit testing library for specific language, becomes synonym for unit software testing, e.g. JUnit. When I ask programmers what is unit in that software testing, they fail to give me strait forward answer. Let’s demystified unit in software testing, according to Black Box Software Testing Foundations course (BBST) created by Rebecca Fiedler, Cem Kaner and James Bach.
Unit tests focus on individual units of the product. Programmers usually describe unit testing as glass box testing (code knowledge) where they test individual functions or individual classes.
Let’s here what IEEE standard 1008 has to say about software unit testing:
Unit may occur at any level of the design hierarchy from a single MODULE to a complete program.
Wait, what? Complete program could be a unit!?
Why not? For example, if you test Google Docs using available user interfaces as ONE thing, and you see it as ONE thing, you are doing unit testing.
Is it possible to have Black Box Unit Testing? Let’s test GitHub rest api. It’s interfaces are known through public documentation, but we do not have access to GitHub api code. So this is black box software testing approach. Using api documentation and rest api client, we see Github api as a one unit, so this is unit testing.