Sha256: 192444e7bd2c33e96ff5c2a7417cb946974836c80619b6223fa814b6dacaf676
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
module Micron class Runner class TestFile def initialize(filename) @filename = filename end # Load the test file # # @throws [Exception] exception, if one was raised during loading def load(coverage=false) if coverage then file = @filename EasyCov.filters << lambda { |f| f == file } EasyCov.start end require @filename return nil end # Simply load the file and collect coverage def collect_coverage worker = ForkWorker.new do load(true) EasyCov.dump end worker.run worker.wait end # Execute the tests in the file, using the given Clazz # # @param [Clazz] run_clazz # # @return [Array<Object>] array of Clazz and Exception objects def run(run_clazz) results = [] test_clazz = TestCase.subclasses.last begin clazz = run_clazz.new(test_clazz, @filename) Micron.runner.report(:start_class, clazz) if !clazz.methods.empty? then clazz.run results << clazz end Micron.runner.report(:end_class, clazz) rescue Exception => ex # Error with loading the test class itself results << ex return results end return results end # Run the given test method # # @param [String] test_clazz Name of the TestCase Class # @param [String] test_method Method name # @param [Clazz] run_clazz Clazz to run with # # @return [Method] def run_method(test_clazz, test_method, run_clazz) clazz = run_clazz.new(test_clazz, @filename) method = clazz.methods.find{ |m| m.name.to_s == test_method } method.run return method end end # TestFile end # Runner end # Micron
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
micron-0.5.0 | lib/micron/runner/test_file.rb |