cornucopia 0.1.31 → 0.1.32
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/cornucopia.rb +23 -18
- data/lib/cornucopia/capybara/finder_diagnostics.rb +15 -9
- data/lib/cornucopia/cucumber_hooks.rb +104 -60
- data/lib/cornucopia/rspec_hooks.rb +70 -32
- data/lib/cornucopia/util/configuration.rb +12 -0
- data/lib/cornucopia/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dfa697ff48ae29d85dadb77b09d926b3b8bd7b2
|
4
|
+
data.tar.gz: 21b9f88763181be28d03e0fd9b6daac334db38b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e37919d0d394dde8f425f52d2c70e01623a6042128c6072043e220eff15378447b2e24a573c01207497f4fc8bc91eb965c4f0fe88f68030d73311b932f2cb584
|
7
|
+
data.tar.gz: 8a44a5e79cada6118e0789bcd4a6d1643078dc5518977fc794d22fbb7b8f4e61bfbbc7174f55ac8a4fc16925db3a18377eebf1132640a90be891e7de7b56def5
|
data/lib/cornucopia.rb
CHANGED
@@ -1,23 +1,28 @@
|
|
1
|
-
require "
|
1
|
+
require "benchmark"
|
2
2
|
|
3
|
-
|
4
|
-
require "
|
3
|
+
time = Benchmark.measure do
|
4
|
+
require "cornucopia/version"
|
5
5
|
|
6
|
-
require "
|
7
|
-
require "
|
8
|
-
|
9
|
-
require "cornucopia/util/
|
10
|
-
require "cornucopia/util/
|
11
|
-
require "cornucopia/util/
|
12
|
-
require "cornucopia/util/
|
13
|
-
require "cornucopia/util/
|
14
|
-
require "cornucopia/util/
|
15
|
-
require "cornucopia/
|
16
|
-
require "cornucopia/
|
17
|
-
require "cornucopia/
|
18
|
-
require "cornucopia/capybara/
|
19
|
-
require "cornucopia/
|
20
|
-
require "cornucopia/
|
6
|
+
require "active_support"
|
7
|
+
require "active_support/core_ext"
|
8
|
+
|
9
|
+
require "cornucopia/util/configuration"
|
10
|
+
require "cornucopia/util/configured_report"
|
11
|
+
require "cornucopia/util/generic_settings"
|
12
|
+
require "cornucopia/util/file_asset"
|
13
|
+
require "cornucopia/util/log_capture"
|
14
|
+
require "cornucopia/util/pretty_formatter"
|
15
|
+
require "cornucopia/util/report_builder"
|
16
|
+
require "cornucopia/util/report_table"
|
17
|
+
require "cornucopia/util/test_helper"
|
18
|
+
require "cornucopia/capybara/finder_diagnostics"
|
19
|
+
require "cornucopia/capybara/page_diagnostics"
|
20
|
+
require "cornucopia/capybara/finder_extensions"
|
21
|
+
require "cornucopia/capybara/matcher_extensions"
|
22
|
+
require "cornucopia/site_prism/element_extensions"
|
23
|
+
require "cornucopia/site_prism/page_application"
|
24
|
+
end
|
25
|
+
puts "Cornucopia load time: #{time}"
|
21
26
|
|
22
27
|
module Cornucopia
|
23
28
|
end
|
@@ -173,18 +173,24 @@ module Cornucopia
|
|
173
173
|
def perform_analysis(attempt_retry)
|
174
174
|
retry_successful = false
|
175
175
|
|
176
|
-
|
177
|
-
|
178
|
-
$! do |report, report_table|
|
179
|
-
retry_successful = perform_retry(attempt_retry, report, report_table)
|
180
|
-
end
|
176
|
+
time = Benchmark.measure do
|
177
|
+
puts " Cornucopia::FinderDiagnostics::perform_analysis" if Cornucopia::Util::Configuration.benchmark
|
181
178
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
179
|
+
if can_dump_details?(attempt_retry)
|
180
|
+
generate_report "An error occurred while processing \"#{@function_name.to_s}\":",
|
181
|
+
$! do |report, report_table|
|
182
|
+
retry_successful = perform_retry(attempt_retry, report, report_table)
|
183
|
+
end
|
184
|
+
|
185
|
+
dump_args = dump_detail_args(attempt_retry)
|
186
|
+
@@diagnosed_finders[dump_args] = { tried: true }
|
187
|
+
else
|
188
|
+
retry_successful = perform_retry(attempt_retry, nil, nil)
|
189
|
+
end
|
186
190
|
end
|
187
191
|
|
192
|
+
puts " Cornucopia::FinderDiagnostics::perform_analysis time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
193
|
+
|
188
194
|
retry_successful
|
189
195
|
end
|
190
196
|
|
@@ -4,102 +4,146 @@ load ::File.expand_path("site_prism/install_element_extensions.rb", File.dirname
|
|
4
4
|
|
5
5
|
if Cucumber::VERSION.split[0].to_i >= 2
|
6
6
|
After do |scenario, block|
|
7
|
-
|
8
|
-
|
7
|
+
time = Benchmark.measure do
|
8
|
+
puts "Cornucopia::Hook::page dump" if Cornucopia::Util::Configuration.benchmark
|
9
9
|
|
10
|
-
|
10
|
+
if scenario.failed?
|
11
|
+
report_name = "Page Dump for: #{Cornucopia::Util::TestHelper.instance.cucumber_name(scenario)}"
|
12
|
+
|
13
|
+
Cornucopia::Capybara::PageDiagnostics.dump_details(section_label: report_name)
|
14
|
+
end
|
11
15
|
end
|
16
|
+
|
17
|
+
puts "Cornucopia::Hook::page dump time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
12
18
|
end
|
13
19
|
|
14
20
|
Around do |scenario, block|
|
15
|
-
test_name =
|
16
|
-
|
21
|
+
test_name = nil
|
22
|
+
|
23
|
+
time = Benchmark.measure do
|
24
|
+
puts "Cornucopia::Hook::before test" if Cornucopia::Util::Configuration.benchmark
|
17
25
|
|
18
|
-
|
19
|
-
|
26
|
+
test_name = Cornucopia::Util::TestHelper.instance.cucumber_name(scenario)
|
27
|
+
Cornucopia::Util::TestHelper.instance.record_test_start(test_name)
|
20
28
|
|
21
|
-
|
29
|
+
seed_value = Cornucopia::Util::Configuration.seed ||
|
30
|
+
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
22
31
|
|
23
|
-
|
24
|
-
|
32
|
+
scenario.instance_variable_set :@seed_value, seed_value
|
33
|
+
|
34
|
+
Cornucopia::Capybara::FinderDiagnostics::FindAction.clear_diagnosed_finders
|
35
|
+
Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
|
36
|
+
end
|
37
|
+
|
38
|
+
puts "Cornucopia::Hook::before test time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
25
39
|
|
26
40
|
Cornucopia::Util::ReportBuilder.current_report.within_test("Scenario - #{test_name}") do
|
27
41
|
block.call
|
28
42
|
end
|
29
43
|
|
30
|
-
|
31
|
-
|
32
|
-
puts ("random seed for testing was: #{seed_value}")
|
44
|
+
time = Benchmark.measure do
|
45
|
+
puts "Cornucopia::Hook::after test" if Cornucopia::Util::Configuration.benchmark
|
33
46
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
configured_report = Cornucopia::Util::Configuration.report_configuration :cucumber
|
38
|
-
else
|
39
|
-
configured_report = Cornucopia::Util::Configuration.report_configuration :cucumber_outline
|
40
|
-
end
|
47
|
+
if scenario.failed?
|
48
|
+
seed_value = scenario.instance_variable_get(:@seed_value)
|
49
|
+
puts ("random seed for testing was: #{seed_value}")
|
41
50
|
|
42
|
-
|
43
|
-
|
51
|
+
Cornucopia::Util::ReportBuilder.current_report.within_section("Test Error: #{test_name}") do |report|
|
52
|
+
configured_report = nil
|
53
|
+
if scenario.respond_to?(:feature)
|
54
|
+
configured_report = Cornucopia::Util::Configuration.report_configuration :cucumber
|
55
|
+
else
|
56
|
+
configured_report = Cornucopia::Util::Configuration.report_configuration :cucumber_outline
|
57
|
+
end
|
58
|
+
|
59
|
+
configured_report.add_report_objects scenario: scenario, cucumber: self
|
60
|
+
configured_report.generate_report(report)
|
61
|
+
end
|
62
|
+
else
|
63
|
+
Cornucopia::Util::ReportBuilder.current_report.test_succeeded
|
44
64
|
end
|
45
|
-
else
|
46
|
-
Cornucopia::Util::ReportBuilder.current_report.test_succeeded
|
47
|
-
end
|
48
65
|
|
49
|
-
|
50
|
-
|
66
|
+
Cornucopia::Capybara::FinderDiagnostics::FindAction.clear_diagnosed_finders
|
67
|
+
Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
|
51
68
|
|
52
|
-
|
69
|
+
Cornucopia::Util::TestHelper.instance.record_test_end(test_name)
|
70
|
+
end
|
71
|
+
|
72
|
+
puts "Cornucopia::Hook::after test time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
53
73
|
end
|
54
74
|
else
|
55
75
|
Before do |scenario, block|
|
56
|
-
|
57
|
-
|
76
|
+
time = Benchmark.measure do
|
77
|
+
puts "Cornucopia::Hook::before test" if Cornucopia::Util::Configuration.benchmark
|
78
|
+
|
79
|
+
test_name = Cornucopia::Util::TestHelper.instance.cucumber_name(scenario)
|
80
|
+
Cornucopia::Util::TestHelper.instance.record_test_start(test_name)
|
81
|
+
|
82
|
+
seed_value = Cornucopia::Util::Configuration.seed ||
|
83
|
+
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
58
84
|
|
59
|
-
|
60
|
-
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
85
|
+
scenario.instance_variable_set :@seed_value, seed_value
|
61
86
|
|
62
|
-
|
87
|
+
Cornucopia::Capybara::FinderDiagnostics::FindAction.clear_diagnosed_finders
|
88
|
+
Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
|
63
89
|
|
64
|
-
|
65
|
-
|
90
|
+
Cornucopia::Util::ReportBuilder.current_report.start_test(scenario, "Scenario - #{test_name}")
|
91
|
+
end
|
66
92
|
|
67
|
-
Cornucopia::
|
93
|
+
puts "Cornucopia::Hook::before test time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
68
94
|
end
|
69
95
|
|
70
96
|
After do |scenario, block|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
if scenario.respond_to?(:feature)
|
80
|
-
configured_report = Cornucopia::Util::Configuration.report_configuration :cucumber
|
81
|
-
else
|
82
|
-
configured_report = Cornucopia::Util::Configuration.report_configuration :cucumber_outline
|
83
|
-
end
|
97
|
+
time = Benchmark.measure do
|
98
|
+
puts "Cornucopia::Hook::after test" if Cornucopia::Util::Configuration.benchmark
|
99
|
+
|
100
|
+
test_name = Cornucopia::Util::TestHelper.instance.cucumber_name(scenario)
|
101
|
+
|
102
|
+
if scenario.failed?
|
103
|
+
seed_value = scenario.instance_variable_get(:@seed_value)
|
104
|
+
puts ("random seed for testing was: #{seed_value}")
|
84
105
|
|
85
|
-
|
86
|
-
|
106
|
+
Cornucopia::Util::ReportBuilder.current_report.within_section("Test Error: #{test_name}") do |report|
|
107
|
+
configured_report = nil
|
108
|
+
if scenario.respond_to?(:feature)
|
109
|
+
configured_report = Cornucopia::Util::Configuration.report_configuration :cucumber
|
110
|
+
else
|
111
|
+
configured_report = Cornucopia::Util::Configuration.report_configuration :cucumber_outline
|
112
|
+
end
|
113
|
+
|
114
|
+
configured_report.add_report_objects scenario: scenario, cucumber: self
|
115
|
+
configured_report.generate_report(report)
|
116
|
+
end
|
117
|
+
else
|
118
|
+
Cornucopia::Util::ReportBuilder.current_report.test_succeeded
|
87
119
|
end
|
88
|
-
else
|
89
|
-
Cornucopia::Util::ReportBuilder.current_report.test_succeeded
|
90
|
-
end
|
91
120
|
|
92
|
-
|
93
|
-
|
121
|
+
Cornucopia::Capybara::FinderDiagnostics::FindAction.clear_diagnosed_finders
|
122
|
+
Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
|
94
123
|
|
95
|
-
|
124
|
+
Cornucopia::Util::ReportBuilder.current_report.end_test(scenario)
|
96
125
|
|
97
|
-
|
126
|
+
Cornucopia::Util::TestHelper.instance.record_test_end(test_name)
|
127
|
+
end
|
128
|
+
|
129
|
+
puts "Cornucopia::Hook::after test time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
98
130
|
end
|
99
131
|
end
|
100
132
|
|
101
133
|
at_exit do
|
102
|
-
|
134
|
+
time = Benchmark.measure do
|
135
|
+
puts "Cornucopia::Hook::suite end" if Cornucopia::Util::Configuration.benchmark
|
136
|
+
|
137
|
+
Cornucopia::Util::ReportBuilder.current_report.close
|
138
|
+
end
|
139
|
+
|
140
|
+
puts "Cornucopia::Hook::suite end time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
141
|
+
end
|
142
|
+
|
143
|
+
time = Benchmark.measure do
|
144
|
+
puts "Cornucopia::Hook::suite start" if Cornucopia::Util::Configuration.benchmark
|
145
|
+
|
146
|
+
Cornucopia::Util::ReportBuilder.new_report("cucumber_report")
|
103
147
|
end
|
104
148
|
|
105
|
-
Cornucopia::Util::
|
149
|
+
puts "Cornucopia::Hook::suite start time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
@@ -7,68 +7,106 @@ RSpec.configure do |config|
|
|
7
7
|
config.seed = Cornucopia::Util::Configuration.order_seed if Cornucopia::Util::Configuration.order_seed
|
8
8
|
|
9
9
|
config.before(:suite) do |*args|
|
10
|
-
|
10
|
+
time = Benchmark.measure do
|
11
|
+
puts "Cornucopia::Hook::suite start" if Cornucopia::Util::Configuration.benchmark
|
12
|
+
|
13
|
+
Cornucopia::Util::ReportBuilder.new_report("rspec_report")
|
14
|
+
end
|
15
|
+
|
16
|
+
puts "Cornucopia::Hook::suite start time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
11
17
|
end
|
12
18
|
|
13
19
|
config.after(:suite) do
|
14
|
-
|
20
|
+
time = Benchmark.measure do
|
21
|
+
puts "Cornucopia::Hook::suite end" if Cornucopia::Util::Configuration.benchmark
|
22
|
+
|
23
|
+
Cornucopia::Util::ReportBuilder.current_report.close
|
24
|
+
end
|
25
|
+
|
26
|
+
puts "Cornucopia::Hook::suite end time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
15
27
|
end
|
16
28
|
|
17
29
|
config.before(:all) do
|
18
|
-
|
19
|
-
|
30
|
+
time = Benchmark.measure do
|
31
|
+
puts "Cornucopia::Hook::before group" if Cornucopia::Util::Configuration.benchmark
|
20
32
|
|
21
|
-
|
33
|
+
@context_seed_value = Cornucopia::Util::Configuration.context_seed ||
|
34
|
+
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
35
|
+
|
36
|
+
srand(@context_seed_value)
|
37
|
+
end
|
38
|
+
|
39
|
+
puts "Cornucopia::Hook::before group time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
22
40
|
end
|
23
41
|
|
24
42
|
# Capybara resets the page in an after or around block before the around diagnostics can get around to dumping it
|
25
43
|
# so by adding an after block here, we can dump the Capybara results if there is a problem.
|
26
44
|
config.after(:each) do |example|
|
27
|
-
|
28
|
-
|
29
|
-
test_example ||= example
|
45
|
+
time = Benchmark.measure do
|
46
|
+
puts "Cornucopia::Hook::page dump" if Cornucopia::Util::Configuration.benchmark
|
30
47
|
|
31
|
-
|
32
|
-
|
48
|
+
test_example = example.example if example.respond_to?(:example)
|
49
|
+
test_example ||= self.example if self.respond_to?(:example)
|
50
|
+
test_example ||= example
|
51
|
+
|
52
|
+
if (test_example.exception)
|
53
|
+
Cornucopia::Capybara::PageDiagnostics.dump_details(section_label: "Page Dump for: #{test_example.full_description}")
|
54
|
+
end
|
33
55
|
end
|
56
|
+
|
57
|
+
puts "Cornucopia::Hook::page dump time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
34
58
|
end
|
35
59
|
|
36
60
|
config.around(:each) do |example|
|
37
|
-
test_example =
|
38
|
-
|
39
|
-
|
61
|
+
test_example = nil
|
62
|
+
|
63
|
+
time = Benchmark.measure do
|
64
|
+
puts "Cornucopia::Hook::before test" if Cornucopia::Util::Configuration.benchmark
|
40
65
|
|
41
|
-
|
66
|
+
test_example = example.example if example.respond_to?(:example)
|
67
|
+
test_example ||= self.example if self.respond_to?(:example)
|
68
|
+
test_example ||= example
|
42
69
|
|
43
|
-
|
44
|
-
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
70
|
+
Cornucopia::Util::TestHelper.instance.record_test_start(test_example.full_description)
|
45
71
|
|
46
|
-
|
72
|
+
@seed_value = Cornucopia::Util::Configuration.seed ||
|
73
|
+
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
74
|
+
|
75
|
+
srand(@seed_value)
|
76
|
+
|
77
|
+
Cornucopia::Capybara::FinderDiagnostics::FindAction.clear_diagnosed_finders
|
78
|
+
Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
|
79
|
+
end
|
47
80
|
|
48
|
-
Cornucopia::
|
49
|
-
Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
|
81
|
+
puts "Cornucopia::Hook::before test time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
50
82
|
|
51
83
|
Cornucopia::Util::ReportBuilder.current_report.within_test(test_example.full_description) do
|
52
84
|
example.run
|
53
85
|
|
54
|
-
|
55
|
-
puts
|
86
|
+
time = Benchmark.measure do
|
87
|
+
puts "Cornucopia::Hook::after test" if Cornucopia::Util::Configuration.benchmark
|
88
|
+
|
89
|
+
if (test_example.exception)
|
90
|
+
puts("random seed for testing was: #{@context_seed_value}, #{@seed_value}")
|
56
91
|
|
57
|
-
|
58
|
-
|
59
|
-
|
92
|
+
Cornucopia::Util::ReportBuilder.current_report.
|
93
|
+
within_section("Test Error: #{test_example.full_description}") do |report|
|
94
|
+
configured_report = Cornucopia::Util::Configuration.report_configuration :rspec
|
60
95
|
|
61
|
-
|
62
|
-
|
96
|
+
configured_report.add_report_objects example: test_example, rspec: RSpec
|
97
|
+
configured_report.generate_report(report)
|
98
|
+
end
|
99
|
+
else
|
100
|
+
Cornucopia::Util::ReportBuilder.current_report.test_succeeded
|
63
101
|
end
|
64
|
-
else
|
65
|
-
Cornucopia::Util::ReportBuilder.current_report.test_succeeded
|
66
102
|
end
|
67
|
-
end
|
68
103
|
|
69
|
-
|
70
|
-
|
104
|
+
Cornucopia::Capybara::FinderDiagnostics::FindAction.clear_diagnosed_finders
|
105
|
+
Cornucopia::Capybara::PageDiagnostics.clear_dumped_pages
|
106
|
+
|
107
|
+
Cornucopia::Util::TestHelper.instance.record_test_end(test_example.full_description)
|
108
|
+
end
|
71
109
|
|
72
|
-
Cornucopia::Util::
|
110
|
+
puts "Cornucopia::Hook::after test time: #{time}" if Cornucopia::Util::Configuration.benchmark
|
73
111
|
end
|
74
112
|
end
|
@@ -32,6 +32,7 @@ module Cornucopia
|
|
32
32
|
configurations.retry_match_with_found = false
|
33
33
|
configurations.open_report_settings = { default: false }
|
34
34
|
configurations.base_folder = "cornucopia_report"
|
35
|
+
configurations.benchmark = false
|
35
36
|
|
36
37
|
# configurations.alternate_retry = false
|
37
38
|
|
@@ -710,6 +711,17 @@ module Cornucopia
|
|
710
711
|
def record_test_start_and_end_format=(value)
|
711
712
|
Cornucopia::Util::Configuration.instance.configurations.record_test_start_and_end_format = value
|
712
713
|
end
|
714
|
+
|
715
|
+
# Turns benchmarking on or off.
|
716
|
+
#
|
717
|
+
# Defaults to false.
|
718
|
+
def benchmark
|
719
|
+
Cornucopia::Util::Configuration.instance.configurations.benchmark
|
720
|
+
end
|
721
|
+
|
722
|
+
def benchmark=(value)
|
723
|
+
Cornucopia::Util::Configuration.instance.configurations.benchmark = value
|
724
|
+
end
|
713
725
|
end
|
714
726
|
end
|
715
727
|
end
|
data/lib/cornucopia/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cornucopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RealNobody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|