Class: Testmgr::TestComposite
- Inherits:
-
AbstractTest
- Object
- AbstractTest
- Testmgr::TestComposite
- Defined in:
- lib/testmgr/base/test_composite.rb
Instance Attribute Summary collapse
-
#full_path ⇒ Object
Returns the value of attribute full_path.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
Attributes inherited from AbstractTest
Instance Method Summary collapse
- #add(r) ⇒ Object
- #add_sub_task(task) ⇒ Object
- #child(name) ⇒ Object
- #get_child(name) ⇒ Object
- #get_name ⇒ Object
- #get_parent ⇒ Object
- #get_parents ⇒ Object
- #get_time_required ⇒ Object
- #getResult ⇒ Object
-
#initialize(name) ⇒ TestComposite
constructor
A new instance of TestComposite.
- #print ⇒ Object
- #remove_sub_task(task) ⇒ Object
- #set_parent(parent) ⇒ Object
- #tc(name) ⇒ Object
- #testcase(name) ⇒ Object
-
#total_number_basic_tasks ⇒ Object
Any one of hose subtasks could itself be a huge composite with many of its own sub-subtasks.
Constructor Details
#initialize(name) ⇒ TestComposite
Returns a new instance of TestComposite.
10 11 12 13 14 15 16 |
# File 'lib/testmgr/base/test_composite.rb', line 10 def initialize(name) super(name) @name=name @sub_tasks=[] @full_path = @name @parent=nil end |
Instance Attribute Details
#full_path ⇒ Object
Returns the value of attribute full_path.
7 8 9 |
# File 'lib/testmgr/base/test_composite.rb', line 7 def full_path @full_path end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/testmgr/base/test_composite.rb', line 6 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
8 9 10 |
# File 'lib/testmgr/base/test_composite.rb', line 8 def parent @parent end |
Instance Method Details
#add(r) ⇒ Object
50 51 52 |
# File 'lib/testmgr/base/test_composite.rb', line 50 def add(r) add_sub_task(r) end |
#add_sub_task(task) ⇒ Object
44 45 46 47 48 |
# File 'lib/testmgr/base/test_composite.rb', line 44 def add_sub_task(task) @sub_tasks << task task.set_parent(self) task end |
#child(name) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/testmgr/base/test_composite.rb', line 96 def child(name) # puts __FILE__ + (__LINE__).to_s + " [search child]:#{name}" _child=nil @sub_tasks.each { |task| # puts __FILE__ + (__LINE__).to_s + " o task( #{task.get_name} ) => #{task.class.to_s}" _c=task.child(name) if _c # puts __FILE__ + (__LINE__).to_s + " Found => Name:#{_c.name}" _child=_c end } _child end |
#get_child(name) ⇒ Object
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/testmgr/base/test_composite.rb', line 113 def get_child(name) _c=child(name) if _c.nil? _c=testcase(name) end # puts __FILE__ + (__LINE__).to_s + " FOUND => #{_c.class.to_s} " + _c.name if _c _c end |
#get_name ⇒ Object
18 19 20 |
# File 'lib/testmgr/base/test_composite.rb', line 18 def get_name @name end |
#get_parent ⇒ Object
22 23 24 |
# File 'lib/testmgr/base/test_composite.rb', line 22 def get_parent @parent end |
#get_parents ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/testmgr/base/test_composite.rb', line 26 def get_parents _parents="" _parents=@parent.get_name if @parent _p=@parent while _p && _p.get_parent do _parents = "#{_p.get_parent.get_name} => " + _parents _p=_p.get_parent end _parents end |
#get_time_required ⇒ Object
58 59 60 61 |
# File 'lib/testmgr/base/test_composite.rb', line 58 def get_time_required time=0.0 @sub_tasks.each { |task| time += task.get_time_required } end |
#getResult ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/testmgr/base/test_composite.rb', line 63 def getResult() rc=true @sub_tasks.each do |task| rc = rc && task.getResult() end rc end |
#print ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/testmgr/base/test_composite.rb', line 72 def print # puts __FILE__ + (__LINE__).to_s + " -- print( #{@name} ) --" puts "REQ : #{@name} : #{@sub_tasks.length.to_s} test cases." @sub_tasks.each do |task| # puts __FILE__ + (__LINE__).to_s + " ** #{task.class.to_s} **" task.print end end |
#remove_sub_task(task) ⇒ Object
54 55 56 |
# File 'lib/testmgr/base/test_composite.rb', line 54 def remove_sub_task(task) @sub_tasks.delete(task) end |
#set_parent(parent) ⇒ Object
39 40 41 42 |
# File 'lib/testmgr/base/test_composite.rb', line 39 def set_parent(parent) # puts __FILE__ + (__LINE__).to_s + " CompositeTask::set_parent" @parent=parent end |
#tc(name) ⇒ Object
81 82 83 |
# File 'lib/testmgr/base/test_composite.rb', line 81 def tc(name) child(name) end |
#testcase(name) ⇒ Object
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/testmgr/base/test_composite.rb', line 85 def testcase(name) tc=child(name) if tc.nil? _tc = Testmgr::TestCase.new(name, name) tc=add(_tc) end tc end |
#total_number_basic_tasks ⇒ Object
Any one of hose subtasks could itself be a huge composite with many of its own sub-subtasks.
126 127 128 129 130 |
# File 'lib/testmgr/base/test_composite.rb', line 126 def total_number_basic_tasks total=0 @sub_tasks.each { |task| total += task.total_number_basic_tasks } total end |