简体   繁体   English

测试套件使用MiniTest分两批运行

[英]Test suite runs in two batches with MiniTest

In a Rails 4.0.2 app, when running rake test with MiniTest, the tests run in batches, instead of reporting aggregate pass/fail numbers for all tests. 在Rails 4.0.2应用程序中,使用MiniTest运行rake test时,测试将批量运行,而不是报告所有测试的合计通过/失败次数。 That is, the model tests run as one batch, and the integration tests as another. 也就是说,模型测试以一批运行,而集成测试则以另一批运行。 My output from a single invocation of rake test looks like this: 我从一次rake test调用中得到的输出如下所示:

Loaded Suite test,test/integration,test/models
# All the model tests run and print their output here
18 tests, 18 passed, 0 failures, 0 errors, 1 skips, 40 assertions

Loaded Suite test,test/integration,test/models
# All the integration tests run and print their output here
5 tests, 5 passed, 0 failures, 0 errors, 0 skips, 24 assertions

This does not occur when I run rake test:all . 当我运行rake test:all时, 不会发生这种情况。 I tested this with the built-in MiniTest runner and the Turn runner. 我使用内置的MiniTest运行器和Turn运行器进行了测试。 Both exhibit this behavior. 两者都表现出这种行为。

Is it intentional that MiniTest splits the tests into batches when running rake test but not rake test:all ? MiniTest是否有意在运行rake test而不是rake test:all时将测试分为几批?

I did a bundle update , and none of my testing gems have a version constraint, so I believe everything is up to date. 我进行了bundle update ,并且我的测试gem都没有版本限制,因此我相信一切都是最新的。 Gem versions: 宝石版本:

  • Rails 4.0.2 Rails 4.0.2
  • MiniTest 4.7.5 MiniTest 4.7.5
  • MiniTest Rails 0.9.2 MiniTest Rails 0.9.2

This is intentional in that this is how the rails testing tasks work in rails 3.x. 这是有意的,因为这是Rails测试任务在Rails 3.x中的工作方式。 The minitest-rails library overrides the tasks and gives you the old behavior. minitest-rails库将覆盖任务,并为您提供旧的行为。 An upcoming release of minitest-rails will change this and work similar to the rails 4 tasks work. minitest-rails即将发布的版本将对此进行更改,其工作原理类似于rails 4任务的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM