I have recently heard of Functional Testing over Unit Testing.
I understand that Unit Testing tests each of the possibilities of a given piece of code from its most atomic form. But what about Functional Testing?
This sounds to me like only testing if the code works, but is it as reliable as Unit Testing?
I've been told there was two school of thoughts for the matter. Certains would prefer Unit Testing, others Functional Testing.
Is there any good resources, links, books, any references or one of you all who can explain and elighten my path on the subject?
Thanks!
Unit testing and Functional testing are the foundation of the testing process. The main difference is between the two is: Unit testing is performed by the developer during the development cycle, and. Functional testing is performed by the tester during the level of system testing.
Different Types of Functional testing are Unit testing, Integration testing, Smoke testing, Usability testing, User acceptance testing, System testing, Regression testing.
End to End Testing is usually executed after functional and system testing. It uses actual production like data and test environment to simulate real-time settings.
While unit tests always take results from a single unit, such as a function call, integration tests may aggregate results from various parts and sources. In an integration test, there is no need to mock away parts of the application. You can replace external systems, but the application works in an integrated way.
Unit testing versus functional testing is not an xor
, but rather an and
. Unit testing is about testing units in isolation while functional testing is about testing the whole in integration (do all the units works together properly?).
Both are necessary components of good software engineering practices.
Jason's answer is correct. Different types of tests have different purposes, and can be layered for best results (good design, meeting specifications, reduced defects).
There is some overlap between these categories; unit tests can specify behavior, for instance.
And there are others; for more than most people care to know, see Software Testing.
One point people missed is that unit testing is testing pieces of code in isolation. Good unit tests don't hit the database, for instance. This has two advantages: it makes the tests run fast so you'll run them more often, and it forces you to write loosely coupled classes (better design).
You asked for resources; I recommend Roy Osherove's book The Art of Unit Testing with Examples in .NET. While no book is perfect, this one gives many excellent pointers on writing good tests.
EDIT: And for writing tests against existing software, nothing beats Michael Feathers' book Working Effectively with Legacy Code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With