为什么``货物测试''说“运行0个测试”在进行测试之前?
我是Rust的新手,目前我正在尝试为现有脚本的重构版本创建测试用例。我注意到,每当我运行货物测试
时,我首先收到消息“运行0个测试”,然后收到“运行X tests”(其中X x我编写的测试数)。
如何找到“运行0个测试”的来源?
I'm new to Rust and I'm currently trying to create test cases for a refactored version of an existing script. I noticed that for some reason whenever I run cargo test
, I first receive the message "running 0 tests" and then "running x tests" (where x the number of tests I have written).
How can I find the source of "running 0 tests"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Rust将其测试套件分为两个类别集成测试。单位测试在私有子模块下使用代码的其余部分进行源文件(通常称为
mod Tests
)。集成测试在一个称为test
的单独板条箱中进行,完全与代码的其余部分完全脱节。前者可以在当前模块中访问私人数据,而后者被迫作为独立方互动。货物测试
首先运行单元测试,然后进行集成测试。如果您没有单位测试,它将通知您所有0个都已通过,然后继续进行您编写的测试。Rust splits its testing suite into two categories: Unit and integration tests. Unit tests go in the source files with the rest of your code under a private submodule (usually conventionally called
mod tests
). Integration tests go in a separate crate calledtest
completely disjoint from the rest of your code. The former has access to private data in the current module, whereas the latter is forced to interact with it as an independent party.cargo test
runs unit tests first, then integration tests. If you have no unit tests, it will inform you that all 0 of them have passed and then move on to the tests you wrote.