-
Hello! I've read in the CONTRIBUTING.md that "There are two ways to write tests: integration tests and documentation tests (Tokio avoids unit tests as much as possible)." I'm just curious to better understand what brings you to "avoiding unit tests as much as possible". Is it the related to the specificity of tokio, maybe unit tests not being very relevant for testing an async runtime? Or a more broad stance about testing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The meaning that this note takes in practice is that tests should go in the That's not to say that there are no tests inside Integration tests are nice because when the test uses only the public API, our stability promise also means that we wont have to change the tests when refactoring. |
Beta Was this translation helpful? Give feedback.
The meaning that this note takes in practice is that tests should go in the
tests/
directory next to thesrc/
directory, as opposed to having the tests inside thesrc/
directory.That's not to say that there are no tests inside
src/
, but all of the tests insrc/
are there because they need something not in the public API, which prevents them from being intests/
. We try to avoid this when possible.Integration tests are nice because when the test uses only the public API, our stability promise also means that we wont have to change the tests when refactoring.