lopata 0.1.28 → 0.1.30

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72851180980a23d7192519fecc8dd302ec9a792bf634b6b3a6b1903673c81730
4
- data.tar.gz: '0484aa838510d86c1cbb5a002113091aed5634ca866484909e60ed0a926abbb7'
3
+ metadata.gz: 81374a685539cc6f8c2b4fe190415fa94ff330ebdcc44615a78209c0a8848080
4
+ data.tar.gz: b5b230a64668f227eb6954d4e618d2780c4e6f00255a67a824bb4036acc578e7
5
5
  SHA512:
6
- metadata.gz: 6e47235c9aa1b6221e408fb7f951a3cb9f609165a4304a9048bc3c3ad289720c8e26de38331ed8ef086819263bffc8825ee71236875f0e340bc510c515f3ee32
7
- data.tar.gz: a9e5c49e3c2675cac5b4b5d9b82d8cedd2bb44215362fbe32399a95bc6beef546bba2e5c6308c43421edd09a3a9a302ffd73230249a09ed3dd413bdb780c99a9
6
+ metadata.gz: f1744e95c43d68bc6785406eb80943f3d51afcf5ac7e876771fa036946eb25140cd99f1748edcbaf614fcdc8371344e493a8570927c57865ae02e57d657e56ff
7
+ data.tar.gz: eb4799fa86d2a0f66540ee4be8e2f67aa9ad2602bf1a3ba4b5fca39069a654a80b64caf1a36e4b33d4e1c33945d78dd11d37bb2c69a35a1712dcbe382df4d32d
@@ -7,7 +7,7 @@ module Lopata
7
7
  class ConsoleOutputObserver < BaseObserver
8
8
  extend Forwardable
9
9
  # @private
10
- attr_reader :output
10
+ attr_reader :output, :statuses
11
11
  # @private
12
12
  def_delegators :output, :puts, :flush
13
13
 
@@ -15,6 +15,10 @@ module Lopata
15
15
  @output = $stdout
16
16
  end
17
17
 
18
+ def started(world)
19
+ @statuses = {}
20
+ end
21
+
18
22
  # @see Lopata::Observers::BaseObserver#finished
19
23
  def finished(world)
20
24
  total = statuses.values.inject(0, &:+)
@@ -104,10 +108,6 @@ module Lopata
104
108
  def indent(cols, text)
105
109
  text.split("\n").map { |line| " " * cols + line }.join("\n")
106
110
  end
107
-
108
- def statuses
109
- @statuses ||= {}
110
- end
111
111
  end
112
112
  end
113
113
  end
@@ -115,6 +115,10 @@ module Lopata
115
115
  to_rerun + get_json("/projects/#{project_code}/builds/#{build_number}/failures.json")
116
116
  end
117
117
 
118
+ def need_run
119
+ get_json("/projects/#{project_code}/builds/#{build_number}/need_run.json")
120
+ end
121
+
118
122
  private
119
123
 
120
124
  def get_json(path)
@@ -159,4 +163,4 @@ module Lopata
159
163
  @backtrace_formatter ||= Lopata::Observers::BacktraceFormatter.new
160
164
  end
161
165
  end
162
- end
166
+ end
data/lib/lopata/runner.rb CHANGED
@@ -9,16 +9,19 @@ require_relative 'condition'
9
9
  module Lopata
10
10
  # @private
11
11
  class Runner < Thor
12
+ class_option :env, default: :qa, aliases: 'e'
13
+ class_option :keep, type: :boolean, aliases: 'k'
14
+
12
15
  desc 'test', 'Run tests'
13
- option :env, default: :qa, aliases: 'e'
14
16
  option :rerun, type: :boolean, aliases: 'r'
15
- option :keep, type: :boolean, aliases: 'k'
16
17
  option :text, aliases: 't'
17
18
  option :list, type: :boolean, aliases: 'l'
18
19
  option :init, type: :boolean, aliases: 'i'
19
20
  def test(*args)
20
21
  trap_interrupt
21
22
  configure_from_options
23
+ add_text_filter(options[:text]) if options[:text]
24
+ add_rerun_filter if options[:rerun]
22
25
  Lopata::Loader.load_shared_steps
23
26
  Lopata::Loader.load_scenarios(*args)
24
27
  if options[:list]
@@ -30,9 +33,32 @@ module Lopata
30
33
  end
31
34
  end
32
35
 
