Nowadays it is hard to imagine software development without automated testing. In fact this is only way to protect the product from the destructive changes (i.e. changes that damage an existing functionality).
Usually two types of automated testing are used. But an interesting question is arising: Do we really need both of the testing types? And, if we don’t: Which one is the most important?
Unit testing is a testing of product’s units (usually functions or methods).
Usually unit testing is made by author of unit/method/function, because he or she knows exactly what this function is responsible for. The main goal of the developer is to cover code by unit tests. That means unit tests won’t be full. If developer has seriously approach, it’ll take much time. The quality cover of the function needs a lot of checks. Besides, there are a lot of functions you can’t check by unit tests.
The most important is that even successful completion of all the unit tests does not guarantee correct operation of the product, because the same function can be used in few parts of the system while the unit test was written only for one usage.
Functional testing is a testing of a certain functional of the product, when the product is perceived as a single “black box”.
Usually functional testing is a tester’s job. As you know, the main goal of any tester is to find a bug. It means there are more checks of unstandardized data. Besides, there is easier to cover end-product by functional tests then by unit tests: much easier to understand what exactly a specific part of the interface is responsible for then to determine what this function is responsible for. And the most important thing is that you can cover only the most important parts of the product by the functional tests, as a result they will perform well.
Functional testing fully determines product operation. Generally, this is the need of customer/manager of the development. Unit testing is primarily by the need for developers to find errors quickly or verify the effects of refactoring. Therefore, priority should be as follows:
- Functional tests are required;
- Unit tests are preferably depending on the developers.