Class: QuickTestRunner::Runner
- Inherits:
-
Object
- Object
- QuickTestRunner::Runner
- Defined in:
- lib/quick_test_runner.rb
Overview
TODO: run tests that failed the last time TODO: figure out how to reload helpers TODO: get functional tests to work TODO: blueprints don’t get updated TODO: reports2_test doesn’t seem to work the second time around
Instance Attribute Summary collapse
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#options ⇒ Object
Returns the value of attribute options.
-
#test_buffer ⇒ Object
Returns the value of attribute test_buffer.
-
#test_name ⇒ Object
Returns the value of attribute test_name.
-
#test_names ⇒ Object
Returns the value of attribute test_names.
-
#test_path ⇒ Object
Returns the value of attribute test_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#clean(verbose = true) ⇒ Object
necessary to “undef” test methods so that we can reload them again (via load “test/unit…”) so that any changes made to the test file get through.
- #help ⇒ Object
-
#initialize(args = {}) ⇒ Runner
constructor
A new instance of Runner.
- #list ⇒ Object
- #run(tp = nil, tn = nil, opts = {}) ⇒ Object
- #run_suite(tp = nil) ⇒ Object
- #run_test(tn) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Runner
Returns a new instance of Runner.
17 18 19 20 21 22 |
# File 'lib/quick_test_runner.rb', line 17 def initialize args={} self.test_path = args[:test_path] self.test_name = args[:test_name] self.test_buffer = [] self. = args[:options] || {} end |
Instance Attribute Details
#klass ⇒ Object
Returns the value of attribute klass.
14 15 16 |
# File 'lib/quick_test_runner.rb', line 14 def klass @klass end |
#options ⇒ Object
Returns the value of attribute options.
13 14 15 |
# File 'lib/quick_test_runner.rb', line 13 def @options end |
#test_buffer ⇒ Object
Returns the value of attribute test_buffer.
15 16 17 |
# File 'lib/quick_test_runner.rb', line 15 def test_buffer @test_buffer end |
#test_name ⇒ Object
Returns the value of attribute test_name.
13 14 15 |
# File 'lib/quick_test_runner.rb', line 13 def test_name @test_name end |
#test_names ⇒ Object
Returns the value of attribute test_names.
14 15 16 |
# File 'lib/quick_test_runner.rb', line 14 def test_names @test_names end |
#test_path ⇒ Object
Returns the value of attribute test_path.
13 14 15 |
# File 'lib/quick_test_runner.rb', line 13 def test_path @test_path end |
Class Method Details
.readme ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/quick_test_runner.rb', line 24 def self.readme puts "" puts " **************************************************************************** " puts " * * " puts " * Type tr.help to see all available commands for the Quick Test Runner * " puts " * * " puts " * * " puts " * NOTE that you will need to restart console if you: * " puts " * * " puts " * 1. modify helper implementation code * " puts " * * " puts " * 2. modify blueprint code * " puts " * * " puts " **************************************************************************** " puts "" end |
Instance Method Details
#clean(verbose = true) ⇒ Object
necessary to “undef” test methods so that we can reload them again (via load “test/unit…”) so that any changes made to the test file get through
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/quick_test_runner.rb', line 110 def clean verbose=true return unless self.klass self.test_names.each do |tn| self.klass.send(:remove_method, tn.to_sym) end self.klass = nil self.test_names = nil console_puts "Successfully cleaned test names" if verbose end |
#help ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/quick_test_runner.rb', line 41 def help console_puts "Quick Test Runner Help" puts " run 'path', 'keyword' : runs the tests filtered by keyword of test path" puts " path does not need the '_test' appended" puts " example: tr.run 'helper/jobs_helper', 'search'" puts "" puts " run 'path' : runs the tests filtered by keyword of test path" puts " example: tr.run 'vendor'" puts "" puts " run number : rerun a test from the buffer - use tr.list to see buffer" puts " example: tr.run 2" puts "" puts " run : rerun the last test" puts " example: tr.run" puts "" puts " run_suite 'path' : run all tests in a suite specified by the path" puts " example: tr.run_suite 'vendor'" puts "" puts " run_test 'keyword' : runs the tests filtered to keyword of a previously specified test suite (use tr.run_suite or tr.run to set the suite)" puts " example: tr.run_test 'search'" puts "" puts " list : list buffer of previous run tests" puts " example: tr.list" puts "" puts " Feel free too look at /test/test_runner.rb and offer improvements, suggestions or complaints!" puts "" end |
#list ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/quick_test_runner.rb', line 100 def list self.test_buffer.each_with_index do |test_entry, i| txt = "#{i+1}. #{test_entry[0]}" txt << " - #{test_entry[1]}" if test_entry[1] puts txt end puts "" end |
#run(tp = nil, tn = nil, opts = {}) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/quick_test_runner.rb', line 69 def run tp=nil, tn=nil, opts={} if tp.is_a? Integer rerun tp return end if tn.nil? and not tp.nil? run_suite tp return end self.test_path = tp ? tp : self.test_path self.test_name = tn ? tn : self.test_name self. = opts internal_run end |
#run_suite(tp = nil) ⇒ Object
87 88 89 90 91 92 |
# File 'lib/quick_test_runner.rb', line 87 def run_suite tp=nil self.test_path = tp ? tp : self.test_path self.test_name = nil internal_run end |
#run_test(tn) ⇒ Object
94 95 96 97 98 |
# File 'lib/quick_test_runner.rb', line 94 def run_test tn self.test_name = tn internal_run end |