36
+ desc 'suspect', 'Run suspect and not started tests'
37
+ option :skip, type: :numeric, default: 0, aliases: 's'
38
+ option :count, type: :numeric, default: 10, aliases: 'c'
39
+ def suspect(*args)
40
+ trap_interrupt
41
+ configure_from_options
42
+ Lopata::Loader.load_shared_steps
43
+ Lopata::Loader.load_scenarios(*args)
44
+ count = options[:count]
45
+ skip = options[:skip]
46
+ loop do
47
+ need_run = Lopata::Client.new.need_run
48
+ need_run = need_run[skip, count]
49
+ break if need_run.nil?
50
+ world = Lopata::World.new
51
+ world.scenarios.concat(Lopata.world.scenarios.select { |s| need_run.include?(s.title) })
52
+ break if world.scenarios.empty?
53
+ world.notify_observers(:started, world)
54
+ world.scenarios.each { |s| s.run }
55
+ world.notify_observers(:finished, world)
56
+ end
57
+ end
58
+
33
59
  default_task :test
34
60
 
35
- register Generators::App, :new, 'lopata new project-name', 'Init new lopata projects'
61
+ register Generators::App, :new, 'new [project-name]', 'Init new lopata projects'
36
62
 
37
63
  def self.exit_on_failure?
38
64
  true
@@ -46,8 +72,6 @@ module Lopata
46
72
  c.load_environment
47
73
  c.run_before_start_hooks
48
74
  end
49
- add_text_filter(options[:text]) if options[:text]
50
- add_rerun_filter if options[:rerun]
51
75
  end
52
76
 
53
77
  def add_text_filter(text)
@@ -63,12 +63,13 @@ class Lopata::Scenario
63
63
  # @private
64
64
  # Scenario execution and live-cycle information
65
65
  class Execution
66
- attr_reader :scenario, :current_step, :top
66
+ attr_reader :scenario, :current_step, :top, :title, :base_metadata
67
67
 
68
68
  def initialize(title, metadata = {})
69
- @scenario = Lopata::Scenario.new(self)
70
- @top = Lopata::GroupExecution.new(Lopata::TopStep.new(title, metadata: metadata), nil, steps: [])
71
- @current_step = @top
69
+ @title = title
70
+ @base_metadata = metadata
71
+ @top = Lopata::GroupExecution.new(Lopata::TopStep.new(title, metadata: base_metadata), nil, steps: [])
72
+ setup
72
73
  end
73
74
 
74
75
  # Provide a human-readable representation of this class
@@ -82,12 +83,21 @@ class Lopata::Scenario
82
83
  end
83
84
 
84
85
  def run
86
+ unless @scenario # for second run if need
87
+ setup
88
+ top.reset_status
89
+ end
85
90
  world.notify_observers(:scenario_started, self)
86
91
  run_step(top)
87
92
  world.notify_observers(:scenario_finished, self)
88
93
  cleanup
89
94
  end
90
95
 
96
+ def setup
97
+ @scenario = Lopata::Scenario.new(self)
98
+ @current_step = @top
99
+ end
100
+
91
101
  def run_step(step)
92
102
  @current_step = step
93
103
  return :skipped if step.skipped?
@@ -135,10 +145,6 @@ class Lopata::Scenario
135
145
  current_step.find_let_method(name)
136
146
  end
137
147
 
138
- def title
139
- top.title
140
- end
141
-
142
148
  def status
143
149
  top.status
144
150
  end
@@ -160,9 +166,7 @@ class Lopata::Scenario
160
166
  end
161
167
 
162
168
  def cleanup
163
- @title = nil
164
169
  @scenario = nil
165
- @top = nil
166
170
  @current_step = nil
167
171
  end
168
172
  end
data/lib/lopata/step.rb CHANGED
@@ -113,8 +113,12 @@ module Lopata
113
113
  def initialize(step, parent, condition: nil)
114
114
  @step = step
115
115
  @parent = parent
116
- @status = :not_runned
117
116
  @condition = condition
117
+ reset_status
118
+ end
119
+
120
+ def reset_status
121
+ @status = :not_runned
118
122
  end
119
123
 
120
124
  def group?
@@ -205,6 +209,12 @@ module Lopata
205
209
  @let_methods = {}
206
210
  end
207
211
 
212
+ def reset_status
213
+ super
214
+ return unless @steps
215
+ @steps.each(&:reset_status)
216
+ end
217
+
208
218
  def group?
209
219
  true
210
220
  end
@@ -1,6 +1,6 @@
1
1
  module Lopata
2
2
  # @private
3
3
  module Version
4
- STRING = '0.1.28'
4
+ STRING = '0.1.30'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lopata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.28
4
+ version: 0.1.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Volochnev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-11 00:00:00.000000000 Z
11
+ date: 2024-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.1'
61
+ version: '9.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.1'
68
+ version: '9.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aruba
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.0'
75
+ version: '2.2'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.0'
82
+ version: '2.2'
83
83
  description: Functional acceptance testing
84
84
  email: alexey.volochnev@gmail.com
85
85
  executables:
@@ -138,5 +138,5 @@ requirements: []
138
138
  rubygems_version: 3.2.15
139
139
  signing_key:
140
140
  specification_version: 4
141
- summary: lopata-0.1.28
141
+ summary: lopata-0.1.30
142
142
  test_files: []