What’s The Difference Between Unit Testing vs Integration Testing?

Anna Thorsen

Automation Expert

Unit and integrating testing are fundamental steps in software development. But what are the differences between the two? 

In this short post we’re going to outline the differences between the two. 

What happens before unit and integration testing?

It all starts when a business has requirements for new functionality to its business application or software. It could be that they need to add new functionality to their ERP system or create a new invoicing process. 

Once the business has outlined the feature requirements, it is forwarded to the development team. Typically the software that’s about to be developed has a product owner.

The business owner (the person who outlined the requirements) and product owner will liaise to specify the requirements. This will give the product owner a clearer idea of how to formulate the business requirements into user stories.

The product owner will then begin detailing the software’s architectural design and determine what needs to be developed into individual units. 

At this point, developers will program/produce units of code.

Developer A will produce a unit. Developer B will produce a unit. Developer C will produce a unit, and so on. 

Image: The v model for software development demonstrates the order in which software development happens. 

V-Model-Software-Testing-v1

Unit testing

Once these units have been developed, they are tested. 

They’re not tested as one component just yet. Instead, they’re individually tested on a code level (typically the units will only exist as code at this point) to make sure they’re working as expected.  

You’re testing how the code reacts. To do this, you send syntaxes into the code to see if the code responds as you expect. 

If the result is expected, the test has succeeded. Once they’ve all succeeded, it’s time to assemble the units. 

The units themselves will not help the business, nor complete a user story. But in consort, they will create the functionality that was requested by the business user in the requirements phase. 

Integration testing

Just like a puzzle, integration testing ensures that once the units have been assembled, they work in unison. 

There are many types of integration tests to carry out. And the terms for these are often used interchangeably. In this post, you can read about the difference between two common integration tests – API testing vs integration testing

At this stage, you’re testing the individual units connected together as one component. You’re also testing the component and how it integrates with the system.

If the component needs to interact with other systems outside of the one you’ve developed – this is known as system integration testing. 

In the post linked above, you can learn about these terms in more detail.

Conclusion

In short, unit testing is the process of testing individual units of code. Integration testing is when you test the units together as one component. 

If you’re interested in learning more about testing, and how to do it efficiently, you can get our comprehensive whitepaper on continuous testing in agile development. This whitepaper will help you evaluate your needs as a tester or testing team, and what to look for in an automation tool that will help you achieve continuous testing.  

New call-to-action