Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Integration tests are great, but the very real downside is that they tend to be much more complex to write than unit tests, and can in some cases require setup and tear down overhead that makes it impractical to lean on them for the majority of testing logic.

Unit tests for each unit of functionality, and a small number of integration tests to validate all works well together.



Again, I think it comes down to tooling. Our app is basically a document management system with quite complex business rules. I can write a test that takes a document from inception to completion in about 15 LoC because we've put time into our test framework to provide sensible abstractions over our API.

Setup and teardown can be an issue, but we've found a good balance. We spin up a clean DB for each test in less than a second. Running out full suite does take a couple of hours, but that's what CI servers are for.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: