mini_autobot 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mini_autobot/test_case.rb +35 -9
- data/lib/mini_autobot/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd9007c1c01a6cdd18d0ef7c29b0c146d2154ff4
|
4
|
+
data.tar.gz: 9bcc8158c3ffca7d0f808bb06900aa6068cf7e11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 206b9e98825f2df89f2546e9d67eb2c5e6fad2dfaf34f8b7678d8c912be820e6fee8875b0c08934fcaea9f47aa43e88a91694f964e57a9c492cd3dcf3e077e91
|
7
|
+
data.tar.gz: 910b3d02d88b7d2b8f25983d47205e501b58b86336d649473de5e634031020505291992289d728aa3591672686180a9a88ad2e6bfc8d534b34ae1d2010ca2d5f
|
@@ -3,8 +3,9 @@ module MiniAutobot
|
|
3
3
|
# An MiniAutobot-specific test case container, which extends the default ones,
|
4
4
|
# adds convenience helper methods, and manages page objects automatically.
|
5
5
|
class TestCase < Minitest::Test
|
6
|
+
@@selected_methods = []
|
7
|
+
@@runnables_count = 0
|
6
8
|
@@regression_suite = Array.new
|
7
|
-
@@already_executed = false
|
8
9
|
@@serials = Array.new
|
9
10
|
@@test_suite_data = if File.exist?(MiniAutobot.root.join("config/mini_autobot/test_suite.yml"))
|
10
11
|
YAML.load_file(MiniAutobot.root.join("config/mini_autobot/test_suite.yml"))
|
@@ -73,27 +74,50 @@ module MiniAutobot
|
|
73
74
|
|
74
75
|
# Filter out anything not matching our tag selection, if any.
|
75
76
|
#
|
77
|
+
# If it's parallel run,
|
78
|
+
# only add filtered methods from each runnable to a list of to run methods,
|
79
|
+
# instead of running them one by one right away,
|
80
|
+
# and finally when all runnable methods are traversed, call parallel to run that list of methods.
|
81
|
+
#
|
76
82
|
# @return [Enumerable<Symbol>] the methods marked runnable
|
77
83
|
def runnable_methods
|
78
84
|
methods = super
|
79
85
|
selected = MiniAutobot.settings.tags
|
80
86
|
|
87
|
+
filtered_methods = filter_methods(methods, selected)
|
88
|
+
|
81
89
|
if MiniAutobot.settings.parallel
|
82
|
-
|
83
|
-
|
84
|
-
|
90
|
+
unless filtered_methods.empty?
|
91
|
+
if selected.nil? || selected.empty?
|
92
|
+
@@selected_methods = @@regression_suite
|
93
|
+
else
|
94
|
+
methods_to_add = filtered_methods.map { |method| method.to_sym if @@regression_suite.include?(method.to_sym) }
|
95
|
+
@@selected_methods += methods_to_add
|
96
|
+
end
|
85
97
|
end
|
86
98
|
|
87
|
-
|
88
|
-
|
99
|
+
@@runnables_count += 1
|
100
|
+
mini_autobot_runnables = Minitest::Runnable.runnables - [Minitest::Test, Minitest::Unit::TestCase]
|
101
|
+
|
102
|
+
if @@runnables_count == mini_autobot_runnables.size
|
103
|
+
parallel = Parallel.new(MiniAutobot.settings.parallel, @@selected_methods)
|
104
|
+
parallel.run_in_parallel!
|
105
|
+
end
|
89
106
|
|
90
|
-
|
107
|
+
return [] # no test will run
|
108
|
+
else
|
109
|
+
filtered_methods
|
91
110
|
end
|
111
|
+
end
|
92
112
|
|
113
|
+
# Filter methods in a runnable based on our tag selection
|
114
|
+
def filter_methods(methods, selected)
|
93
115
|
# If no tags are selected, run all tests
|
94
|
-
|
116
|
+
if selected.nil? || selected.empty?
|
117
|
+
return methods
|
118
|
+
end
|
95
119
|
|
96
|
-
|
120
|
+
selected_methods = methods.select do |method|
|
97
121
|
# If the method's tags match any of the tag sets, allow it to run
|
98
122
|
selected.any? do |tag_set|
|
99
123
|
# Retrieve the tags for that method
|
@@ -111,6 +135,8 @@ module MiniAutobot
|
|
111
135
|
end
|
112
136
|
end
|
113
137
|
end
|
138
|
+
|
139
|
+
selected_methods
|
114
140
|
end
|
115
141
|
|
116
142
|
# Install a setup method that runs before every test.
|
data/lib/mini_autobot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_autobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ripta Pasay
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-09-
|
13
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
291
|
version: '0'
|
292
292
|
requirements: []
|
293
293
|
rubyforge_project:
|
294
|
-
rubygems_version: 2.
|
294
|
+
rubygems_version: 2.2.2
|
295
295
|
signing_key:
|
296
296
|
specification_version: 4
|
297
297
|
summary: Web automation framework on minitest, selenium webdriver, and page objects.
|