I often struggle to see the benefit of unit testing, especially in a web app environment that uses a JS frontend and an API + database backend.
On both the front and back end, you would typically mock all the network requests and responses. For example on the front end we might click a button that is used to create a new widget which sends the request to the back end which creates the widget and returns a response containing the new widget.
In the above scenario we would create our initial unit tests by mocking the actual network requests and just specifying the data that we want sent / received. Everything passes,…great.
Then we change something on the backend and will change the backend unit tests accordingly. Once again all our unit tests pass. But the problem is that now our front end tests continue passing even though the back end has changed.
This continually makes me question the value of unit testing and reminds me of this:
How should integration testing be done with decoupled front / back ends? What tools and techniques are advised?
If you want specifics,...I generally work with Python
and Django
back ends coupled with React
front ends.