I recently had my final exam for a software engineering course for my masters program and one of the questions on the exam was the following:
Unit Testing is considered: a. White-box Testing b. Black-box Testing c. Either
In my 7 years of software development experience, unit testing has always taken a white box approach. The tester has always had full knowledge of the implementation of the unit while writing the tests. Black box testing always came later in the forms of integration, system, and acceptance testing.
However, the correct answer to the exam (according to the professor) is that unit testing can be either white or black box testing.
I have done some research, and it seems many cases "black box unit testing" is used to describe a test-first approach where the unit tests are written before the code is. However in my opinion this is still white box testing. While the implementation does not yet exist, whoever is writing the test generally has a pretty good idea about how the source code is going to be implemented.
Can someone please explain to me how black box unit testing works (if it truly is a thing) and how it differs from white box unit testing?