DEV Community

Discussion on: Are Unit Tests Really Just Garbage? đŸ’©đŸ˜ł

Collapse
 
devdufutur profile image
Rudy NappĂ©e • Edited

No unit test != No automated test

I'm always more confident with integration tests and e2e tests than unit tests. Furthermore, they didn't break on refactoring. And it's always better to test actual user interaction instead of implementation details.

Manual tests are really expensive in the long term. Community tests are great but aren't applicable to any project.

Collapse
 
miketalbot profile image
Mike Talbot ⭐

Totally with you on that.

Collapse
 
wimadev profile image
Lukas Mauser Wimadev • Edited

That's true. There are layers to automated testing. And integration/e2e testing can give you more coverage across your system.
I can say though, that as soon as your app is just a little bit more complex and multiple people or teams are involved, e2e tests are really much harder to setup and they do require a lot of maintenance effort. You have to run and maintain a separate production like environment. And that causes tons of issues like multiple people trying to work on it at the same time, testing data being wrong or outdated, and thinking about all the underlying infrastructure stuff...

Collapse
 
devdufutur profile image
Rudy NappĂ©e • Edited

Indeed test cases need to be rethinked.

It's about trade-offs between simplicity, side effects, replayability and maintenance but if you recreate the full test situation and delete it after the test, you can deal with those issues.

This way, you should be able to launch your e2e test on every environnent you have credentials for (no need for production-like environment, any dev or review envs will match)

For integration test, no environment is required, with test containers, or embedded databases/queues and tools like wiremock you should control you own dummy environment.

Some comments have been hidden by the post's author - find out more