moto 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19ae32e48ee7e8f28a830bd6ecfb283f85ab9937
|
4
|
+
data.tar.gz: 0b589d53644a0b9320764703babfe95f27361838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 722e6c766343c53cf0d5a83e50997866abab73ecb0f9cb28bc76a7e7223d03406b6979fa5ef2337623b128fc60c3566f7b5dc81a8a82ec161046a149eb78b363
|
7
|
+
data.tar.gz: 914aa51a2cf6945a500bde9dde1b1d3762a5dfc03fc0b3bc5f81855c48135320510af7b44fbfcd742f295f4dca4b0ffadb71cff59862d0b96dfc08b60ff46952
|
data/bin/moto
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require_relative '../lib/parser'
|
4
|
-
|
5
|
-
Moto::Parser.run ARGV
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/parser'
|
4
|
+
|
5
|
+
Moto::Parser.run ARGV
|
data/lib/app_generator.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
module Moto
|
2
|
-
class AppGenerator
|
3
|
-
|
4
|
-
def self.run(argv)
|
5
|
-
|
6
|
-
end
|
7
|
-
|
8
|
-
end
|
1
|
+
module Moto
|
2
|
+
class AppGenerator
|
3
|
+
|
4
|
+
def self.run(argv)
|
5
|
+
|
6
|
+
end
|
7
|
+
|
8
|
+
end
|
9
9
|
end
|
data/lib/clients/base.rb
CHANGED
@@ -1,23 +1,29 @@
|
|
1
|
-
module Moto
|
2
|
-
module Clients
|
3
|
-
|
4
|
-
class Base
|
5
|
-
include Moto::EmptyListener
|
6
|
-
include Moto::ForwardContextMethods
|
7
|
-
|
8
|
-
# include Moto::RunnerLogging
|
9
|
-
include Moto::TestLogging
|
10
|
-
|
11
|
-
attr_reader :context
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
1
|
+
module Moto
|
2
|
+
module Clients
|
3
|
+
|
4
|
+
class Base
|
5
|
+
include Moto::EmptyListener
|
6
|
+
include Moto::ForwardContextMethods
|
7
|
+
|
8
|
+
# include Moto::RunnerLogging
|
9
|
+
include Moto::TestLogging
|
10
|
+
|
11
|
+
attr_reader :context
|
12
|
+
|
13
|
+
ignore_logging(:handle_test_exception)
|
14
|
+
|
15
|
+
def initialize(context)
|
16
|
+
@context = context
|
17
|
+
end
|
18
|
+
|
19
|
+
def init
|
20
|
+
# abstract
|
21
|
+
end
|
22
|
+
|
23
|
+
def handle_test_exception(test, exception)
|
24
|
+
# abstract
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/clients/website.rb
CHANGED
@@ -19,21 +19,21 @@ module Moto
|
|
19
19
|
# TODO: make session driver configurable
|
20
20
|
context.runner.my_config[:capybara][:default_selector] &&
|
21
21
|
Capybara.default_selector = context.runner.my_config[:capybara][:default_selector]
|
22
|
-
|
22
|
+
Thread.current['capybara_session'] = Capybara::Session.new(context.runner.my_config[:capybara][:default_driver])
|
23
23
|
@pages = {}
|
24
24
|
end
|
25
25
|
|
26
26
|
def end_run
|
27
|
-
|
27
|
+
Thread.current['capybara_session'].driver.quit
|
28
28
|
end
|
29
29
|
|
30
30
|
def start_test(test)
|
31
31
|
# @context.current_test.logger.info("Hi mom, I'm opening some pages!")
|
32
|
-
|
32
|
+
Thread.current['capybara_session'].reset_session!
|
33
33
|
end
|
34
34
|
|
35
35
|
def end_test(test)
|
36
|
-
|
36
|
+
Thread.current['capybara_session'].reset_session!
|
37
37
|
end
|
38
38
|
|
39
39
|
def page(p)
|
@@ -66,6 +66,10 @@ module Moto
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
def handle_test_exception(test, exception)
|
70
|
+
Thread.current['capybara_session'].save_screenshot "#{test.dir}/#{test.filename}_#{Time.new.strftime('%Y%m%d_%H%M%S')}.png"
|
71
|
+
end
|
72
|
+
|
69
73
|
end
|
70
74
|
end
|
71
75
|
end
|
data/lib/empty_listener.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
module Moto
|
2
|
-
module EmptyListener
|
3
|
-
|
4
|
-
def start_run
|
5
|
-
end
|
6
|
-
|
7
|
-
def end_run
|
8
|
-
end
|
9
|
-
|
10
|
-
def start_test(test)
|
11
|
-
end
|
12
|
-
|
13
|
-
def end_test(test)
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
1
|
+
module Moto
|
2
|
+
module EmptyListener
|
3
|
+
|
4
|
+
def start_run
|
5
|
+
end
|
6
|
+
|
7
|
+
def end_run
|
8
|
+
end
|
9
|
+
|
10
|
+
def start_test(test)
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_test(test)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
17
|
end
|
data/lib/exceptions/moto.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
module Moto
|
2
|
-
module Exceptions
|
3
|
-
class MotoException < RuntimeError
|
4
|
-
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module Moto
|
2
|
+
module Exceptions
|
3
|
+
class MotoException < RuntimeError
|
4
|
+
|
5
|
+
end
|
6
|
+
end
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module Moto
|
2
|
-
module Exceptions
|
3
|
-
class TestForcedFailure < MotoException
|
4
|
-
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module Moto
|
2
|
+
module Exceptions
|
3
|
+
class TestForcedFailure < MotoException
|
4
|
+
|
5
|
+
end
|
6
|
+
end
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module Moto
|
2
|
-
module Exceptions
|
3
|
-
class TestForcedPassed < MotoException
|
4
|
-
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module Moto
|
2
|
+
module Exceptions
|
3
|
+
class TestForcedPassed < MotoException
|
4
|
+
|
5
|
+
end
|
6
|
+
end
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
module Moto
|
2
|
-
module Exceptions
|
3
|
-
class TestSkipped < MotoException
|
4
|
-
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module Moto
|
2
|
+
module Exceptions
|
3
|
+
class TestSkipped < MotoException
|
4
|
+
|
5
|
+
end
|
6
|
+
end
|
7
7
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
module Moto
|
2
|
-
module ForwardContextMethods
|
3
|
-
|
4
|
-
def client(name)
|
5
|
-
@context.client(name)
|
6
|
-
end
|
7
|
-
|
8
|
-
def logger
|
9
|
-
@context.logger
|
10
|
-
end
|
11
|
-
|
12
|
-
def const(key)
|
13
|
-
@context.const(key)
|
14
|
-
end
|
15
|
-
|
16
|
-
def current_test
|
17
|
-
@context.current_test
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
1
|
+
module Moto
|
2
|
+
module ForwardContextMethods
|
3
|
+
|
4
|
+
def client(name)
|
5
|
+
@context.client(name)
|
6
|
+
end
|
7
|
+
|
8
|
+
def logger
|
9
|
+
@context.logger
|
10
|
+
end
|
11
|
+
|
12
|
+
def const(key)
|
13
|
+
@context.const(key)
|
14
|
+
end
|
15
|
+
|
16
|
+
def current_test
|
17
|
+
@context.current_test
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
21
|
end
|
data/lib/initializer.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
module Moto
|
2
|
-
class Initializer
|
3
|
-
def initialize(runner)
|
4
|
-
@runner = runner
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module Moto
|
2
|
+
class Initializer
|
3
|
+
def initialize(runner)
|
4
|
+
@runner = runner
|
5
|
+
end
|
6
|
+
end
|
7
7
|
end
|
data/lib/listeners/base.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
module Moto
|
2
|
-
module Listeners
|
3
|
-
class Base
|
4
|
-
|
5
|
-
def initialize(runner)
|
6
|
-
@runner=runner
|
7
|
-
end
|
8
|
-
|
9
|
-
def start_run
|
10
|
-
# abstract
|
11
|
-
end
|
12
|
-
|
13
|
-
def end_run
|
14
|
-
# abstract
|
15
|
-
end
|
16
|
-
|
17
|
-
def start_test(test)
|
18
|
-
# abstract
|
19
|
-
end
|
20
|
-
|
21
|
-
def end_test(test)
|
22
|
-
# abstract
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
1
|
+
module Moto
|
2
|
+
module Listeners
|
3
|
+
class Base
|
4
|
+
|
5
|
+
def initialize(runner)
|
6
|
+
@runner=runner
|
7
|
+
end
|
8
|
+
|
9
|
+
def start_run
|
10
|
+
# abstract
|
11
|
+
end
|
12
|
+
|
13
|
+
def end_run
|
14
|
+
# abstract
|
15
|
+
end
|
16
|
+
|
17
|
+
def start_test(test)
|
18
|
+
# abstract
|
19
|
+
end
|
20
|
+
|
21
|
+
def end_test(test)
|
22
|
+
# abstract
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
26
|
end
|
data/lib/listeners/console.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
module Moto
|
2
|
-
module Listeners
|
3
|
-
class Console < Base
|
4
|
-
|
5
|
-
def start_run
|
6
|
-
puts "START"
|
7
|
-
end
|
8
|
-
|
9
|
-
def end_run
|
10
|
-
puts ""
|
11
|
-
puts "FINISHED: #{@runner.result.summary[:result]}, duration: #{Time.at(@runner.result.summary[:duration]).utc.strftime("%H:%M:%S")}"
|
12
|
-
puts "Tests executed: #{@runner.result.summary[:cnt_all]}"
|
13
|
-
puts " Passed: #{@runner.result.summary[:cnt_passed]}"
|
14
|
-
puts " Failure: #{@runner.result.summary[:cnt_failure]}"
|
15
|
-
puts " Error: #{@runner.result.summary[:cnt_error]}"
|
16
|
-
puts " Skipped: #{@runner.result.summary[:cnt_skipped]}"
|
17
|
-
end
|
18
|
-
|
19
|
-
def start_test(test)
|
20
|
-
print test.name
|
21
|
-
end
|
22
|
-
|
23
|
-
def end_test(test)
|
24
|
-
puts "\t#{@runner.result[test.name][:result]}"
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
1
|
+
module Moto
|
2
|
+
module Listeners
|
3
|
+
class Console < Base
|
4
|
+
|
5
|
+
def start_run
|
6
|
+
puts "START"
|
7
|
+
end
|
8
|
+
|
9
|
+
def end_run
|
10
|
+
puts ""
|
11
|
+
puts "FINISHED: #{@runner.result.summary[:result]}, duration: #{Time.at(@runner.result.summary[:duration]).utc.strftime("%H:%M:%S")}"
|
12
|
+
puts "Tests executed: #{@runner.result.summary[:cnt_all]}"
|
13
|
+
puts " Passed: #{@runner.result.summary[:cnt_passed]}"
|
14
|
+
puts " Failure: #{@runner.result.summary[:cnt_failure]}"
|
15
|
+
puts " Error: #{@runner.result.summary[:cnt_error]}"
|
16
|
+
puts " Skipped: #{@runner.result.summary[:cnt_skipped]}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def start_test(test)
|
20
|
+
print test.name
|
21
|
+
end
|
22
|
+
|
23
|
+
def end_test(test)
|
24
|
+
puts "\t#{@runner.result[test.name][:result]}"
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
29
|
end
|
@@ -1,63 +1,63 @@
|
|
1
|
-
module Moto
|
2
|
-
module Listeners
|
3
|
-
class ConsoleDots < Base
|
4
|
-
|
5
|
-
def start_run
|
6
|
-
end
|
7
|
-
|
8
|
-
def end_run
|
9
|
-
puts ""
|
10
|
-
puts ""
|
11
|
-
puts "FINISHED: #{@runner.result.summary[:result]}, duration: #{Time.at(@runner.result.summary[:duration]).utc.strftime("%H:%M:%S")}"
|
12
|
-
puts "Tests executed: #{@runner.result.summary[:cnt_all]}"
|
13
|
-
puts " Passed: #{@runner.result.summary[:cnt_passed]}"
|
14
|
-
puts " Failure: #{@runner.result.summary[:cnt_failure]}"
|
15
|
-
puts " Error: #{@runner.result.summary[:cnt_error]}"
|
16
|
-
puts " Skipped: #{@runner.result.summary[:cnt_skipped]}"
|
17
|
-
|
18
|
-
if @runner.result.summary[:cnt_failure] > 0
|
19
|
-
puts ""
|
20
|
-
puts "FAILURES: "
|
21
|
-
@runner.result.summary[:tests_failure].each do |test_name, data|
|
22
|
-
puts test_name
|
23
|
-
puts "\t#{data[:failures].join("\n\t")}"
|
24
|
-
puts ""
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
if @runner.result.summary[:cnt_error] > 0
|
29
|
-
puts ""
|
30
|
-
puts "ERRORS: "
|
31
|
-
@runner.result.summary[:tests_error].each do |test_name, data|
|
32
|
-
puts test_name
|
33
|
-
puts "\t#{data[:error]}"
|
34
|
-
puts ""
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
if @runner.result.summary[:cnt_skipped] > 0
|
39
|
-
puts ""
|
40
|
-
puts "SKIPPED: "
|
41
|
-
@runner.result.summary[:tests_skipped].each do |test_name, data|
|
42
|
-
puts test_name
|
43
|
-
puts "\t#{data[:error]}"
|
44
|
-
puts ""
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def start_test(test)
|
50
|
-
end
|
51
|
-
|
52
|
-
def end_test(test)
|
53
|
-
print case @runner.result[test.name][:result]
|
54
|
-
when :passed then "."
|
55
|
-
when :failure then "F"
|
56
|
-
when :error then "E"
|
57
|
-
when :skipped then "S"
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
1
|
+
module Moto
|
2
|
+
module Listeners
|
3
|
+
class ConsoleDots < Base
|
4
|
+
|
5
|
+
def start_run
|
6
|
+
end
|
7
|
+
|
8
|
+
def end_run
|
9
|
+
puts ""
|
10
|
+
puts ""
|
11
|
+
puts "FINISHED: #{@runner.result.summary[:result]}, duration: #{Time.at(@runner.result.summary[:duration]).utc.strftime("%H:%M:%S")}"
|
12
|
+
puts "Tests executed: #{@runner.result.summary[:cnt_all]}"
|
13
|
+
puts " Passed: #{@runner.result.summary[:cnt_passed]}"
|
14
|
+
puts " Failure: #{@runner.result.summary[:cnt_failure]}"
|
15
|
+
puts " Error: #{@runner.result.summary[:cnt_error]}"
|
16
|
+
puts " Skipped: #{@runner.result.summary[:cnt_skipped]}"
|
17
|
+
|
18
|
+
if @runner.result.summary[:cnt_failure] > 0
|
19
|
+
puts ""
|
20
|
+
puts "FAILURES: "
|
21
|
+
@runner.result.summary[:tests_failure].each do |test_name, data|
|
22
|
+
puts test_name
|
23
|
+
puts "\t#{data[:failures].join("\n\t")}"
|
24
|
+
puts ""
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if @runner.result.summary[:cnt_error] > 0
|
29
|
+
puts ""
|
30
|
+
puts "ERRORS: "
|
31
|
+
@runner.result.summary[:tests_error].each do |test_name, data|
|
32
|
+
puts test_name
|
33
|
+
puts "\t#{data[:error]}"
|
34
|
+
puts ""
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
if @runner.result.summary[:cnt_skipped] > 0
|
39
|
+
puts ""
|
40
|
+
puts "SKIPPED: "
|
41
|
+
@runner.result.summary[:tests_skipped].each do |test_name, data|
|
42
|
+
puts test_name
|
43
|
+
puts "\t#{data[:error]}"
|
44
|
+
puts ""
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def start_test(test)
|
50
|
+
end
|
51
|
+
|
52
|
+
def end_test(test)
|
53
|
+
print case @runner.result[test.name][:result]
|
54
|
+
when :passed then "."
|
55
|
+
when :failure then "F"
|
56
|
+
when :error then "E"
|
57
|
+
when :skipped then "S"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
63
|
end
|