Integration Testing — Deep Dive
Integration testing is invariably referred as “near code testing” or “advanced unit testing”. It is a method of testing all the components as an integrated/single unit to validate if the code is working as expected. Once the piece of code is ready and unit tested by the developer, it takes the route of “Integration testing”.
Why integration testing preferred at the first place? The answer is simple. Integration testing is relatively faster as it is completely automated. Integration testing can uncover the potential bugs during the early cycle. It is a well-stitched framework where early testing happens and gives early feedback to the development team. This is an efficient method of detecting system-level issues & stability of the code in the first go.
There are two types of integration testing:
· Incremental Integration testing
· Non-incremental Integration testing
One of the pluses of this testing method is the “Code Coverage”. All you need to know is the change log and do focused testing based on changed functions. There is an end-to-end traceability in the framework which helps to test what is needed!
This leads us to double-click the code coverage topic. Code Coverage is one of many metrics that can be used to gauge “code quality”. Organizations highly value this testing methodology as;
· It serves as the gating criteria in the release life cycle. >=95% is the recommended pass percentage overall and >=70% for newly added code that decides the stability of the build/feature. This is also one of the DOD (Definition of done) requirements in any software releases.
· Code coverage also helps to understand frequently called functions and how our tests exercise these functions. This can be the input for the test team to increase their test coverage by adding more tests in specific areas. Technically, this is called as “Left Shift”
· Code Coverage is a key metric for the software releases.
Benefits of Code Coverage:
· Early testing/exposure of the code to unearth potential defects.
· Faster time to market
· Easy maintenance of code
It’s extremely important to perform code coverage analysis. And for that its important to know “How is it measured”?
One of the powerful tools that I’m well-versed with is - Bullseye tool https://www.bullseye.com/
To calculate the code coverage percentage, simply use the following formula:
Code Coverage Percentage = (Number of lines of code executed by a testing algorithm/Total number of lines of code in a system component) * 100
5 Code Coverage Criteria one must know:
To measure the lines of code that are exercised by tests, various criteria are taken into consideration. Below are a few to call out.
·Function Coverage — The functions in the source code that are called/executed.
· Statement Coverage — The number of statements that have been successfully validated in the source code.
· Path Coverage — The flows containing a sequence of controls and conditions that have worked well at least once.
· Decision Coverage — The decision control structures that are executed.
· Condition Coverage — The Boolean expressions that are validated and that executes both TRUE and FALSE as per the tests.
Organizations decide what coverage that they would want to focus on. Mostly I have seen organizations picking on;
Function Level Coverage: Did our tests exercise the functions needed?
Condition / Decision Coverage: Which conditions (i.e. boolean values) and/or decisions (i.e. loops) within the function were exercised?
This gives the detailed view of code & its coverage.
Looking at the gains which Integration testing offers, it’s good for the organizations to setup a complete Integration ecosystem & the team. Team should have fundamental knowledge of the code and automation expertise.
Preethi Guruswamy Sobhitha Neelanath Shilpi Mitra Surabhi Kumari Deeksha Jaiswal Devi Anantharaman