Class: PerformanceTester::Outcome
- Inherits:
-
Object
- Object
- PerformanceTester::Outcome
- Defined in:
- lib/performance_tester/outcome.rb
Overview
Documents the outcome of a scenario
Defined Under Namespace
Classes: Request
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#period ⇒ Object
readonly
Returns the value of attribute period.
-
#requests ⇒ Object
readonly
Returns the value of attribute requests.
Instance Method Summary collapse
- #finished_at ⇒ Object
-
#initialize(network_traffic, period, hosts, error = false) ⇒ Outcome
constructor
A new instance of Outcome.
- #started_at ⇒ Object
- #success? ⇒ Boolean
- #to_s ⇒ Object
- #total_time_elapsed ⇒ Object
Constructor Details
#initialize(network_traffic, period, hosts, error = false) ⇒ Outcome
Returns a new instance of Outcome.
9 10 11 12 13 |
# File 'lib/performance_tester/outcome.rb', line 9 def initialize(network_traffic, period, hosts, error = false) @requests = network_traffic.map { |request| Request.new(request, hosts) } @period = period @error = error end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/performance_tester/outcome.rb', line 7 def error @error end |
#period ⇒ Object (readonly)
Returns the value of attribute period.
7 8 9 |
# File 'lib/performance_tester/outcome.rb', line 7 def period @period end |
#requests ⇒ Object (readonly)
Returns the value of attribute requests.
7 8 9 |
# File 'lib/performance_tester/outcome.rb', line 7 def requests @requests end |
Instance Method Details
#finished_at ⇒ Object
23 24 25 |
# File 'lib/performance_tester/outcome.rb', line 23 def finished_at period.last end |
#started_at ⇒ Object
19 20 21 |
# File 'lib/performance_tester/outcome.rb', line 19 def started_at period.first end |
#success? ⇒ Boolean
27 28 29 |
# File 'lib/performance_tester/outcome.rb', line 27 def success? !error end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/performance_tester/outcome.rb', line 31 def to_s error ? error.to_s : requests.map(&:to_s).inspect end |
#total_time_elapsed ⇒ Object
15 16 17 |
# File 'lib/performance_tester/outcome.rb', line 15 def total_time_elapsed finished_at - started_at end |