Unit tests vs Integration Tests in Rust


One thing I've noticed after starting to work in Rust is that Test Driven Development became feasible. As an absentminded by default developer, I value tests. However, if the cycle is slow, it becomes highly expensive to test everything. I think this is one reason unit tests are more favored than integration tests. They are more precise and require less time to complete. Round-trip tests are more feasible with unit tests.

Another point is that Rust being statically typed language, requires far less unit tests. Normally, unit tests are for input consumption, that is making sense of the input and well formed output, that is if the output in a condition meets the requirements. In Rust, most of these input-output tests are already resolved if you use structs and enums to represent data.

These are the reasons why I'm more inclined towards integration tests with real requirements, rather than unit tests in artificial settings.