0% found this document useful (0 votes)
24 views1 page

Integration Testing Recap

The document discusses unit tests, integration tests, and best practices for integration testing. It covers the differences between unit and integration tests, using real databases for integration tests instead of mocks, and cleaning up after each integration test.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views1 page

Integration Testing Recap

The document discusses unit tests, integration tests, and best practices for integration testing. It covers the differences between unit and integration tests, using real databases for integration tests instead of mocks, and cleaning up after each integration test.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Integration Tests

So, in this section, you learned that:

- Unit tests are easy to write, fast to execute and are ideal for testing functions with
minimal or zero dependency on external resources.

- The more you use mock functions, the more your tests get coupled to the current
implementation. If you change this implementation in the future, your tests will
break. If you find yourself doing too much mocking, that’s when you need to
replace your unit test with an integration test.

- With integration tests, we test our application with a real database. As a best
practice, separate your test database from the development or production
databases.

- You should write each integration test as if it is the only test in the world. Start
with a clean state (database). Populate the database only with the data required
by the test. Nothing more, nothing less. Clean up after your test using the
afterEach function.

- Run jest with —coverage flag to get a code coverage report.

You might also like