hiptest-publisher 0.7.5 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/config/php-phpunit.conf +13 -0
  3. data/lib/hiptest-publisher/nodes.rb +3 -2
  4. data/lib/hiptest-publisher/options_parser.rb +1 -0
  5. data/lib/hiptest-publisher/render_context_maker.rb +6 -0
  6. data/lib/hiptest-publisher/utils.rb +12 -4
  7. data/lib/hiptest-publisher/xml_parser.rb +2 -1
  8. data/lib/templates/gherkin/folder.hbs +2 -1
  9. data/lib/templates/gherkin/single_scenario.hbs +4 -2
  10. data/lib/templates/gherkin/tag.hbs +1 -0
  11. data/lib/templates/php/_body.hbs +8 -0
  12. data/lib/templates/php/_item_as_function.hbs +3 -0
  13. data/lib/templates/php/_scenario.hbs +4 -0
  14. data/lib/templates/php/_setup.hbs +4 -0
  15. data/lib/templates/php/actionword.hbs +1 -0
  16. data/lib/templates/php/actionwords.hbs +7 -0
  17. data/lib/templates/php/argument.hbs +1 -0
  18. data/lib/templates/php/assign.hbs +1 -0
  19. data/lib/templates/php/binaryexpression.hbs +1 -0
  20. data/lib/templates/php/call.hbs +2 -0
  21. data/lib/templates/php/dataset.hbs +3 -0
  22. data/lib/templates/php/dict.hbs +1 -0
  23. data/lib/templates/php/field.hbs +1 -0
  24. data/lib/templates/php/ifthen.hbs +7 -0
  25. data/lib/templates/php/index.hbs +1 -0
  26. data/lib/templates/php/list.hbs +1 -0
  27. data/lib/templates/php/nullliteral.hbs +1 -0
  28. data/lib/templates/php/parameter.hbs +1 -0
  29. data/lib/templates/php/parenthesis.hbs +1 -0
  30. data/lib/templates/php/project.hbs +2 -0
  31. data/lib/templates/php/property.hbs +1 -0
  32. data/lib/templates/php/scenario.hbs +1 -0
  33. data/lib/templates/php/scenarios.hbs +13 -0
  34. data/lib/templates/php/single_scenario.hbs +11 -0
  35. data/lib/templates/php/single_test.hbs +11 -0
  36. data/lib/templates/php/step.hbs +1 -0
  37. data/lib/templates/php/tag.hbs +1 -0
  38. data/lib/templates/php/template.hbs +1 -0
  39. data/lib/templates/php/test.hbs +1 -0
  40. data/lib/templates/php/tests.hbs +13 -0
  41. data/lib/templates/php/unaryexpression.hbs +1 -0
  42. data/lib/templates/php/variable.hbs +1 -0
  43. data/lib/templates/php/while.hbs +5 -0
  44. metadata +37 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc18444afa554ac27cd351a4f06f4ae254fcb697
4
- data.tar.gz: 4ce8f60402846ca44daa10eebb7099a85ad5da92
3
+ metadata.gz: 2b5193a63f746ddb72f900a01da80c1de637a509
4
+ data.tar.gz: d8ab11b68757655d3d1e75c8856a548ec3d16d57
5
5
  SHA512:
6
- metadata.gz: 9d30eef201f39b8f01c07f895db6c3f0dd51fda1942ba3f7d40b3ae6ececfae53f3250ec1cb5fe4b6c9ac856ba1d2d42b732cde0827f114913e200c1cbf13dc1
7
- data.tar.gz: 4bf1a76a08f5b99c19542be953f5fa09dd7c51350f04305b0c2504719597e4db764d2e30b992ba6f5d2725f0cb3cc9ff65d9bb5613e1e565df5e81402f49c2e2
6
+ metadata.gz: b2654e4cacaf2f522d6ebcb398cd29bfd13cec77af449813e2e251b25969b290c1a232e988d2824b2c490e479c2ac9de36305a9676e5f7cbcbdbdf89c36f0432
7
+ data.tar.gz: f09e6c6711584c09ec95eab129f01662809cfcb324134d9c029d7928b976a66053ebd1f2f46844c04ec7fd9d3565fa4c9e93db389cfa94691f8b45023e753ff7
@@ -0,0 +1,13 @@
1
+ [_common]
2
+ template_dirs = php, common
3
+ indentation = " "
4
+
5
+ [tests]
6
+ filename = 'TestProject.php'
7
+ scenario_filename = 'Test_%s.php'
8
+ call_prefix = '$this->actionwords'
9
+
10
+ [actionwords]
11
+ filename = 'Actionwords.php'
12
+ naming_convention = 'camel_case'
13
+ call_prefix = '$this'
@@ -384,7 +384,7 @@ module Hiptest
384
384
  class Folder < Node
