DEV Community

loading...

Unit Test vs Integration Test

jolouie7 profile image Joseph Louie ・1 min read

Why do you need testing?

Testing is very important. Many if not all companies test their code before shipping out, or at least they should. Testing helps prevent users from finding bugs that could have been caught before the release of a new feature/product. Automated testing by using a testing library like Jest can help cut down on repetitive manual testing. Automated testing saves a lot of time.

What is unit testing?

Unit testing is like how it sounds. Unit testing is testing part of a program/codebase. Developers usually test a function to make sure it works as intended. The developer might test multiple functions or modules to see if they are working correctly. Theses tests are usually pretty quick and not very costly.

What is integration testing?

Integration tests check to see if all the components that make up the whole product are working correctly. The last thing you would want is to add a new feature that would break other features. These tests are usually performed by a tester but there are testing libraries like react-testing-library that helps with integration tests. These tests are more costly because they they take a long time to run compared to unit tests.

Thank You for reading!

Resources
Unit test versus Integration test

Discussion (0)

Forem Open with the Forem app