Rspec:如何捕获示例、失败和挂起计数 [英] Rspec: How to capture the examples, Failures and pending Count
问题描述
嗯,我正在努力实现一件事.一些花哨但值得尝试的东西..
Well i am trying to achieve one thing. Something fancy but worth trying..
当我运行 bundle exec rspec spec/
我的测试用例通过了,我得到了
My test cases pass and i get
Finished in 5.12 seconds
38 examples, 0 failures, 1 pending
我想使用 MAC OS say
命令(阅读 此处 关于它).这会在测试套件完成后说,您有 38 个示例,0 个失败和 1 个待处理的示例
.
I want to use the MAC OS say
command (Read here about it). Which will say after the test suite has completed, that you have 38 examples, 0 failures and 1 pending example
.
例如命令
假设您有 example_count 个示例、 failures_count 个失败和 pending_count 个未决示例
要求是,我需要在一个变量中捕获示例、失败和未决,我可以将其与 say
命令一起使用.
The requirement is, I need to capture Examples, Failures and pending in a variable which i can use with say
command.
推荐答案
您可以编写自定义 RSpec 格式化程序并在那里发挥您的魔力.您还可以有多个格式化程序.
You could write custom RSpec formatter and do your magic there. You can also have multiple formatters.
查看此资源以获取更多信息:
Check this resources for more information:
这篇关于Rspec:如何捕获示例、失败和挂起计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!