Class: Webspicy::Tester
- Inherits:
-
Object
- Object
- Webspicy::Tester
- Extended by:
- Forwardable
- Defined in:
- lib/webspicy/tester.rb,
lib/webspicy/tester/client.rb,
lib/webspicy/tester/result.rb,
lib/webspicy/tester/failure.rb,
lib/webspicy/tester/fakeses.rb,
lib/webspicy/tester/asserter.rb,
lib/webspicy/tester/fakesmtp.rb,
lib/webspicy/tester/reporter.rb,
lib/webspicy/tester/assertions.rb,
lib/webspicy/tester/invocation.rb,
lib/webspicy/tester/fakesendgrid.rb,
lib/webspicy/tester/file_checker.rb,
lib/webspicy/tester/result/check.rb,
lib/webspicy/tester/fakeses/email.rb,
lib/webspicy/tester/fakesmtp/email.rb,
lib/webspicy/tester/reporter/summary.rb,
lib/webspicy/tester/reporter/progress.rb,
lib/webspicy/tester/result/assert_met.rb,
lib/webspicy/tester/fakesendgrid/email.rb,
lib/webspicy/tester/reporter/composite.rb,
lib/webspicy/tester/reporter/exceptions.rb,
lib/webspicy/tester/reporter/file_summary.rb,
lib/webspicy/tester/reporter/documentation.rb,
lib/webspicy/tester/reporter/file_progress.rb,
lib/webspicy/tester/reporter/junit_xml_file.rb,
lib/webspicy/tester/reporter/success_or_not.rb,
lib/webspicy/tester/result/errcondition_met.rb,
lib/webspicy/tester/result/error_schema_met.rb,
lib/webspicy/tester/result/output_schema_met.rb,
lib/webspicy/tester/result/postcondition_met.rb,
lib/webspicy/tester/result/response_header_met.rb,
lib/webspicy/tester/result/response_status_met.rb,
lib/webspicy/tester/result/invocation_succeeded.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Assertions Classes: Asserter, Client, FailFast, Failure, Fakesendgrid, Fakeses, Fakesmtp, FileChecker, Invocation, Reporter, Result
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#hooks ⇒ Object
readonly
Returns the value of attribute hooks.
-
#invocation ⇒ Object
readonly
Returns the value of attribute invocation.
-
#invocation_error ⇒ Object
readonly
Returns the value of attribute invocation_error.
-
#reporter ⇒ Object
readonly
Returns the value of attribute reporter.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#spec_file ⇒ Object
readonly
Returns the value of attribute spec_file.
-
#specification ⇒ Object
readonly
Returns the value of attribute specification.
-
#test_case ⇒ Object
readonly
Returns the value of attribute test_case.
Instance Method Summary collapse
- #bind_condition(c) ⇒ Object
- #call ⇒ Object
- #call! ⇒ Object
- #call_once(all = true) ⇒ Object
- #failfast? ⇒ Boolean
- #find_and_call(method, url, mutation, config = self.config) ⇒ Object
-
#initialize(config) ⇒ Tester
constructor
A new instance of Tester.
Constructor Details
#initialize(config) ⇒ Tester
Returns a new instance of Tester.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/webspicy/tester.rb', line 7 def initialize(config) @config = Configuration.dress(config) @scope = nil @hooks = nil @client = nil @spec_file = nil @specification = nil @service = nil @test_case = nil @invocation = nil @invocation_error = nil @reporter = @config.reporter end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
20 21 22 |
# File 'lib/webspicy/tester.rb', line 20 def client @client end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
20 21 22 |
# File 'lib/webspicy/tester.rb', line 20 def config @config end |
#hooks ⇒ Object (readonly)
Returns the value of attribute hooks.
20 21 22 |
# File 'lib/webspicy/tester.rb', line 20 def hooks @hooks end |
#invocation ⇒ Object (readonly)
Returns the value of attribute invocation.
23 24 25 |
# File 'lib/webspicy/tester.rb', line 23 def invocation @invocation end |
#invocation_error ⇒ Object (readonly)
Returns the value of attribute invocation_error.
23 24 25 |
# File 'lib/webspicy/tester.rb', line 23 def invocation_error @invocation_error end |
#reporter ⇒ Object (readonly)
Returns the value of attribute reporter.
24 25 26 |
# File 'lib/webspicy/tester.rb', line 24 def reporter @reporter end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
23 24 25 |
# File 'lib/webspicy/tester.rb', line 23 def result @result end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
20 21 22 |
# File 'lib/webspicy/tester.rb', line 20 def scope @scope end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
22 23 24 |
# File 'lib/webspicy/tester.rb', line 22 def service @service end |
#spec_file ⇒ Object (readonly)
Returns the value of attribute spec_file.
21 22 23 |
# File 'lib/webspicy/tester.rb', line 21 def spec_file @spec_file end |
#specification ⇒ Object (readonly)
Returns the value of attribute specification.
21 22 23 |
# File 'lib/webspicy/tester.rb', line 21 def specification @specification end |
#test_case ⇒ Object
Returns the value of attribute test_case.
22 23 24 |
# File 'lib/webspicy/tester.rb', line 22 def test_case @test_case end |
Instance Method Details
#bind_condition(c) ⇒ Object
74 75 76 77 |
# File 'lib/webspicy/tester.rb', line 74 def bind_condition(c) c = Specification::Oldies::Bridge.new(c) unless c.respond_to?(:bind) c.bind(self) end |
#call ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/webspicy/tester.rb', line 34 def call res = call_once(true) if folders = config.watch_list require 'listen' listener = Listen.to(*folders) do reporter.clear res = call_once(false) end listener.start sleep end res end |
#call! ⇒ Object
58 59 60 61 |
# File 'lib/webspicy/tester.rb', line 58 def call! res = call abort("KO") unless reporter.find(Reporter::SuccessOrNot).success? end |
#call_once(all = true) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/webspicy/tester.rb', line 48 def call_once(all = true) reporter.init(self) begin run_config(all) rescue FailFast end reporter.report reporter.find(Reporter::SuccessOrNot).report end |
#failfast? ⇒ Boolean
30 31 32 |
# File 'lib/webspicy/tester.rb', line 30 def failfast? config.failfast end |
#find_and_call(method, url, mutation, config = self.config) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/webspicy/tester.rb', line 63 def find_and_call(method, url, mutation, config = self.config) unless tc = scope.find_test_case(method, url) raise Error, "No such service `#{method} #{url}`" end mutated = tc.mutate(mutation) fork_tester(test_case: mutated) do |t| instrumented = t.instrument_test_case t.client.call(instrumented) end end |