moto 0.0.22 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/moto +5 -5
- data/lib/app_generator.rb +8 -8
- data/lib/clients/base.rb +29 -23
- data/lib/clients/website.rb +8 -4
- data/lib/empty_listener.rb +16 -16
- data/lib/exceptions/moto.rb +6 -6
- data/lib/exceptions/test_forced_failure.rb +6 -6
- data/lib/exceptions/test_forced_passed.rb +6 -6
- data/lib/exceptions/test_skipped.rb +6 -6
- data/lib/forward_context_methods.rb +20 -20
- data/lib/initializer.rb +6 -6
- data/lib/listeners/base.rb +25 -25
- data/lib/listeners/console.rb +28 -28
- data/lib/listeners/console_dots.rb +62 -62
- data/lib/listeners/junit_xml.rb +36 -36
- data/lib/page.rb +27 -31
- data/lib/parser.rb +103 -103
- data/lib/result.rb +83 -83
- data/lib/runner_logging.rb +26 -26
- data/lib/test_logging.rb +48 -48
- data/lib/thread_context.rb +13 -6
- data/lib/version.rb +1 -1
- metadata +25 -25
data/lib/runner_logging.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
module Moto
|
2
|
-
module RunnerLogging
|
3
|
-
|
4
|
-
|
5
|
-
# TODO: merge it somehow with TestLogging. Parametrize logger object?
|
6
|
-
def self.included(cls)
|
7
|
-
def cls.method_added(name)
|
8
|
-
excluded_methods = Moto::EmptyListener.instance_methods(false)
|
9
|
-
excluded_methods << :new
|
10
|
-
excluded_methods << :initialize
|
11
|
-
# TODO: configure more excluded classes/methods
|
12
|
-
return if @added
|
13
|
-
@added = true # protect from recursion
|
14
|
-
original_method = "original_#{name}"
|
15
|
-
alias_method original_method, name
|
16
|
-
define_method(name) do |*args|
|
17
|
-
@context.runner.logger.debug("#{self.class.name}::#{__callee__} ENTER >>> #{args}") unless excluded_methods.include? name
|
18
|
-
result = send original_method, *args
|
19
|
-
@context.runner.logger.debug("#{self.class.name}::#{__callee__} LEAVE <<< #{result} ") unless excluded_methods.include? name
|
20
|
-
result
|
21
|
-
end
|
22
|
-
@added = false
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
1
|
+
module Moto
|
2
|
+
module RunnerLogging
|
3
|
+
|
4
|
+
|
5
|
+
# TODO: merge it somehow with TestLogging. Parametrize logger object?
|
6
|
+
def self.included(cls)
|
7
|
+
def cls.method_added(name)
|
8
|
+
excluded_methods = Moto::EmptyListener.instance_methods(false)
|
9
|
+
excluded_methods << :new
|
10
|
+
excluded_methods << :initialize
|
11
|
+
# TODO: configure more excluded classes/methods
|
12
|
+
return if @added
|
13
|
+
@added = true # protect from recursion
|
14
|
+
original_method = "original_#{name}"
|
15
|
+
alias_method original_method, name
|
16
|
+
define_method(name) do |*args|
|
17
|
+
@context.runner.logger.debug("#{self.class.name}::#{__callee__} ENTER >>> #{args}") unless excluded_methods.include? name
|
18
|
+
result = send original_method, *args
|
19
|
+
@context.runner.logger.debug("#{self.class.name}::#{__callee__} LEAVE <<< #{result} ") unless excluded_methods.include? name
|
20
|
+
result
|
21
|
+
end
|
22
|
+
@added = false
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
data/lib/test_logging.rb
CHANGED
@@ -1,49 +1,49 @@
|
|
1
|
-
module Moto
|
2
|
-
module TestLogging
|
3
|
-
|
4
|
-
@@ignore_logging = []
|
5
|
-
|
6
|
-
def self.included(cls)
|
7
|
-
|
8
|
-
def cls.ignore_logging(method)
|
9
|
-
full_name = "#{self.name}::#{method}"
|
10
|
-
@@ignore_logging << full_name
|
11
|
-
end
|
12
|
-
|
13
|
-
def cls.method_added(name)
|
14
|
-
|
15
|
-
Moto::EmptyListener.instance_methods(false).each do |m|
|
16
|
-
full_name = "#{self.name}::#{m}"
|
17
|
-
@@ignore_logging << full_name unless @@ignore_logging.include? full_name
|
18
|
-
end
|
19
|
-
@@ignore_logging << "#{self.name}::new"
|
20
|
-
@@ignore_logging << "#{self.name}::initialize"
|
21
|
-
|
22
|
-
return if @added
|
23
|
-
@added = true # protect from recursion
|
24
|
-
original_method = "original_#{name}"
|
25
|
-
alias_method original_method, name
|
26
|
-
define_method(name) do |*args|
|
27
|
-
full_name = "#{self.class.name}::#{__callee__}"
|
28
|
-
# TODO: use self.class.ancestors to figure out if ancestor::__callee__ is not in @@ignore_logging
|
29
|
-
skip_logging = @@ignore_logging.include? full_name
|
30
|
-
unless skip_logging
|
31
|
-
self.class.ancestors.each do |a|
|
32
|
-
ancestor_name = "#{a.name}::#{__callee__}"
|
33
|
-
if @@ignore_logging.include? ancestor_name
|
34
|
-
skip_logging = true
|
35
|
-
break
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
@context.current_test.logger.debug("ENTER >>> #{self.class.name}::#{__callee__}(#{args})") unless skip_logging
|
40
|
-
result = send original_method, *args
|
41
|
-
@context.current_test.logger.debug("LEAVE <<< #{self.class.name}::#{__callee__} => #{result} ") unless skip_logging
|
42
|
-
result
|
43
|
-
end
|
44
|
-
@added = false
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
1
|
+
module Moto
|
2
|
+
module TestLogging
|
3
|
+
|
4
|
+
@@ignore_logging = []
|
5
|
+
|
6
|
+
def self.included(cls)
|
7
|
+
|
8
|
+
def cls.ignore_logging(method)
|
9
|
+
full_name = "#{self.name}::#{method}"
|
10
|
+
@@ignore_logging << full_name
|
11
|
+
end
|
12
|
+
|
13
|
+
def cls.method_added(name)
|
14
|
+
|
15
|
+
Moto::EmptyListener.instance_methods(false).each do |m|
|
16
|
+
full_name = "#{self.name}::#{m}"
|
17
|
+
@@ignore_logging << full_name unless @@ignore_logging.include? full_name
|
18
|
+
end
|
19
|
+
@@ignore_logging << "#{self.name}::new"
|
20
|
+
@@ignore_logging << "#{self.name}::initialize"
|
21
|
+
|
22
|
+
return if @added
|
23
|
+
@added = true # protect from recursion
|
24
|
+
original_method = "original_#{name}"
|
25
|
+
alias_method original_method, name
|
26
|
+
define_method(name) do |*args|
|
27
|
+
full_name = "#{self.class.name}::#{__callee__}"
|
28
|
+
# TODO: use self.class.ancestors to figure out if ancestor::__callee__ is not in @@ignore_logging
|
29
|
+
skip_logging = @@ignore_logging.include? full_name
|
30
|
+
unless skip_logging
|
31
|
+
self.class.ancestors.each do |a|
|
32
|
+
ancestor_name = "#{a.name}::#{__callee__}"
|
33
|
+
if @@ignore_logging.include? ancestor_name
|
34
|
+
skip_logging = true
|
35
|
+
break
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
@context.current_test.logger.debug("ENTER >>> #{self.class.name}::#{__callee__}(#{args})") unless skip_logging
|
40
|
+
result = send original_method, *args
|
41
|
+
@context.current_test.logger.debug("LEAVE <<< #{self.class.name}::#{__callee__} => #{result} ") unless skip_logging
|
42
|
+
result
|
43
|
+
end
|
44
|
+
@added = false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
49
|
end
|
data/lib/thread_context.rb
CHANGED
@@ -76,15 +76,21 @@ module Moto
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def run
|
79
|
-
# remove log files from previous execution
|
80
|
-
Dir.glob("#{@test.dir}/*.log").each {|f| File.delete f }
|
79
|
+
# remove log/screenshot files from previous execution
|
80
|
+
Dir.glob("#{@test.dir}/*.{log,png}").each {|f| File.delete f }
|
81
81
|
max_attempts = @runner.my_config[:max_attempts] || 1
|
82
82
|
sleep_time = @runner.my_config[:sleep_before_attempt] || 0
|
83
83
|
@runner.environments.each do |env|
|
84
|
-
params_path = "#{@test.dir}/#{@test.filename}.yml"
|
85
84
|
params_all = [{}]
|
86
|
-
|
87
|
-
#
|
85
|
+
|
86
|
+
# YAML config files
|
87
|
+
#params_path = "#{@test.dir}/#{@test.filename}_params.yml"
|
88
|
+
#params_all = YAML.load(ERB.new(File.read(params_path)).result) if File.exists?(params_path)
|
89
|
+
|
90
|
+
# RB Config files
|
91
|
+
params_path = "#{@test.dir}/#{@test.filename}"
|
92
|
+
params_all = eval(File.read(params_path)) if File.exists?(params_path)
|
93
|
+
|
88
94
|
params_all.each_with_index do |params, params_index|
|
89
95
|
# Filtering out param sets that are specific to certain envs
|
90
96
|
unless params['__env'].nil?
|
@@ -110,6 +116,7 @@ module Moto
|
|
110
116
|
rescue Exception => e
|
111
117
|
@logger.error("#{e.class.name}: #{e.message}")
|
112
118
|
@logger.error(e.backtrace.join("\n"))
|
119
|
+
@clients.each_value { |c| c.handle_test_exception(@test, e) }
|
113
120
|
@runner.result.add_error(@test, e)
|
114
121
|
end
|
115
122
|
@test.after
|
@@ -120,7 +127,7 @@ module Moto
|
|
120
127
|
@logger.close
|
121
128
|
@runner.listeners[1..-1].each { |l| l.end_test(@test) }
|
122
129
|
break unless [Result::FAILURE, Result::ERROR].include? @test.result
|
123
|
-
sleep sleep_time
|
130
|
+
sleep sleep_time unless attempt.equal? max_attempts
|
124
131
|
end # RETRY
|
125
132
|
end
|
126
133
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartek Wilczek
|
@@ -10,62 +10,62 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-02-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3.2'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '3.2'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: nokogiri
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rest-client
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: sys-uname
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
description: This is a development version of a rails philosophy inspired framework
|
@@ -81,12 +81,24 @@ executables:
|
|
81
81
|
extensions: []
|
82
82
|
extra_rdoc_files: []
|
83
83
|
files:
|
84
|
+
- bin/moto
|
84
85
|
- lib/app_generator.rb
|
85
86
|
- lib/assert.rb
|
86
87
|
- lib/cli.rb
|
88
|
+
- lib/clients/base.rb
|
89
|
+
- lib/clients/website.rb
|
87
90
|
- lib/empty_listener.rb
|
91
|
+
- lib/exceptions/moto.rb
|
92
|
+
- lib/exceptions/test_forced_failure.rb
|
93
|
+
- lib/exceptions/test_forced_passed.rb
|
94
|
+
- lib/exceptions/test_skipped.rb
|
88
95
|
- lib/forward_context_methods.rb
|
89
96
|
- lib/initializer.rb
|
97
|
+
- lib/listeners/base.rb
|
98
|
+
- lib/listeners/console.rb
|
99
|
+
- lib/listeners/console_dots.rb
|
100
|
+
- lib/listeners/junit_xml.rb
|
101
|
+
- lib/listeners/webui.rb
|
90
102
|
- lib/page.rb
|
91
103
|
- lib/parser.rb
|
92
104
|
- lib/result.rb
|
@@ -98,18 +110,6 @@ files:
|
|
98
110
|
- lib/thread_context.rb
|
99
111
|
- lib/thread_pool.rb
|
100
112
|
- lib/version.rb
|
101
|
-
- lib/clients/base.rb
|
102
|
-
- lib/clients/website.rb
|
103
|
-
- lib/exceptions/moto.rb
|
104
|
-
- lib/exceptions/test_forced_failure.rb
|
105
|
-
- lib/exceptions/test_forced_passed.rb
|
106
|
-
- lib/exceptions/test_skipped.rb
|
107
|
-
- lib/listeners/base.rb
|
108
|
-
- lib/listeners/console.rb
|
109
|
-
- lib/listeners/console_dots.rb
|
110
|
-
- lib/listeners/junit_xml.rb
|
111
|
-
- lib/listeners/webui.rb
|
112
|
-
- bin/moto
|
113
113
|
homepage: https://github.com/bwilczek/moto
|
114
114
|
licenses:
|
115
115
|
- MIT
|
@@ -120,17 +120,17 @@ require_paths:
|
|
120
120
|
- lib
|
121
121
|
required_ruby_version: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
|
-
- - ~>
|
123
|
+
- - "~>"
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '2.0'
|
126
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- -
|
128
|
+
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.2.5
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: Moto - yet another web testing framework
|