Class: ResponseTimeChecker

Inherits:
Checker
  • Object
show all
Defined in:
lib/plugins/plug05_response_time_checker.rb

Instance Method Summary collapse

Methods inherited from Checker

available_plugins, #initialize

Constructor Details

This class inherits a constructor from Checker

Instance Method Details

#checkObject

checks if the request response cycle exceeded the maximum expected time



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/plugins/plug05_response_time_checker.rb', line 4

def check
  result = Result.new(@testcase, @response)
  begin
    if not (@testcase.response_expectation['runtime'].nil? || @response.runtime.to_f <= @testcase.response_expectation['runtime'].to_f)
      result.succeeded = false
      result.error_message = " expected request->response runtime was #{@testcase.response_expectation['runtime']}, real runtime was #{@response.runtime}"
    end
   rescue Exception => e
     result.succeeded = false
     result.error_message = " unexpected error while parsing testcase/response. Check your testcase format!"
     result.error_message = "\n\nException occured: #{e}"
   end
  result
end