How to do integration testing in axum
?
#1423
-
Integration TestingHow can we perform integration test on our
How can we do this? Note: If my question can be improved, please suggest me as well. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Using "integration tests" (i.e. tests stored in the I recommend you write tests in directly in |
Beta Was this translation helpful? Give feedback.
Using "integration tests" (i.e. tests stored in the
tests
directory rather thansrc
) is tricky because it requires you expose things (viapub
) from your crate. In most cases if you're building a binary that isn't necessary. This is mainly intended for libaries.I recommend you write tests in directly in
src
like its done in this example https://github.com/tokio-rs/axum/blob/main/examples/testing/src/main.rs