问题
Well i am trying to achieve one thing. Something fancy but worth trying..
When i run bundle exec rspec spec/
My test cases pass and i get
Finished in 5.12 seconds
38 examples, 0 failures, 1 pending
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
.
eg command
say you have example_count examples, failures_count failures and pending_count pending examples
The requirement is, I need to capture Examples, Failures and pending in a variable which i can use with say
command.
回答1:
You could write custom RSpec formatter and do your magic there. You can also have multiple formatters.
Check this resources for more information:
- Custom formatters (Relish)
- How to Use Multiple Formatters in RSpec 2
- Source code base_text_formatter.rb
来源:https://stackoverflow.com/questions/15381037/rspec-how-to-capture-the-examples-failures-and-pending-count