385
385
  attr_reader :uid, :parent_uid
386
386
 
387
- def initialize(uid, parent_uid, name, description)
387
+ def initialize(uid, parent_uid, name, description, tags = [])
388
388
  super()
389
389
 
390
390
  @uid = uid
@@ -394,7 +394,8 @@ module Hiptest
394
394
  :name => name,
395
395
  :description => description,
396
396
  :subfolders => [],
397
- :scenarios => []
397
+ :scenarios => [],
398
+ :tags => tags
398
399
  }
399
400
  end
400
401
 
@@ -124,6 +124,7 @@ class OptionsParser
124
124
  'Selenium IDE' => [''],
125
125
  'Javascript' => ['qUnit', 'Jasmine'],
126
126
  'CSharp' => ['NUnit'],
127
+ 'PHP' => ['PHPUnit'],
127
128
  'SpecFlow' => ['']
128
129
  }
129
130
  end
@@ -1,5 +1,11 @@
1
1
  module Hiptest
2
2
  module RenderContextMaker
3
+ def walk_folder(folder)
4
+ {
5
+ :has_tags? => !folder.children[:tags].empty?
6
+ }
7
+ end
8
+
3
9
  def walk_item(item)
4
10
  {
5
11
  :has_parameters? => !item.children[:parameters].empty?,
@@ -1,6 +1,7 @@
1
+ require 'colorize'
2
+ require 'io/console'
1
3
  require 'open-uri'
2
4
  require 'openssl'
3
- require 'colorize'
4
5
  require 'net/http/post/multipart'
5
6
 
6
7
  def hiptest_publisher_path
@@ -16,7 +17,7 @@ rescue
16
17
  end
17
18
 
18
19
  def pluralize_word(count, singular, plural=nil)
19
- word = if count == 1
20
+ if count == 1
20
21
  singular
21
22
  else
22
23
  "#{singular}s"
@@ -61,7 +62,6 @@ end
61
62
 
62
63
  def show_status_message(message, status=nil)
63
64
  status_icon = " "
64
- line_end = status.nil? ? "" : "\n"
65
65
  output = STDOUT
66
66
 
67
67
  if status == :success
@@ -70,8 +70,16 @@ def show_status_message(message, status=nil)
70
70
  status_icon = "x".red
71
71
  output = STDERR
72
72
  end
73
+ if status
74
+ cursor_offset = ""
75
+ else
76
+ return unless $stdout.tty?
77
+ rows, columns = IO.console.winsize
78
+ vertical_offset = (4 + message.length) / columns
79
+ cursor_offset = "\r\e[#{vertical_offset + 1}A"
80
+ end
73
81
 
74
- output.print "[#{status_icon}] #{message}\r#{line_end}"
82
+ output.print "[#{status_icon}] #{message}#{cursor_offset}\n"
75
83
  end
76
84
 
77
85
  def with_status_message(message, &blk)
@@ -272,7 +272,8 @@ module Hiptest
272
272
  css_first_content(folder, 'uid'),
273
273
  css_first_content(folder, 'parentUid'),
274
274
  css_first_content(folder, 'name'),
275
- css_first_content(folder, 'description'))
275
+ css_first_content(folder, 'description'),
276
+ build_tags(folder))
276
277
  end
277
278
  alias :build_folderSnapshot :build_folder
278
279
 
