Class: Test::Unit::TestResult
- Inherits:
-
Object
- Object
- Test::Unit::TestResult
- Defined in:
- lib/test-unit-ext/pending.rb,
lib/test-unit-ext/xml-report.rb,
lib/test-unit-ext/notification.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#failures ⇒ Object
readonly
Returns the value of attribute failures.
-
#notifications ⇒ Object
readonly
Returns the value of attribute notifications.
-
#pendings ⇒ Object
readonly
Returns the value of attribute pendings.
Instance Method Summary collapse
- #add_error(error) ⇒ Object
- #add_error_without_logs_store ⇒ Object
- #add_failure(failure) ⇒ Object
- #add_failure_without_logs_store ⇒ Object
- #add_notification(notification) ⇒ Object
- #add_pending(pending) ⇒ Object
- #add_success(success) ⇒ Object
-
#initialize ⇒ TestResult
constructor
A new instance of TestResult.
-
#initialize_without_notifications ⇒ TestResult
A new instance of TestResult.
- #initialize_without_pendings ⇒ Object
-
#initialize_without_successes ⇒ TestResult
A new instance of TestResult.
- #notification_count ⇒ Object
- #pending_count ⇒ Object
- #to_s ⇒ Object
- #to_s_without_notifications ⇒ Object
- #to_s_without_pendings ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize ⇒ TestResult
Returns a new instance of TestResult.
7 8 9 10 |
# File 'lib/test-unit-ext/pending.rb', line 7 def initialize initialize_without_pendings @pendings = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
154 155 156 |
# File 'lib/test-unit-ext/xml-report.rb', line 154 def errors @errors end |
#failures ⇒ Object (readonly)
Returns the value of attribute failures.
154 155 156 |
# File 'lib/test-unit-ext/xml-report.rb', line 154 def failures @failures end |
#notifications ⇒ Object (readonly)
Returns the value of attribute notifications.
4 5 6 |
# File 'lib/test-unit-ext/notification.rb', line 4 def notifications @notifications end |
#pendings ⇒ Object (readonly)
Returns the value of attribute pendings.
4 5 6 |
# File 'lib/test-unit-ext/pending.rb', line 4 def pendings @pendings end |
Instance Method Details
#add_error(error) ⇒ Object
175 176 177 178 |
# File 'lib/test-unit-ext/xml-report.rb', line 175 def add_error(error) @logs << error add_error_without_logs_store(error) end |
#add_error_without_logs_store ⇒ Object
174 |
# File 'lib/test-unit-ext/xml-report.rb', line 174 alias_method(:add_error_without_logs_store, :add_error) |
#add_failure(failure) ⇒ Object
169 170 171 172 |
# File 'lib/test-unit-ext/xml-report.rb', line 169 def add_failure(failure) @logs << failure add_failure_without_logs_store(failure) end |
#add_failure_without_logs_store ⇒ Object
168 |
# File 'lib/test-unit-ext/xml-report.rb', line 168 alias_method(:add_failure_without_logs_store, :add_failure) |
#add_notification(notification) ⇒ Object
12 13 14 15 16 |
# File 'lib/test-unit-ext/notification.rb', line 12 def add_notification(notification) @notifications << notification notify_listeners(FAULT, notification) notify_listeners(CHANGED, self) end |
#add_pending(pending) ⇒ Object
12 13 14 15 16 |
# File 'lib/test-unit-ext/pending.rb', line 12 def add_pending(pending) @pendings << pending notify_listeners(FAULT, pending) notify_listeners(CHANGED, self) end |
#add_success(success) ⇒ Object
163 164 165 166 |
# File 'lib/test-unit-ext/xml-report.rb', line 163 def add_success(success) @logs << success @successes << success end |
#initialize_without_notifications ⇒ TestResult
Returns a new instance of TestResult.
6 7 8 9 |
# File 'lib/test-unit-ext/notification.rb', line 6 def initialize initialize_without_pendings @pendings = [] end |
#initialize_without_pendings ⇒ Object
6 |
# File 'lib/test-unit-ext/pending.rb', line 6 alias_method(:initialize_without_pendings, :initialize) |
#initialize_without_successes ⇒ TestResult
Returns a new instance of TestResult.
156 157 158 159 |
# File 'lib/test-unit-ext/xml-report.rb', line 156 def initialize initialize_without_pendings @pendings = [] end |
#notification_count ⇒ Object
18 19 20 |
# File 'lib/test-unit-ext/notification.rb', line 18 def notification_count @notifications.size end |
#pending_count ⇒ Object
18 19 20 |
# File 'lib/test-unit-ext/pending.rb', line 18 def pending_count @pendings.size end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/test-unit-ext/pending.rb', line 23 def to_s to_s_without_pendings + ", #{pending_count} pendings" end |
#to_s_without_notifications ⇒ Object
22 23 24 |
# File 'lib/test-unit-ext/notification.rb', line 22 def to_s to_s_without_pendings + ", #{pending_count} pendings" end |
#to_s_without_pendings ⇒ Object
22 |
# File 'lib/test-unit-ext/pending.rb', line 22 alias_method(:to_s_without_pendings, :to_s) |
#to_xml ⇒ Object
180 181 182 183 184 |
# File 'lib/test-unit-ext/xml-report.rb', line 180 def to_xml return "<report/>" if @logs.empty? xml = @logs.collect {|log| log.to_xml.gsub(/^/, " ")}.join "<report>\n#{xml}</report>\n" end |