hiptest-publisher 0.9.2 → 0.9.3

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
  SHA1:
3
- metadata.gz: 308eed4579db33eb3a66d88a1fedf85cc54623a1
4
- data.tar.gz: a9b55d5bc2b3e77b6250980b7d62670e19d3dfc2
3
+ metadata.gz: e40f7305d2e457cf777c7f466dce10615f038da0
4
+ data.tar.gz: 707eb0e73db074cbeeb34784ac7d5d207e6c511c
5
5
  SHA512:
6
- metadata.gz: 16692815eb3cdb3e8f7646225b703bd151b838d9c113120d1f284fe569cdef883df6750a12af79942fe6fb087f7a92da7cb5e76bbd170d1c6e951c06be910c90
7
- data.tar.gz: 76b30324fdb46dd38dd10f5bee979f4fc895a61120390fdd00645609b8dc60c2045919195b5bd1d390516808f119da10157e59b8069bdd0957bb1f13fc0ae0ac
6
+ metadata.gz: 3e0e0305db5ff2e4a381cdce686f147b76c1f6cce72f02cccd04874184382d1328e65a30e1b6c3cbc7103230228f773254587cee1ef62e83bca51c2d9f1e0790
7
+ data.tar.gz: 11281106ec92a89cbccb1129f3e72185bdce7aa886d09f0a7f427f62726d50172ec0641e122898862c555955747fe9efc9817cd6f36add76eed16a9b1d08fb8f
@@ -12,6 +12,8 @@ require 'hiptest-publisher/parameter_type_adder'
12
12
  require 'hiptest-publisher/call_arguments_adder'
13
13
  require 'hiptest-publisher/signature_exporter'
14
14
  require 'hiptest-publisher/signature_differ'
15
+ require 'hiptest-publisher/items_orderer'
16
+
15
17
 
16
18
  module Hiptest
17
19
  class Publisher
@@ -235,6 +237,7 @@ module Hiptest
235
237
  Hiptest::Nodes::ParameterTypeAdder.add(@project)
236
238
  Hiptest::DefaultArgumentAdder.add(@project)
237
239
  Hiptest::GherkinAdder.add(@project)
240
+ Hiptest::ItemsOrderer.add(@project, @cli_options.sort)
238
241
  end
239
242
 
240
243
  export_files
@@ -0,0 +1,29 @@
1
+ require 'hiptest-publisher/nodes'
2
+
3
+ module Hiptest
4
+ class ItemsOrderer
5
+ def self.add(project, order)
6
+ Hiptest::ItemsOrderer.new(project).order_items(order)
7
+ end
8
+
9
+ def initialize(project)
10
+ @project = project
11
+ end
12
+
13
+ def order_items(order)
14
+ if (order == 'order')
15
+ @project.each_sub_nodes(Hiptest::Nodes::Folder) do |folder|
16
+ folder.children[:scenarios].sort_by! {|sc| sc.order_in_parent}
17
+ folder.children[:subfolders].sort_by! {|f| f.order_in_parent}
18
+ end
19
+ end
20
+
21
+ if (order == 'alpha')
22
+ @project.each_sub_nodes(Hiptest::Nodes::Folder) do |folder|
23
+ folder.children[:scenarios].sort_by! {|sc| sc.children[:name] }
24
+ folder.children[:subfolders].sort_by! {|f| f.children[:name] }
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -268,14 +268,15 @@ module Hiptest
268
268
  end
269
269
 
270
270
  class Scenario < Item
271
- attr_reader :folder_uid
271
+ attr_reader :folder_uid, :order_in_parent
272
272
 
273
- def initialize(name, description = '', tags = [], parameters = [], body = [], folder_uid = nil, datatable = Datatable.new)
273
+ def initialize(name, description = '', tags = [], parameters = [], body = [], folder_uid = nil, datatable = Datatable.new, order_in_parent = 0)
274
274
  super(name, tags, parameters, body)
275
275
  @children[:description] = description
276
276
  @children[:datatable] = datatable
277
277
 
278
278
  @folder_uid = folder_uid
279
+ @order_in_parent = order_in_parent
279
280
  end
280
281
 
281
282
  def set_uid(uid)
@@ -382,13 +383,14 @@ module Hiptest
382
383
  end
383
384
 
384
385
  class Folder < Node
385
- attr_reader :uid, :parent_uid
386
+ attr_reader :uid, :parent_uid, :order_in_parent
386
387
 
387
- def initialize(uid, parent_uid, name, description, tags = [])
388
+ def initialize(uid, parent_uid, name, description, tags = [], order_in_parent = 0)
388
389
  super()
389
390
 
390
391
  @uid = uid
391
392
  @parent_uid = parent_uid
393
+ @order_in_parent = order_in_parent
392
394
 
393
395
  @children = {
394
396
  :name => name,
@@ -156,6 +156,7 @@ class OptionsParser
156
156
  Option.new('s', 'site=SITE', 'https://hiptest.net', String, "Site to fetch from", :site),
157
157
  Option.new('p', 'push=FILE.TAP', '', String, "Push a results file to the server", :push),
158
158
  Option.new(nil, 'push-format=tap', 'tap', String, "Format of the test results (tap, junit, robot)", :push_format),
159
+ Option.new(nil, 'sort=[id,order,alpha]', 'id', String, "Sorting of tests in output: id will sort them by age, order will keep the same order than in hiptest, alpha will sort them by name", :sort),
159
160
  Option.new('v', 'verbose', false, nil, "Run verbosely", :verbose)
160
161
  ]
161
162
  end
@@ -208,7 +208,8 @@ module Hiptest
208
208
  build_parameters(scenario),
209
209
  build_steps(scenario),
210
210
  css_first_content(scenario, '> folderUid'),
211
- build_node(css_first(scenario, '> datatable'), Hiptest::Nodes::Datatable))
211
+ build_node(css_first(scenario, '> datatable'), Hiptest::Nodes::Datatable),
212
+ css_first_content(scenario, 'order_in_parent').to_i)
212
213
  end
213
214
 
214
215
  def build_scenarioSnapshot(scs)
@@ -273,7 +274,8 @@ module Hiptest
273
274
  css_first_content(folder, 'parentUid'),
274
275
  css_first_content(folder, 'name'),
275
276
  css_first_content(folder, 'description'),
276
- build_tags(folder))
277
+ build_tags(folder),
278
+ css_first_content(folder, 'order_in_parent').to_i)
277
279
  end
278
280
  alias :build_folderSnapshot :build_folder
279
281
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiptest-publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiptest R&D
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-08 00:00:00.000000000 Z
11
+ date: 2016-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -262,6 +262,7 @@ files:
262
262
  - lib/hiptest-publisher/formatters/reporter.rb
263
263
  - lib/hiptest-publisher/gherkin_adder.rb
264
264
  - lib/hiptest-publisher/handlebars_helper.rb
265
+ - lib/hiptest-publisher/items_orderer.rb
265
266
  - lib/hiptest-publisher/nodes.rb
266
267
  - lib/hiptest-publisher/nodes_walker.rb
267
268
  - lib/hiptest-publisher/options_parser.rb
@@ -576,7 +577,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
576
577
  version: '0'
577
578
  requirements: []
578
579
  rubyforge_project:
579
- rubygems_version: 2.4.5.1
580
+ rubygems_version: 2.4.8
580
581
  signing_key:
581
582
  specification_version: 4
582
583
  summary: Export your tests from Hiptest into executable tests.