Probably, like every developers, what you want is to start coding and see how is that of Google Testing Framework and how does it works. But not yet, my friend. Today we are going to have a look to the Unit Testing concept.
A “Unit Test” is a piece of code implemented to test a unit of work, which means that we are going to check the correct implementation of a requirement. For me the more important characteristics of a unit test are:
- Repeatable and predictable. It has to be designed to be executed every time you needed and the result always must be consistent. Imagine that you’re testing an algorithm and you launch the test and it’s returns different results to the same parameters. Not good….
- Isolated. You have to test only what is inside that function. Nothing else. That means that other modules, functionality or parts of your application shouldn’t be tested. For example, if you’re testing a function that reads a XML tag, don’t test in the same unit test a XML write routine.
Now, the process of executing unit testing is:
- Prepare the test performing some operation, initializing variables, etc…
- Launch the test.
- Check results