Save 37% off PRO during our Black Friday Sale! »

Do we need any more test frameworks?

Acd62030df551952268e84c8fff26a5b?s=47 lazyatom
February 07, 2011

Do we need any more test frameworks?

A talk I gave at LRUG in 2011, about the plethora of testing frameworks in Ruby, and the urge to write my own

Acd62030df551952268e84c8fff26a5b?s=128

lazyatom

February 07, 2011
Tweet

Transcript

  1. you an existing library (the horse is probably your ego)

  2. you your ideal library

  3. language ✘ app framework ✘ test framework ✔

  4. test/unit rspec cucumber

  5. before / setup test ... should ... it ... after

    / teardown
  6. blah = Hubris.new do before do @x = 1 end

    it “works” do raise unless 1 == @x end after do @x = nil end end blah.run
  7. class Hubris def initialize(&block) instance_eval(&block) end def before(&block) @before =

    block end def it(name, &block) @test = block end # etc ... def run instance_eval(&@before) instance_eval(&@test) instance_eval(&@after) end end stash evaluate evaluate
  8. before / setup test ... should ... it ... after

    / teardown @f = File.new @f.unlink @f.read
  9. subcontexts: parent & child def run_befores @parent.run_befores if @parent instance_eval(&@before)

    end def run run_befores instance_eval(&@test) # etc ... end
  10. Hubris.new do def some_method @x = 1 end it “works”

    do raise unless 1 == some_method end end where does this method live?
  11. all of this has happened before; and it will all

    happen again.
  12. None
  13. AXIS OF WTF

  14. it’s probably OK.

  15. except maybe it’s not OK?

  16. maybe don’t write anything.

  17. maybe become a contributer.

  18. open source responsibility.

  19. give some context.

  20. kill-ish your darlings. bit.ly/rubytesting