moto 0.8.6 → 0.8.7
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/lib/cli.rb +1 -1
- data/lib/parser.rb +7 -0
- data/lib/reporting/run_status.rb +25 -0
- data/lib/reporting/test_reporter.rb +3 -4
- data/lib/runner/test_runner.rb +17 -6
- data/lib/version.rb +1 -1
- metadata +2 -3
- data/lib/reporting/listeners/kernel_code.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27cd6f4b74db2d52a13daae5accff2c8ced922c8
|
4
|
+
data.tar.gz: 7663285aa8ed492aca2f6b68d84945ba99f08c97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a3b7fc313e549842ed32512f3561ca1139c46afa354f114347ba898331fabd97bdaf73547b373eb23ffcc51d14fa8b8a406cf8f45cc351cb55a0e7a13502e68
|
7
|
+
data.tar.gz: 8aa3f30d4153fddd5cf10beb930d385607fba3b27167afe502620f8981743c4bee7db2acdec48899e125dbaaccedd630273b9d29edda4791cbd81f9206543b60
|
data/lib/cli.rb
CHANGED
@@ -109,7 +109,7 @@ module Moto
|
|
109
109
|
|
110
110
|
test_reporter = Moto::Reporting::TestReporter.new(argv[:listeners], argv[:name])
|
111
111
|
|
112
|
-
runner = Moto::Runner::TestRunner.new(test_paths_absolute, test_reporter)
|
112
|
+
runner = Moto::Runner::TestRunner.new(test_paths_absolute, test_reporter, argv[:stop_on])
|
113
113
|
runner.run
|
114
114
|
end
|
115
115
|
|
data/lib/parser.rb
CHANGED
@@ -36,6 +36,7 @@ module Moto
|
|
36
36
|
options = {}
|
37
37
|
options[:listeners] = []
|
38
38
|
options[:name] = ''
|
39
|
+
options[:stop_on] = {error: false, fail: false, skip: false}
|
39
40
|
|
40
41
|
# Parse arguments
|
41
42
|
OptionParser.new do |opts|
|
@@ -46,6 +47,9 @@ module Moto
|
|
46
47
|
opts.on('-e', '--environment Environment') { |v| options[:environment] = v }
|
47
48
|
opts.on('-n', '--name Name') { |v| options[:name] = v }
|
48
49
|
opts.on('-c', '--config Config') { |v| options[:config_name] = v }
|
50
|
+
opts.on('--stop-on-error') { options[:stop_on][:error] = true }
|
51
|
+
opts.on('--stop-on-fail') { options[:stop_on][:fail] = true }
|
52
|
+
opts.on('--stop-on-skip') { options[:stop_on][:skip] = true }
|
49
53
|
end.parse!
|
50
54
|
|
51
55
|
if options[:name].empty?
|
@@ -120,6 +124,9 @@ module Moto
|
|
120
124
|
-e, --environment Mandatory environment. Environment constants and tests parametrized in certain way depend on this.
|
121
125
|
-c, --config Name of the config, without extension, to be loaded from MotoApp/config/CONFIG_NAME.rb
|
122
126
|
Default: moto (which loads: MotoApp/config/moto.rb)
|
127
|
+
--stop-on-error Moto will stop test execution when an error is encountered in test results
|
128
|
+
--stop-on-fail Moto will stop test execution when a failure is encountered in test results
|
129
|
+
--stop-on-skip Moto will stop test execution when a skip is encountered in test results
|
123
130
|
|
124
131
|
|
125
132
|
moto generate:
|
data/lib/reporting/run_status.rb
CHANGED
@@ -93,6 +93,31 @@ module Moto
|
|
93
93
|
when Moto::Test::Result::SKIPPED then return 'SKIPPED'
|
94
94
|
end
|
95
95
|
end
|
96
|
+
|
97
|
+
|
98
|
+
# Inform about presence o errors/failures/skipped tests in current test run as a bitmap
|
99
|
+
# errors present: 0b100 & status_as_bitmap
|
100
|
+
# fails present: 0b010 & status_as_bitmap
|
101
|
+
# skips present: 0b001 & status_as_bitmap
|
102
|
+
# all passed: status_as_bitmap == 0
|
103
|
+
def bitmap
|
104
|
+
status = 0
|
105
|
+
|
106
|
+
if tests_error.length > 0
|
107
|
+
status += 0b100
|
108
|
+
end
|
109
|
+
|
110
|
+
if tests_failed.length > 0
|
111
|
+
status += 0b010
|
112
|
+
end
|
113
|
+
|
114
|
+
if tests_skipped.length > 0
|
115
|
+
status += 0b001
|
116
|
+
end
|
117
|
+
|
118
|
+
status
|
119
|
+
end
|
120
|
+
|
96
121
|
end
|
97
122
|
end
|
98
123
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
require_relative 'run_status'
|
2
2
|
require_relative 'listeners/base'
|
3
|
-
require_relative 'listeners/kernel_code'
|
4
3
|
|
5
4
|
module Moto
|
6
5
|
module Reporting
|
7
6
|
|
8
7
|
# Manages reporting test and run status' to attached listeners
|
9
8
|
class TestReporter
|
9
|
+
|
10
|
+
attr_reader :run_status
|
11
|
+
|
10
12
|
# @param [Array] listeners An array of strings, which represent qualified names of classes (listeners) that will be instantiated.
|
11
13
|
# empty array is passed then :default_listeners will be taken from config
|
12
14
|
# @param [String] custom_run_name Optional, to be passed to listeners during creation
|
@@ -25,9 +27,6 @@ module Moto
|
|
25
27
|
@listeners = []
|
26
28
|
@custom_run_name = custom_run_name
|
27
29
|
listeners.each { |l| add_listener(l) }
|
28
|
-
|
29
|
-
# Special listener used to generate code for Kernel.exit(code)
|
30
|
-
add_listener(Moto::Reporting::Listeners::KernelCode)
|
31
30
|
end
|
32
31
|
|
33
32
|
# Adds a listener to the list.
|
data/lib/runner/test_runner.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative '../reporting/test_reporter'
|
2
|
-
require_relative '../reporting/listeners/kernel_code'
|
3
2
|
require_relative './test_provider'
|
4
3
|
|
5
4
|
module Moto
|
@@ -8,9 +7,16 @@ module Moto
|
|
8
7
|
|
9
8
|
attr_reader :test_reporter
|
10
9
|
|
11
|
-
|
10
|
+
# @param [Array] test_paths_absolute Absolute paths to files with tests
|
11
|
+
# @param [Moto::Reporting::TestReporter] test_reporter Reporter of test/run statuses that communicates with external status listeners
|
12
|
+
# @param [Hash] stop_conditions Describe when TestRunner should abnormally stop its execution
|
13
|
+
# :error [Boolean]
|
14
|
+
# :fail [Boolean]
|
15
|
+
# :skip [Boolean]
|
16
|
+
def initialize(test_paths_absolute, test_reporter, stop_conditions)
|
12
17
|
@test_paths_absolute = test_paths_absolute
|
13
18
|
@test_reporter = test_reporter
|
19
|
+
@stop_conditions = stop_conditions
|
14
20
|
end
|
15
21
|
|
16
22
|
def run
|
@@ -41,18 +47,23 @@ module Moto
|
|
41
47
|
end
|
42
48
|
|
43
49
|
# Waiting for all threads to run out of work so we can end the application
|
50
|
+
# or abonormal termination to be triggered based on options provided by the user
|
44
51
|
loop do
|
45
|
-
|
52
|
+
run_status = @test_reporter.run_status
|
53
|
+
if (test_provider.num_waiting == threads_max) ||
|
54
|
+
(@stop_conditions[:error] && run_status.tests_error.length > 0) ||
|
55
|
+
(@stop_conditions[:fail] && run_status.tests_failed.length > 0) ||
|
56
|
+
(@stop_conditions[:skip] && run_status.tests_skipped.length > 0)
|
46
57
|
break
|
47
58
|
end
|
48
59
|
|
49
|
-
sleep
|
60
|
+
sleep 2
|
50
61
|
end
|
51
62
|
|
52
63
|
@test_reporter.report_end_run
|
53
64
|
|
54
|
-
# Exit application with
|
55
|
-
Kernel.exit(
|
65
|
+
# Exit application with code that represents status of test run
|
66
|
+
Kernel.exit(@test_reporter.run_status.bitmap)
|
56
67
|
end
|
57
68
|
|
58
69
|
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.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartek Wilczek
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-09-
|
14
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -98,7 +98,6 @@ files:
|
|
98
98
|
- lib/reporting/listeners/console.rb
|
99
99
|
- lib/reporting/listeners/console_dots.rb
|
100
100
|
- lib/reporting/listeners/junit_xml.rb
|
101
|
-
- lib/reporting/listeners/kernel_code.rb
|
102
101
|
- lib/reporting/listeners/webui.rb
|
103
102
|
- lib/reporting/run_status.rb
|
104
103
|
- lib/reporting/test_reporter.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Moto
|
2
|
-
module Reporting
|
3
|
-
module Listeners
|
4
|
-
class KernelCode < Base
|
5
|
-
|
6
|
-
def self.code
|
7
|
-
@@code
|
8
|
-
end
|
9
|
-
|
10
|
-
# Invoked when whole batch of tests ends
|
11
|
-
def end_run(run_status)
|
12
|
-
|
13
|
-
code = 0
|
14
|
-
|
15
|
-
if run_status.tests_error.length > 0
|
16
|
-
code += 0b100
|
17
|
-
end
|
18
|
-
|
19
|
-
if run_status.tests_failed.length > 0
|
20
|
-
code += 0b010
|
21
|
-
end
|
22
|
-
|
23
|
-
if run_status.tests_skipped.length > 0
|
24
|
-
code += 0b001
|
25
|
-
end
|
26
|
-
|
27
|
-
@@code = code
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|