@@ -1,4 +1,5 @@
1
- Feature: {{{ rendered_children.name }}}{{#indent}}
1
+ {{#if has_tags?}}{{join rendered_children.tags ' '}}
2
+ {{/if}}Feature: {{{ rendered_children.name }}}{{#indent}}
2
3
  {{#if rendered_children.description}}{{#indent}}{{rendered_children.description}}{{/indent}}{{/if}}
3
4
  {{#each rendered_children.scenarios}}{{{this}}}{{/each}}
4
5
  {{/indent}}
@@ -1,5 +1,6 @@
1
1
  {{#if has_datasets?}}
2
- Scenario Outline: {{{ rendered_children.name }}}{{#indent}}
2
+ {{#if has_tags?}}{{join rendered_children.tags ' '}}
3
+ {{/if}}Scenario Outline: {{{ rendered_children.name }}}{{#indent}}
3
4
  {{#each rendered_children.body}}{{{ this }}}
4
5
  {{/each}}
5
6
  Examples:{{#indent}}
@@ -7,7 +8,8 @@ Examples:{{#indent}}
7
8
  {{{rendered_children.datatable}}}
8
9
  {{/indent}}{{/indent}}
9
10
  {{else}}
10
- Scenario: {{{ rendered_children.name }}}{{#if rendered_children.uid}} (uid:{{{rendered_children.uid}}}){{/if}}{{#indent}}
11
+ {{#if has_tags?}}{{join rendered_children.tags ' '}}
12
+ {{/if}}Scenario: {{{ rendered_children.name }}}{{#if rendered_children.uid}} (uid:{{{rendered_children.uid}}}){{/if}}{{#indent}}
11
13
  {{#each rendered_children.body}}{{{ this }}}
12
14
  {{/each}}
13
15
  {{/indent}}
@@ -0,0 +1 @@
1
+ @{{{ rendered_children.key }}}{{#if has_value? }}:{{{ rendered_children.value }}}{{/if}}
@@ -0,0 +1,8 @@
1
+ {{#clear_empty_lines}}
2
+ {{#indent}}
3
+ {{#comment '//'}}{{{ rendered_children.description }}}{{/comment}}
4
+ {{#if has_tags?}}// Tags: {{{ join rendered_children.tags ' '}}}{{/if}}
5
+ {{#each rendered_children.body}}{{{this}}}
6
+ {{/each}}{{#if has_step?}}
7
+ throw new Exception('Not implemented');{{/if}}{{/indent}}
8
+ {{/clear_empty_lines}}
@@ -0,0 +1,3 @@
1
+ public function {{ camelize_lower rendered_children.name }}({{{ join rendered_children.parameters ', '}}}) {{#curly}}
2
+ {{> body}}
3
+ {{/curly}}
@@ -0,0 +1,4 @@
1
+ {{#if has_datasets?}}{{> item_as_function}}
2
+ {{{ rendered_children.datatable }}}{{else}}public function test{{{ camelize_upper rendered_children.name }}}{{#if rendered_children.uid}}Uid{{{camelize_upper rendered_children.uid}}}{{/if}}() {{#curly}}
3
+ {{> body}}
4
+ {{/curly}}{{/if}}
@@ -0,0 +1,4 @@
1
+ public function setUp() {{#curly}}{{#indent}}
2
+ $this->actionwords = new Actionwords();
3
+ {{/indent}}
4
+ {{/curly}}
@@ -0,0 +1 @@
1
+ {{> item_as_function }}
@@ -0,0 +1,7 @@
1
+ <?php
2
+ class Actionwords {{#curly}}{{#indent}}{{#each rendered_children.actionwords}}
3
+ {{{this}}}
4
+ {{/each}}
5
+ {{/indent}}
6
+ {{/curly}}
7
+ ?>
@@ -0,0 +1 @@
1
+ {{{ rendered_children.value }}}
@@ -0,0 +1 @@
1
+ {{{ rendered_children.to }}} = {{{ rendered_children.value }}};
@@ -0,0 +1 @@
1
+ {{{ rendered_children.left }}} {{{ rendered_children.operator }}} {{{ rendered_children.right }}}
@@ -0,0 +1,2 @@
1
+ {{#if has_annotation? }}{{#comment '//'}}{{{ rendered_children.gherkin_text }}}{{/comment}}
2
+ {{/if}}{{#if context.call_prefix}}{{{ context.call_prefix }}}->{{/if}}{{{ camelize_lower rendered_children.actionword }}}({{{ join rendered_children.arguments ', '}}});
@@ -0,0 +1,3 @@
1
+ public function test{{camelize_upper scenario_name}}{{{camelize_upper rendered_children.name}}}{{#if rendered_children.uid}}Uid{{{camelize_upper rendered_children.uid}}}{{/if}}() {{#curly}}
2
+ $this->{{{ camelize_lower scenario_name }}}({{{ join rendered_children.arguments ', ' }}});
3
+ {{/curly}}
@@ -0,0 +1 @@
1
+ {{#curly}}{{{ join rendered_children.items ', '}}}{{/curly}}
@@ -0,0 +1 @@
1
+ {{{ rendered_children.base }}}->{{{ rendered_children.name }}}
@@ -0,0 +1,7 @@
1
+ if ({{{ rendered_children.condition }}}) {{#curly}}
2
+ {{#indent}}{{#each rendered_children.then}}{{{this}}}{{/each}}
3
+ {{/indent}}
4
+ {{#if has_else?}}{{close_curly}} else {{open_curly}}
5
+ {{#indent}}{{#each rendered_children.else}}{{{this}}}{{/each}}
6
+ {{/indent}}
7
+ {{/if}}{{/curly}}
@@ -0,0 +1 @@
1
+ {{{ rendered_children.base }}}[{{{ rendered_children.expression }}}]
@@ -0,0 +1 @@
1
+ [{{{ join rendered_children.items ', '}}}]
@@ -0,0 +1 @@
1
+ NULL
@@ -0,0 +1 @@
1
+ ${{{ underscore rendered_children.name }}}{{#if has_default_value?}} = {{{ rendered_children.default }}}{{/if}}
@@ -0,0 +1 @@
1
+ ({{{ rendered_children.content }}})
@@ -0,0 +1,2 @@
1
+ name: {{{ rendered_children.name }}}
2
+ description: {{{ rendered_children.description }}}
@@ -0,0 +1 @@
1
+ {{{ rendered_children.key }}} => {{{ rendered_children.value }}}
@@ -0,0 +1 @@
1
+ {{> scenario}}
@@ -0,0 +1,13 @@
1
+ <?php
2
+ require_once('Actionwords.php');
3
+
4
+ class {{{ camelize_upper project_name }}}Test extends PHPUnit_Framework_TestCase {{#curly}}{{#indent}}
5
+ public $actionwords;
6
+ {{> setup}}
7
+
8
+ {{#each rendered_children.scenarios}}{{this}}
9
+
10
+ {{/each}}
11
+ {{/indent}}
12
+ {{/curly}}
13
+ ?>
@@ -0,0 +1,11 @@
1
+ <?php
2
+ require_once('Actionwords.php');
3
+
4
+ class {{{ camelize_upper project_name }}}Test extends PHPUnit_Framework_TestCase {{#curly}}{{#indent}}
5
+ public $actionwords;
6
+ {{> setup}}
7
+
8
+ {{> scenario}}
9
+ {{/indent}}
10
+ {{/curly}}
11
+ ?>
@@ -0,0 +1,11 @@
1
+ <?php
2
+ require_once('Actionwords.php');
3
+
4
+ class {{{ camelize_upper project_name }}}Test extends PHPUnit_Framework_TestCase {{#curly}}{{#indent}}
5
+ public $actionwords;
6
+ {{> setup}}
7
+
8
+ {{> scenario}}
9
+ {{/indent}}
10
+ {{/curly}}
11
+ ?>
@@ -0,0 +1 @@
1
+ {{#comment '//'}}TODO: Implement {{{rendered_children.key}}}: {{{rendered_children.value}}}{{/comment}}
@@ -0,0 +1 @@
1
+ {{{ rendered_children.key }}}{{#if has_value?}}:{{{rendered_children.value}}}{{/if}}
@@ -0,0 +1 @@
1
+ "{{#each treated_chunks}}{{#if this.is_variable?}}{{#curly}}${{{camelize_lower this.raw.children.name}}}{{/curly}}{{else}}{{{ escape_quotes this.raw.children.value }}}{{/if}}{{/each}}"
@@ -0,0 +1 @@
1
+ {{> scenario}}
@@ -0,0 +1,13 @@
1
+ <?php
2
+ require_once('Actionwords.php');
3
+
4
+ class {{{ camelize_upper project_name }}}Test extends PHPUnit_Framework_TestCase {{#curly}}{{#indent}}
5
+ public $actionwords;
6
+ {{> setup}}
7
+
8
+ {{#each rendered_children.tests}}{{{this}}}
9
+
10
+ {{/each}}
11
+ {{/indent}}
12
+ {{/curly}}
13
+ ?>
@@ -0,0 +1 @@
1
+ {{{ rendered_children.operator }}}{{{ rendered_children.expression }}}
@@ -0,0 +1 @@
1
+ ${{ underscore rendered_children.name }}
@@ -0,0 +1,5 @@
1
+ while ({{{ rendered_children.condition }}}) {{#curly}}{{#indent}}
2
+ {{#each rendered_children.body }}{{{this}}}
3
+ {{/each}}
4
+ {{/indent}}
5
+ {{/curly}}
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.7.5
4
+ version: 0.8.0
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: 2015-12-04 00:00:00.000000000 Z
11
+ date: 2015-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -246,6 +246,7 @@ files:
246
246
  - lib/config/java-testng.conf
247
247
  - lib/config/javascript-jasmine.conf
248
248
  - lib/config/javascript-qunit.conf
249
+ - lib/config/php-phpunit.conf
249
250
  - lib/config/python-unittest.conf
250
251
  - lib/config/robotframework.conf
251
252
  - lib/config/ruby-minitest.conf
@@ -330,6 +331,7 @@ files:
330
331
  - lib/templates/gherkin/single_test.hbs
331
332
  - lib/templates/gherkin/step.hbs
332
333
  - lib/templates/gherkin/stringliteral.hbs
334
+ - lib/templates/gherkin/tag.hbs
333
335
  - lib/templates/gherkin/template.hbs
334
336
  - lib/templates/java/_body.hbs
335
337
  - lib/templates/java/_item_as_function.hbs
@@ -409,6 +411,39 @@ files:
409
411
  - lib/templates/javascript/tests.hbs
410
412
  - lib/templates/javascript/unaryexpression.hbs
411
413
  - lib/templates/javascript/while.hbs
414
+ - lib/templates/php/_body.hbs
415
+ - lib/templates/php/_item_as_function.hbs
416
+ - lib/templates/php/_scenario.hbs
417
+ - lib/templates/php/_setup.hbs
418
+ - lib/templates/php/actionword.hbs
419
+ - lib/templates/php/actionwords.hbs
420
+ - lib/templates/php/argument.hbs
421
+ - lib/templates/php/assign.hbs
422
+ - lib/templates/php/binaryexpression.hbs
423
+ - lib/templates/php/call.hbs
424
+ - lib/templates/php/dataset.hbs
425
+ - lib/templates/php/dict.hbs
426
+ - lib/templates/php/field.hbs
427
+ - lib/templates/php/ifthen.hbs
428
+ - lib/templates/php/index.hbs
429
+ - lib/templates/php/list.hbs
430
+ - lib/templates/php/nullliteral.hbs
431
+ - lib/templates/php/parameter.hbs
432
+ - lib/templates/php/parenthesis.hbs
433
+ - lib/templates/php/project.hbs
434
+ - lib/templates/php/property.hbs
435
+ - lib/templates/php/scenario.hbs
436
+ - lib/templates/php/scenarios.hbs
437
+ - lib/templates/php/single_scenario.hbs
438
+ - lib/templates/php/single_test.hbs
439
+ - lib/templates/php/step.hbs
440
+ - lib/templates/php/tag.hbs
441
+ - lib/templates/php/template.hbs
442
+ - lib/templates/php/test.hbs
443
+ - lib/templates/php/tests.hbs
444
+ - lib/templates/php/unaryexpression.hbs
445
+ - lib/templates/php/variable.hbs
446
+ - lib/templates/php/while.hbs
412
447
  - lib/templates/python/_body.hbs
413
448
  - lib/templates/python/_item_as_def.hbs
414
449
  - lib/templates/python/_parameters.hbs