If I have an object `obj` that is a SpecTask, and subsequently invoke it, is there a way to programmatically determine the number of tests that were successful, failed, and pending as a result of running that SpecTask? -- John Feminella Principal Consultant, Distilled Brilliance
David Chelimsky
2010-Jun-02 13:02 UTC
[rspec-users] Programmatically counting RSpec tests?
On Jun 2, 2010, at 7:50 AM, John Feminella wrote:> If I have an object `obj` that is a SpecTask, and subsequently invoke > it, is there a way to programmatically determine the number of tests > that were successful, failed, and pending as a result of running that > SpecTask?You could write a custom reporter to collect that information. Which version of rspec are you using?
This is RSpec 1.3.0. -- John Feminella Principal Consultant, Distilled Brilliance On Wed, Jun 2, 2010 at 09:02, David Chelimsky <dchelimsky at gmail.com> wrote:> On Jun 2, 2010, at 7:50 AM, John Feminella wrote: > >> If I have an object `obj` that is a SpecTask, and subsequently invoke >> it, is there a way to programmatically determine the number of tests >> that were successful, failed, and pending as a result of running that >> SpecTask? > > You could write a custom reporter to collect that information. Which version of rspec are you using?
David Chelimsky
2010-Jun-02 13:19 UTC
[rspec-users] Programmatically counting RSpec tests?
On Jun 2, 2010, at 8:14 AM, John Feminella wrote:> On Wed, Jun 2, 2010 at 09:02, David Chelimsky <dchelimsky at gmail.com> wrote: >> On Jun 2, 2010, at 7:50 AM, John Feminella wrote: >> >>> If I have an object `obj` that is a SpecTask, and subsequently invoke >>> it, is there a way to programmatically determine the number of tests >>> that were successful, failed, and pending as a result of running that >>> SpecTask? >> >> You could write a custom reporter to collect that information. Which version of rspec are you using?> This is RSpec 1.3.0.Take a look at http://wiki.github.com/dchelimsky/rspec/custom-formatters Also: http://rspec.rubyforge.org/rspec/1.3.0/classes/Spec/Runner/Formatter/BaseFormatter.html Let us know if you have any questions Cheers, David
This looks pretty straightforward. I do wish it were possible to access the statistical data after the test rather than having to capture and process it inline via the formatter, but I think this will do. Thank you for your time, David. -- John Feminella Principal Consultant, Distilled Brilliance On Wed, Jun 2, 2010 at 09:19, David Chelimsky <dchelimsky at gmail.com> wrote:> On Jun 2, 2010, at 8:14 AM, John Feminella wrote: > >> On Wed, Jun 2, 2010 at 09:02, David Chelimsky <dchelimsky at gmail.com> wrote: >>> On Jun 2, 2010, at 7:50 AM, John Feminella wrote: >>> >>>> If I have an object `obj` that is a SpecTask, and subsequently invoke >>>> it, is there a way to programmatically determine the number of tests >>>> that were successful, failed, and pending as a result of running that >>>> SpecTask? >>> >>> You could write a custom reporter to collect that information. Which version of rspec are you using? > >> This is RSpec 1.3.0. > > Take a look at http://wiki.github.com/dchelimsky/rspec/custom-formatters > > Also: http://rspec.rubyforge.org/rspec/1.3.0/classes/Spec/Runner/Formatter/BaseFormatter.html > > Let us know if you have any questions > > Cheers, > David
David Chelimsky
2010-Jun-02 13:27 UTC
[rspec-users] Programmatically counting RSpec tests?
On Jun 2, 2010, at 8:23 AM, John Feminella wrote:> On Wed, Jun 2, 2010 at 09:19, David Chelimsky <dchelimsky at gmail.com> wrote: >> On Jun 2, 2010, at 8:14 AM, John Feminella wrote: >> >>> On Wed, Jun 2, 2010 at 09:02, David Chelimsky <dchelimsky at gmail.com> wrote: >>>> On Jun 2, 2010, at 7:50 AM, John Feminella wrote: >>>> >>>>> If I have an object `obj` that is a SpecTask, and subsequently invoke >>>>> it, is there a way to programmatically determine the number of tests >>>>> that were successful, failed, and pending as a result of running that >>>>> SpecTask? >>>> >>>> You could write a custom reporter to collect that information. Which version of rspec are you using? >> >>> This is RSpec 1.3.0. >> >> Take a look at http://wiki.github.com/dchelimsky/rspec/custom-formatters >> >> Also: http://rspec.rubyforge.org/rspec/1.3.0/classes/Spec/Runner/Formatter/BaseFormatter.html >> >> Let us know if you have any questions> This looks pretty straightforward. I do wish it were possible to > access the statistical data after the test rather than having to > capture and process it inline via the formatter,This is open source. Your wish is your command. The rspec-2 architecture should make it easier to get what you want. Feel free to look it over and offer up a patch. Cheers, David