Skip to content
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

Cargo nextest integration #992

Open
somehowchris opened this issue Apr 16, 2022 · 4 comments
Open

Cargo nextest integration #992

somehowchris opened this issue Apr 16, 2022 · 4 comments
Assignees

Comments

@somehowchris
Copy link

somehowchris commented Apr 16, 2022

Describe the feature
Simply said, I would like to use cargo nextest Instead of cargo test

Why?
So I love cargo tarpaulin But for running test cargo nextest Is just simply much faster and has things like retires which makes work just more efficient.

Some Ressources:

Now I haven’t dug into the cargo-tarpaulin Code as it doesn’t seem like a 30 min thing to do, so my general questions are. Would it be hard to integration something like this? Do you have any code parts or points to watch out if I would have a go on that?

As it seems —command Can be set to build Or test, how big would the effort be to have a third option?

@xd009642
Copy link
Owner

So I was going to suggest a vague idea of how to do it but as I think about it more I don't think it will work, with the current ptrace engine without a different flag added. The Command option does the build step as cargo build or cargo test --no-run, and those both output metadata on where the binaries end up (except for doc tests which are another edge case, they're detected in a folder from some other config opt to cargo). And then the binaries are ran directly - not sure if that works with nextest or if the nextest runner requires you to do cargo nextest 🤔

Generally, with ptrace coverage tools like kcov or tarpaulin you need the binary to get coverage for before starting coverage collection to read the debug info, so building tests and running tests needs to be 2 separate stages with a stage between to identify coverage spots.

@xd009642
Copy link
Owner

I probably won't look at this soon as I'm rather overloaded but I can offer advice/guidance beyond this if you're will to contribute 😅 otherwise I may try and move some work projects to nextest and figure it out then a bit in future

@sunshowers
Copy link

Generally, with ptrace coverage tools like kcov or tarpaulin you need the binary to get coverage for before starting coverage collection to read the debug info, so building tests and running tests needs to be 2 separate stages with a stage between to identify coverage spots.

Thanks for looking into this! cargo nextest does support splitting up the build and run phases: https://nexte.st/book/reusing-builds.html

There's also support for listing tests with machine-readable output: https://nexte.st/book/machine-readable.html (in particular, --list-type binaries-only will produce just a JSON list of binaries which can be deserialized into https://docs.rs/nextest-metadata/latest/nextest_metadata/struct.BinaryListSummary.html).

Hope that helps!

@detly
Copy link

detly commented Aug 16, 2023

This also relates to something I mention in #1352: needing to run separate CI jobs for build + test, and for coverage. It's not possible to get jUnit XML output for the test results using libtest (any more), so in order to get jUnit reports for the test results I now run tests via cargo nextest. To get coverage I run cargo tarpaulin. The extra redundancy = longer time for CI runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants