-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support discoverability of test targets accepted by cargo test --test
#8717
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
So I can see
The downside to |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@epage That invocation doesn't work in my case ( sanmai@server4:~/workspace$ cargo test --no-run --test
error: "--test" takes one argument.
No tests available.
sanmai@server4:~/workspace$ cargo test --test
error: "--test" takes one argument.
No tests available. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Not sure what to say but it works for me in a workspace (virtual or not) or out of it $ cargo -V
cargo 1.68.0 (115f34552 2023-02-26)
$ cargo test --test
error: "--test" takes one argument.
Available tests:
builder
derive
derive_ui
examples
macros
ui
$ cargo +1.64.0 test --test
error: "--test" takes one argument.
Available tests:
builder
derive
derive_ui
examples
macros
ui
$ cargo +1.60.0 test --test # Note: I had to switch to an older version with an appropriate MSRV
error: "--test" takes one argument.
Available tests:
builder
derive
derive_ui
examples
macros
yaml |
@sanmai-NL I just noticed your error said |
The workspace isn't mine. But say it only has lib tests, then this proves that command isn't generic for test function discovery. The nextest command is (for lib tests at least). |
This issue is about discovery of test targets usable with |
@epage I wasn't fully aware of the distinction in @rrnewton Would you mind clarifying the title to refer to integration tests rather than the current more technical description? Helps understandability and findability of the issue. So, I think the more general functional requirement would be something like: as a developer or test engineer in Rust, want a CLI report in terms of a machine readable list of all discovered tests by their full item paths. Here, test meaning every function that would be executed when If we want to broaden the issue, then suggest to change the title as well. |
No, this is s a very different issue. The current issue is about making it easier to discover the appropriate parameters to the If you are wanting something else, please open a different issue. However, I suspect what you want is already available because |
Problem
Context: I have many test targets and want to narrow down the scope of
cargo test
while in the development loop. Regular test filtering still spends a bunch of time running targets that sayok. 0 passed
.This interaction is frustrating:
Ok, great, but please tell me what the set of test targets is or how to find it. In this case, I want to run an integration test corresponding to a file
tests/foobar.rs
, but not how to express that in the right format for--test
. Let's check the help:That doesn't shine any more light on it. What is the set from which NAME is drawn? What's the "type", if you will?
Next I looked for something like
--list-targets
but didn't find it.Finally, I look through the output of
cargo test
, hoping that it essentially serves the function of listing test targets. But the printouts during a test run look like this:And that's clearly not the string I'm supposed to provide to
--test
!Solution
Here are three possible solutions:
cargo test --list
and mention it from thecargo test --test
error message.cargo test --test
error message. This can be truncated if it's excessively long.Related
It seems #8396 is the only other issue that mentions this error message.
There was also this very old #812 discussing the documentation for
cargo test
vscargo test --test
.The text was updated successfully, but these errors were encountered: