{"id":704499,"date":"2026-05-01T16:04:21","date_gmt":"2026-05-01T15:04:21","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=rust&#038;p=704499"},"modified":"2026-05-07T15:28:39","modified_gmt":"2026-05-07T14:28:39","slug":"faster-rust-tests-with-cargo-nextest","status":"publish","type":"rust","link":"https:\/\/blog.jetbrains.com\/zh-hans\/rust\/2026\/05\/01\/faster-rust-tests-with-cargo-nextest","title":{"rendered":"Faster Rust Testing at Scale: cargo-nextest in Practice"},"content":{"rendered":"\n<p><em>Disclaimer: This article was created using AI-based writing and communication companions. With its help, the core topics of this rich and nuanced livestream were distilled into a compact blog post format.<\/em><\/p>\n\n\n\n<p>In our recent JetBrains livestream,<a href=\"https:\/\/x.com\/VBragilevsky\" target=\"_blank\"> Vitaly Bragilevsky<\/a> was joined by<a href=\"https:\/\/bsky.app\/profile\/sunshowers.io\" target=\"_blank\" rel=\"noopener\"> Rain<\/a>, the creator of<a href=\"https:\/\/nexte.st\/\" target=\"_blank\" rel=\"noopener\"> cargo-nextest<\/a>, for a conversation about Rust testing, developer tools, open source maintenance, and the everyday developer experience around large Rust projects.<\/p>\n\n\n\n<p>Cargo-nextest is widely used across the Rust ecosystem as a next-generation test runner. It is built to make Rust test execution faster, more observable, and more reliable, especially for larger codebases, CI pipelines, and projects with complex integration tests.<\/p>\n\n\n\n<p>The conversation also came at a good time for RustRover users. <a href=\"https:\/\/blog.jetbrains.com\/rust\/2026\/04\/03\/rustrover-2026-1-professional-testing-with-native-cargo-nextest-integration\/\">RustRover 2026.1<\/a> introduced native cargo-nextest support, so developers can now run and monitor nextest sessions directly from the IDE, with progress reporting and structured results in the Test tool window.<\/p>\n\n\n\n<p>If you missed the livestream, you can watch the full recording on JetBrains TV. Below, you\u2019ll find a structured recap of the key questions and insights from the session.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Faster Rust Testing at Scale: cargo-nextest in Practice\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/J7Trc-mqLlI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q1. Who is Rain, and how did they get into Rust?<\/strong><\/h2>\n\n\n\n<p>Rain is a software engineer with more than a decade of industry experience. Their Rust journey started professionally in 2017 while working on source control infrastructure at Meta. Rain joined a project to build a Mercurial server in Rust. The team already had someone with Rust expertise, while Rain brought deep knowledge of Mercurial. That collaboration became their entry point into Rust.<\/p>\n\n\n    <div class=\"blockquote\">\n                    <blockquote><p>\u201cI learned Rust to kind of work on this thing. As I was developing it, I fell in love with Rust and decided to go deeper into it.\u201d<\/p><\/blockquote>\n            <div class=\"blockquote__author\">\n                                    <img decoding=\"async\" class=\"blockquote__author-img\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/1553275010805-1.jpeg\" alt=\"Rain: creator of cargo-nextest\">\n                                <div class=\"blockquote__author-info\">\n                                                        <\/div>\n            <\/div>\n            <\/div>\n\n\n\n<p>They have worked at Mozilla, Meta, and now Oxide Computer Company, where Rust is used throughout the stack, from embedded firmware to higher-level control plane software.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q2. What is cargo-nextest?<\/strong><\/h2>\n\n\n\n<p>At a high level, it is designed to run Rust tests faster and give developers better insight into what happened during a test run. In benchmarks, cargo-nextest can be up to three times faster than cargo test, depending on the project and workload.<\/p>\n\n\n\n<p>Cargo-nextest also includes features that become important as projects grow. That combination is what makes cargo-nextest useful across both open source and large industry codebases.<\/p>\n\n\n    <div class=\"blockquote\">\n                    <blockquote><p>\u201cThere is a lot of CI focus in cargo-nextest, but there is also a lot of attention paid to the local interactive developer experience.\u201d<\/p><\/blockquote>\n            <div class=\"blockquote__author\">\n                                    <img decoding=\"async\" class=\"blockquote__author-img\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/1553275010805-1.jpeg\" alt=\"Rain: creator of cargo-nextest\">\n                                <div class=\"blockquote__author-info\">\n                                                        <\/div>\n            <\/div>\n            <\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q3. What problem does cargo-nextest solve?<\/strong><\/h2>\n\n\n\n<p>Rain was clear that cargo test is still a good tool, especially for testing core algorithms, data structures, and smaller projects. The limitations become more visible when a Rust project grows into a large service, large CLI application, or codebase with many integration and end-to-end tests.<\/p>\n\n\n\n<p>In those cases, the main problems are not only \u201chow fast can I run tests?\u201d but also:<\/p>\n\n\n\n<ul>\n<li>Which tests are slow?<\/li>\n\n\n\n<li>Which tests are flaky?<\/li>\n\n\n\n<li>What happened in CI?<\/li>\n<\/ul>\n\n\n\n<p><br>Cargo-nextest is built for that kind of environment.<\/p>\n\n\n    <div class=\"blockquote\">\n                    <blockquote><p>\u201cThe biggest problem that nextest solves is speed and observability of large test suites for large network services.\u201d<\/p><\/blockquote>\n            <div class=\"blockquote__author\">\n                                    <img decoding=\"async\" class=\"blockquote__author-img\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/1553275010805-1.jpeg\" alt=\"Rain: creator of cargo-nextest\">\n                                <div class=\"blockquote__author-info\">\n                                                        <\/div>\n            <\/div>\n            <\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q4. When should someone switch from cargo test to cargo-nextest?<\/strong><\/h2>\n\n\n\n<p>If you are happy with cargo test, you do not have to switch. But if you are unhappy with some part of the testing experience, cargo-nextest is worth trying.<\/p>\n\n\n\n<p>They pointed to three common signals.<\/p>\n\n\n\n<ol>\n<li>Flaky tests. Cargo-nextest can retry tests, which helps distinguish between a consistent failure and a flaky one.&nbsp;<\/li>\n\n\n\n<li>Test isolation. Cargo-nextest runs every test in its own process. This matters for tests that rely on global state, external APIs, graphics contexts, or other resources that may not behave well when reused across tests.&nbsp;<\/li>\n\n\n\n<li>Speed. For large services and bigger test suites, cargo-nextest is often several times faster than cargo test. That can save both local developer time and CI compute.<\/li>\n<\/ol>\n\n\n    <div class=\"blockquote\">\n                    <blockquote><p>\u201cIf you are unhappy with cargo test speed, I would highly recommend giving cargo-nextest a shot.\u201d<\/p><\/blockquote>\n            <div class=\"blockquote__author\">\n                                    <img decoding=\"async\" class=\"blockquote__author-img\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/1553275010805-1.jpeg\" alt=\"Rain: creator of cargo-nextest\">\n                                <div class=\"blockquote__author-info\">\n                                                        <\/div>\n            <\/div>\n            <\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q5. What is the coolest cargo-nextest feature?<\/strong><\/h2>\n\n\n\n<p>With run recording, cargo-nextest can capture what happened during a test run, including in CI. Developers can then fetch that run locally, inspect what each test did, and better understand failures that happened outside their machine.<\/p>\n\n\n\n<p>Second one is Perfetto trace output. Cargo-nextest can generate trace data that can be opened in Perfetto, giving developers a graphical view of test execution.&nbsp;<\/p>\n\n\n    <div class=\"blockquote\">\n                    <blockquote><p>\u201cYou can get all this observability around test execution, which I think is very powerful.\u201d<\/p><\/blockquote>\n            <div class=\"blockquote__author\">\n                                    <img decoding=\"async\" class=\"blockquote__author-img\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/1553275010805-1.jpeg\" alt=\"Rain: creator of cargo-nextest\">\n                                <div class=\"blockquote__author-info\">\n                                                        <\/div>\n            <\/div>\n            <\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q6. What lesser-known feature should more people know about?<\/strong><\/h2>\n\n\n\n<p>When developers debug tests with cargo test, they often end up running the test binary directly. The problem is that cargo normally sets up environment variables and configuration around test execution.<\/p>\n\n\n\n<p>Cargo-nextest\u2019s debugger support helps solve that by configuring the environment so the test runs in the debugger in a way that is equivalent to normal execution.<\/p>\n\n\n    <div class=\"blockquote\">\n                    <blockquote><p>\u201cYou get the exact same environment in the debugger.\u201d<\/p><\/blockquote>\n            <div class=\"blockquote__author\">\n                                    <img decoding=\"async\" class=\"blockquote__author-img\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/1553275010805.jpeg\" alt=\"Rain: creator of cargo-nextest\">\n                                <div class=\"blockquote__author-info\">\n                                                        <\/div>\n            <\/div>\n            <\/div>\n\n\n\n<p><br>For developers who need to step through a single failing test, that can make the difference between chasing a misleading local reproduction and actually debugging the real failure.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q7. How does cargo-nextest help with stuck or long-running tests?<\/strong><\/h2>\n\n\n\n<p>Cargo-nextest lets you dump information about currently running tests. On any operating system, you can press T; on macOS, you can also use Control-T via SIGINFO. This gives you a live view of how long tests have been running, along with stdout and stderr output.<\/p>\n\n\n\n<p>That is especially helpful for debugging complex failures that only appear in the context of a larger run.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q8. What was the hardest part of building cargo-nextest?<\/strong><\/h2>\n\n\n\n<p>A test runner has to do much more than start a process and wait for a result. It has to observe what happens, handle success, failure, abnormal termination, timeouts, retries, output capture, scheduling, and more. As new features are added, that state machine becomes more complex.<\/p>\n\n\n\n<p>Interestingly, cargo-nextest is not a classic \u201c10 million requests per second\u201d async use case. It usually runs only as many tests as there are CPU cores or threads. But the state machine itself is complex, and async Rust gives a structured way to manage that complexity.<\/p>\n\n\n    <div class=\"blockquote\">\n                    <blockquote><p>\u201cThe state machine for managing a test is extremely complex, and being able to express that in async Rust has been very powerful.\u201d<\/p><\/blockquote>\n            <div class=\"blockquote__author\">\n                                    <img decoding=\"async\" class=\"blockquote__author-img\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/1553275010805-1.jpeg\" alt=\"Rain: creator of cargo-nextest\">\n                                <div class=\"blockquote__author-info\">\n                                                        <\/div>\n            <\/div>\n            <\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q9. What would Rain change about Rust if they could go back to 2017?<\/strong><\/h2>\n\n\n\n<p>Async Rust is powerful, but it also introduces footguns that are not present in the same way in synchronous Rust. Rust\u2019s safety model is one of the reasons they were attracted to the language, especially around thread safety, aliasing, and mutability. Async Rust keeps many of those strengths, but cancellation and cleanup can be difficult to reason about.<\/p>\n\n\n    <div class=\"blockquote\">\n                    <blockquote><p>\u201cI am hopeful, but certainly it is harder to do it now than it was to do it in 2017.\u201d<\/p><\/blockquote>\n            <div class=\"blockquote__author\">\n                                    <img decoding=\"async\" class=\"blockquote__author-img\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/1553275010805-1.jpeg\" alt=\"Rain: creator of cargo-nextest\">\n                                <div class=\"blockquote__author-info\">\n                                                        <\/div>\n            <\/div>\n            <\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q10. Is cargo-nextest extensible?<\/strong><\/h2>\n\n\n\n<p>Yes, and this is one of the reasons it has been able to integrate with other tools.<\/p>\n\n\n\n<p>Cargo-nextest provides machine-readable output formats and extension points that other tools can build on. It also supports features like setup scripts, which can prepare a database, seed test data, or configure an environment before tests run.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q11. Can cargo-nextest be useful for embedded Rust?<\/strong><\/h2>\n\n\n\n<p>Cargo-nextest itself probably will not run on embedded hardware because it is fairly complex. But it can still help with embedded testing workflows where tests are dispatched to real hardware.<\/p>\n\n\n\n<p>One relevant feature is wrapper scripts. Instead of executing a test directly, cargo-nextest can run a script around it. That script can set up the environment, send commands to the hardware, or coordinate with a target runner.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q12. What makes a great developer tool?<\/strong><\/h2>\n\n\n\n<p>For Rain, a great developer tool has to be correct and reliable, especially when things go wrong.<\/p>\n\n\n\n<p>For a test runner, that means handling more than the happy path. Tests can fail, time out, crash, segfault, produce output, or behave differently depending on the environment. A good tool needs to represent all of that clearly.<\/p>\n\n\n    <div class=\"blockquote\">\n                    <blockquote><p>\u201cThe overall goal is not to automate as much as possible. The overall goal is to serve your customers.\u201d<\/p><\/blockquote>\n            <div class=\"blockquote__author\">\n                                    <img decoding=\"async\" class=\"blockquote__author-img\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/1553275010805-1.jpeg\" alt=\"Rain: creator of cargo-nextest\">\n                                <div class=\"blockquote__author-info\">\n                                                        <\/div>\n            <\/div>\n            <\/div>\n\n\n\n<p>That is a useful principle far beyond test runners. A great developer tool does not try to remove the developer from the work. It helps them do the work with more confidence.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Q13. Which Rust tools does Rain recommend?<\/strong><\/h2>\n\n\n\n<p>Rain mentioned three:<\/p>\n\n\n\n<ul>\n<li><strong><a href=\"https:\/\/crates.io\/crates\/cargo-hack\" target=\"_blank\" rel=\"noopener\">Cargo-hack<\/a><\/strong>: Useful for crates with many feature combinations. It can run tests across feature sets and optimize combinations based on dependencies between features.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/crates.io\/crates\/cargo-expand\" target=\"_blank\" rel=\"noopener\">Cargo-expand<\/a><\/strong>: Useful when developing macros or procedural macros because it shows the expanded output.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/crates.io\/crates\/cargo-semver-checks\" target=\"_blank\" rel=\"noopener\">Cargo-semver-checks<\/a><\/strong>: Useful for crate maintainers because it detects semver compatibility issues, including simple API changes and more subtle changes such as accidentally removing Send or Sync bounds.<\/li>\n<\/ul>\n\n\n\n<p><br>Good Rust tooling helps developers understand what their code is doing, what changed, and what might break.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Cargo-nextest in RustRover<\/strong><\/h2>\n\n\n\n<p>RustRover 2026.1 adds <a href=\"https:\/\/blog.jetbrains.com\/rust\/2026\/04\/03\/rustrover-2026-1-professional-testing-with-native-cargo-nextest-integration\/\">native support for cargo-nextest directly in the IDE<\/a>. For Rust developers, this means you can run and monitor nextest sessions without leaving your normal development workflow. <\/p>\n\n\n\n<p>Instead of switching to the terminal and reading raw output, you get structured test results and progress reporting in the Test tool window.<\/p>\n\n\n    <div class=\"buttons\">\n        <div class=\"buttons__row\">\n                                                <a href=\"https:\/\/www.jetbrains.com\/rust\/download\/\" class=\"btn\" target=\"\" rel=\"noopener\">Try in RustRover<\/a>\n                                                    <\/div>\n    <\/div>\n\n\n\n\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2026\/04\/ri_run_with_nextest_dark-1.mp4\"><\/video><\/figure>\n\n\n\n<p>The goal is not to replace the terminal for developers who prefer it. The goal is to reduce friction for teams and developers who already rely on cargo-nextest and want the same workflow integrated into the IDE.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Closing thoughts<\/strong><\/h2>\n\n\n\n<p>As Rust projects grow, testing becomes part of how teams understand correctness, performance, and confidence.<\/p>\n\n\n\n<p>Cargo-nextest helps make test runs faster, more isolated, more observable, and easier to debug.<\/p>\n\n\n\n<p>If you\u2019re interested:<\/p>\n\n\n\n<ul>\n<li><a href=\"https:\/\/nexte.st\/\" target=\"_blank\" rel=\"noopener\">Explore cargo-nextest<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.jetbrains.com\/rust\/download\/\" target=\"_blank\" rel=\"noopener\">Try cargo-nextest support in RustRover 2026.1<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.youtube.com\/watch?v=J7Trc-mqLlI\" target=\"_blank\" rel=\"noopener\">Watch the full livestream with Rain<\/a><br><\/li>\n<\/ul>\n\n\n\n<p>If you\u2019re working with slow test runs, flaky tests, or complex CI failures, cargo-nextest is worth exploring.<\/p>\n","protected":false},"author":1593,"featured_media":704829,"comment_status":"closed","ping_status":"closed","template":"","categories":[6460,8643],"tags":[9090,204,8430],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/rust\/704499"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/rust"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/types\/rust"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/users\/1593"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=704499"}],"version-history":[{"count":9,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/rust\/704499\/revisions"}],"predecessor-version":[{"id":705942,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/rust\/704499\/revisions\/705942"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media\/704829"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=704499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=704499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=704499"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=704499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}