February 27, 2017

Testing Pyramid

While searching theory behind integration tests, I landed into testing pyramid concept and found it good to be share.
Basically, tests are used as a feedback loop. They are responsible to inform developer whether the application is working or not.

With respect to the testing pyramid, three types of test cases are described.
·        Unit test cases are focused on the single unit of responsibility at a time. All the dependencies of that single unit will be mocked.
·        Integration tests are to ensure that more than one unit working together should work fine without mocking other units.
·        End to end tests or acceptance tests is used to test the application by simulating end user scenarios.

Testing Pyramid

In testing pyramid concept, it always focuses on to write more and more unit test case and business should be tested in form smallest unit.

Integration tests to test integration between units without mocking the units. It will make sure communication between units is working fine as the business logic already tested in unit tests.

With testing pyramid concept, it always discourages to write more end to end test cases as they are slow to run as running against a live application.
Also, it’s not easy to identify which unit is failing. Single change or enhancement in one feature may lead to failure of most of the end to end test like if login feature is changed in an application then the further features test will start failing.
Only advantages of the end to end tests are they are able to simulate end user behavior.

Also from one of google blog, it is also suggested to have 70 (Unit) / 20 (Integration) / 10 (End to end) ratio for tests.
Share:

0 comments:

Post a Comment