Cargo integration tests and workspaces

So I have a cargo project with several workspaces (crates). The structure is like this:

  • project/ws1
  • project/ws2

cargo test will run integration tests defined within the workspaces, e.g.,

  • project/ws1/tests/

However it won't run integration tests defined at the project level, so far as I can tell:

  • project/tests/

Am I missing something?

To test multiple crates in a workspace at a time, you would need to create another crate (usually foobar-tests) which contains tests, and then let it belong to the workspace.

I don't know whether this is a recommended way, but it seems widely used.

1 Like


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.