如何 运行 多个特定 RSpec 测试?
How to run multiple specific RSpec tests?
我有一个巨大的测试套件(> 5000 个测试)需要一个小时才能 运行。 400 个都失败了,我有一个这样的失败测试列表:
rspec ./spec/models/fullscreen_hidden_view_state_spec.rb:116 # FullscreenHiddenViewState showing a playlist on third element - slide has all the right links and properties
rspec ./spec/features/fullscreen/play_spec.rb:59 # View case in fullscreen presention mode Courtesy section when viewing the cases discussion via the cases hidden share token the Add To button should be hidden
rspec ./spec/features/cases/index_spec.rb:204 # finding a case Filtering by study modality Filtering by modality only shows cases with modality
rspec ./spec/models/playlist_spec.rb[1:2:2:2:1] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for annonymous contains public playlists
rspec ./spec/models/playlist_spec.rb[1:2:2:2:2] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for annonymous works
rspec ./spec/models/playlist_spec.rb[1:2:2:3:1] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for privileged user contains all playlists
rspec ./spec/models/playlist_spec.rb[1:2:2:1:1] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for unprivileged users contains public and the users unlisted playlists
rspec ./spec/models/playlist_spec.rb[1:2:2:1:2] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for unprivileged users works
rspec ./spec/models/user_spec.rb:1004 # User quotas limited_unlisted_cases? user with manage cases privilege should equal false
rspec ./spec/models/user_spec.rb:813 # User quotas #can_add_draft_case? when non-deleted draft case count above the limit for privileged user should equal true
rspec ./spec/models/user_spec.rb:920 # User quotas #allowed_draft_cases user with manage cases privilege should eq -1
rspec ./spec/models/user_spec.rb:962 # User quotas allowed_unlisted_playlists user with manage cases privilege should eq -1
rspec ./spec/models/user_spec.rb:861 # User quotas allowed_unlisted_cases user with manage cases privilege should eq -1
我知道我可以 运行 每行 运行 特定测试,但是有没有简单的方法来 运行 所有这些?
您可以使用以下语法来运行您的多个文件规范:
rspec path/to/first/file path/to/second/file
您可以使用 rspec --only-failures
选项,它只会加载失败的 运行 规范文件。
更新: 正如@Grzegorz 在评论中提到的,你必须先 运行 所有这些并且这个命令将给出最后一个 运行.
FYI, might not answer this question exactly but it's expected to help other visitors with similar queries.
具有模式的多个文件
如果您希望 运行 从某些特定文件夹进行规范,那么您可以使用
rspec --pattern=./spec/features/**/*_spec.rb
如果你想排除一些文件
rspec --pattern=./spec/features/**/*_spec.rb --exclude-pattern="./spec/features/{folder1,folder2}/**/*_spec.rb"
查看此了解更多信息https://relishapp.com/rspec/rspec-core/v/3-8/docs/command-line/pattern-option
以某些字符或短语开头的多个文件
rspec --pattern="./spec/features/[t]*_spec.rb"
在这里,它将 运行 所有文件名以 t
开头的规范。
rspec --pattern="./spec/features/[tran|u]*_spec.rb"
在这里,它将 运行 所有文件名以 tran
或 u
开头的规范。
要了解更多信息,请访问 How to run multiple spec files in RSpec using single command in terminal?
我有一个巨大的测试套件(> 5000 个测试)需要一个小时才能 运行。 400 个都失败了,我有一个这样的失败测试列表:
rspec ./spec/models/fullscreen_hidden_view_state_spec.rb:116 # FullscreenHiddenViewState showing a playlist on third element - slide has all the right links and properties
rspec ./spec/features/fullscreen/play_spec.rb:59 # View case in fullscreen presention mode Courtesy section when viewing the cases discussion via the cases hidden share token the Add To button should be hidden
rspec ./spec/features/cases/index_spec.rb:204 # finding a case Filtering by study modality Filtering by modality only shows cases with modality
rspec ./spec/models/playlist_spec.rb[1:2:2:2:1] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for annonymous contains public playlists
rspec ./spec/models/playlist_spec.rb[1:2:2:2:2] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for annonymous works
rspec ./spec/models/playlist_spec.rb[1:2:2:3:1] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for privileged user contains all playlists
rspec ./spec/models/playlist_spec.rb[1:2:2:1:1] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for unprivileged users contains public and the users unlisted playlists
rspec ./spec/models/playlist_spec.rb[1:2:2:1:2] # Playlist it should behave like an entity with privacy .by_privilege (Playlist examples) for unprivileged users works
rspec ./spec/models/user_spec.rb:1004 # User quotas limited_unlisted_cases? user with manage cases privilege should equal false
rspec ./spec/models/user_spec.rb:813 # User quotas #can_add_draft_case? when non-deleted draft case count above the limit for privileged user should equal true
rspec ./spec/models/user_spec.rb:920 # User quotas #allowed_draft_cases user with manage cases privilege should eq -1
rspec ./spec/models/user_spec.rb:962 # User quotas allowed_unlisted_playlists user with manage cases privilege should eq -1
rspec ./spec/models/user_spec.rb:861 # User quotas allowed_unlisted_cases user with manage cases privilege should eq -1
我知道我可以 运行 每行 运行 特定测试,但是有没有简单的方法来 运行 所有这些?
您可以使用以下语法来运行您的多个文件规范:
rspec path/to/first/file path/to/second/file
您可以使用 rspec --only-failures
选项,它只会加载失败的 运行 规范文件。
更新: 正如@Grzegorz 在评论中提到的,你必须先 运行 所有这些并且这个命令将给出最后一个 运行.
FYI, might not answer this question exactly but it's expected to help other visitors with similar queries.
具有模式的多个文件
如果您希望 运行 从某些特定文件夹进行规范,那么您可以使用
rspec --pattern=./spec/features/**/*_spec.rb
如果你想排除一些文件
rspec --pattern=./spec/features/**/*_spec.rb --exclude-pattern="./spec/features/{folder1,folder2}/**/*_spec.rb"
查看此了解更多信息https://relishapp.com/rspec/rspec-core/v/3-8/docs/command-line/pattern-option
以某些字符或短语开头的多个文件
rspec --pattern="./spec/features/[t]*_spec.rb"
在这里,它将 运行 所有文件名以 t
开头的规范。
rspec --pattern="./spec/features/[tran|u]*_spec.rb"
在这里,它将 运行 所有文件名以 tran
或 u
开头的规范。
要了解更多信息,请访问 How to run multiple spec files in RSpec using single command in terminal?