chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male

Unit Tests vs. Integration Tests

Ayende has written a short and to the point post about Unit tests vs. Integration tests.

An even shorter summery of the post is: Unit tests runs faster but integration tests are easier to write.

I believe there is even a greater difference between the two: most of the time integration tests require to set the environment (database, web server etc.) to run properly and can fail because some other component that the test relies didn’t behave as expected.image

Unit tests are harder to write but you get a focused test for your efforts. If that test fail you know exactly what went wrong.

There is however another solution instead of declaring unit testing as hard to write – use an isolation framework which make writing unit test much easier.

I’m not against writing integration tests – I think each project should have both – unit test to test the components and integration tests to test the interaction between them.

Looking to learn more about unit testing and how to write them? Watch our on-demand webinar: “Intro to Unit Testing.