Warm tip: This article is reproduced from serverfault.com, please click

Integration test with Cypress or React Testing Library?

发布于 2020-11-29 17:36:45

I'm new to testing and as I understand, integration tests are aimed to test a bunch of components and how they interact with each other.

But if in a project we use both Cypress for E2E and React testing library for unit testing, which one to use for integration tests, and what are the pros and cons?

Questioner
Tzun Hei
Viewed
11
George Doykan 2020-11-30 03:15:59

I would recommend using React testing library (RTL) since integration testing is more granular and does not require the entire application to run.

The main benefit of Cypress is that it tests against real browsers which makes it great for ensuring your E2E flows work as intended. While Cypress is fast, it has to do a lot of additional work compared to RTL. I do think Cypress is best for just E2E testing, specifically the high value paths in your application.