Loading ...
Sorry, an error occurred while loading the content.
 

Trigger Builder to "Test-everything-on-save" [Was: Acceptance Testing as Negative Impact Testing]

Expand Messages
  • Phlip
    ... This is TriggerBuilder, in non-idiomatic Ruby: # run builder.sh whenever any of the files timeMap = {} puts ARGV.inspect() ARGV.each { |f| timeMap[f] =
    Message 1 of 1 , Feb 5, 2003
      > All hail! I've just discovered "compile-everything-on-save" in my IDE.
      > "Test-everything-on-save" is something I can only dream about.

      This is TriggerBuilder, in non-idiomatic Ruby:

      # run builder.sh whenever any of the files

      timeMap = {}

      puts ARGV.inspect()

      ARGV.each { |f|
      timeMap[f] = File.mtime(f)
      }

      while(1) do
      sleep(0.3)

      ARGV.each { |f|
      if (timeMap[f] != File.mtime(f)) then
      puts f
      sleep(0.1) # let others write

      system('sh ./builder.sh &')

      break
      end
      }

      ARGV.each { |f|
      timeMap[f] = File.mtime(f)
      }
      end

      You run it with a bunch of files on the command line:

      ruby trigger.rb rose.cpp garden.cpp

      You put >anything< inside the builder.sh.

      Everytime you save, trigger.rb detects the file change (via the miracle of a
      brute-force spin lock) and runs the shell command inside builder.sh.

      Now, passing errors back to your IDE's error navigation system is left as an
      excercize for the user. In Linux, use the editor Kate with a patch I sent
      the developers.

      However, real TDD programmers don't have syntax errors, they have Acts of
      God. Hit Undo and try again.

      --
      Phlip
      http://www.greencheese.org/CydoniaFaceOnMars
      -- All sensors report Patti having a very good time --
    Your message has been successfully submitted and would be delivered to recipients shortly.