Service
This service plugin runs your test/unit (or minitest) tests based unit tests using the testrb commandline tool.
TODO: How to abort lifecycle if fail?
Default test file patterns.
Special writer to ensure the value is a list.
# File lib/plugins/syckle/testrb.rb, line 44 def exclude=(val) @exclude = val.to_list end
Special writer to ensure the value is a list.
# File lib/plugins/syckle/testrb.rb, line 39 def loadpath=(val) @loadpath = val.to_list end
Special writer to ensure the value is a list.
# File lib/plugins/syckle/testrb.rb, line 49 def requires=(val) @requires = val.to_list end
Run unit tests. Unlike test-solo and test-cross this loads all tests and runs them together in a single process.
Note that this shells out to the testrb program.
TODO: Generate a test log entry?
# File lib/plugins/syckle/testrb.rb, line 96 def runtests tests = self.tests loadpath = self.loadpath requires = self.requires live = self.live exclude = self.exclude #log = options['log'] != false #logfile = File.join('log', apply_naming_policy('test', 'log')) # what about arguments for selecting specific tests? #tests = EVN['TESTS'] if ENV['TESTS'] #unless live # loadpath.each do |lp| # $LOAD_PATH.unshift(File.expand_path(lp)) # end #end if File.exist?('test/suite.rb') files = 'test/suite.rb' else files = multiglob_r(*tests) end if files.empty? status "WARNING: NO TESTS DEFINED!" return end # TODO: Use a subdirectory for log. Also html or xml format possible? filelist = files.select{|file| !File.directory?(file) }.join(' ') logfile = project.log + 'testrb.log' # TODO: Does tee work on Windows? if live command = %[testrb #{filelist} 2>&1 | tee -a #{logfile}] else command = %[testrb -I#{loadpath.join(':')} #{filelist} 2>&1 | tee -a #{logfile}] end success = sh(command) #, :show=>true) #show? abort "Tests failed." unless success #if log && !trial? # command = %[testrb -I#{loadpath} #{filelist} > #{logfile} 2>&1] # /dev/null 2>&1 # system command # puts "Updated #{logfile}" #end end
Generated with the Darkfish Rdoc Generator 2.