Unit test | Integration test |
---|---|
Results depends only on code |
Results also depends on external systems |
Easy to write and verify |
Setup of integration test might be complicated |
A single class/unit is tested in isolation |
One or more components are tested |
All dependencies are mocked if needed |
No mocking is used (or only unrelated components are mocked) |
Test verifies only implementation of code |
Test verifies implementation of individual components and their interconnection behaviour when they are used together |
A unit test uses only JUnit/TestNG and a mocking framework |
An integration test can use real containers and real DBs as well as special integration testings frameworks (e.g. Arquillian or DbUnit) |
Mostly used by developers |
Integration tests are also useful to QA, DevOps, Help Desk |
A failed unit test is always a regression (if the business has not changed) |
A failed integration test can also mean that the code is still correct but the environment has changed |
Unit tests in an Enterprise application should last about 5 minutes |
Integration tests in an Enterprise application can last for hours |
Last active
July 21, 2016 12:08
-
-
Save Bigomby/166ca58b63a4a645cafc0887dda508f8 to your computer and use it in GitHub Desktop.
Unit testig vs. Integration testing
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment