I mentioned recently about testing using boxes strategy. We can determine three types of them:
Today I’m going to explain to you the difference between those three approaches.
When you write a test you have to pass some data to it and gather some output to check if the result is demanded. That’s the basic of testing and it is truism. But we can distinguish three types of testing using boxes reference.
When you pass some data and you get the result, but don’t know what happens inside (you are not interested in it), you match black box strategy. It is the best way to write end-to-end tests, because you simulate user behavior. You set some initial parameters of part of (or whole) system and all of functionalities inside should work independently to make successful product as a whole.
When you pass data, but you want to have some access to internal parameters and manipulate, ie. database on your own in the middle of some bigger process you match grey box strategy. It means, that you have access to more functionalities and you are pretending, that you are, ie. DBA or system admin. That still means, that you have no knowledge about how subsystem or functionality works in details, but you know that it is integrated with some storage or file systems and you pretend real life situations. This approach is still
Last, but not least – white box strategy. Now you have access to every part of system and you behave as a god… or the developer, who made that code, that need to be tested properly. This time you are testing mostly flow of instructions, that are called. You can pass some prepared and fake data. Most of components can be mocked and verified if some methods were called in proper order or x times during execution. This type of strategy is mostly used during unit testing.
I hope after my explanation you will know which and when you should use each and every approach of box testing strategy.