specimen 0.0.2.alpha → 0.0.4.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +53 -49
  3. data/VERSION +1 -1
  4. data/lib/specimen/command/exec_command_builder.rb +42 -14
  5. data/lib/specimen/command/runner/cukes_runner.rb +2 -18
  6. data/lib/specimen/command/runner/specs_runner.rb +2 -17
  7. data/lib/specimen/command/test_runner.rb +19 -25
  8. data/lib/specimen/command.rb +12 -7
  9. data/lib/specimen/commands/encrypted_configuration/USAGE +37 -0
  10. data/lib/specimen/commands/encrypted_configuration/encrypted_configuration_command.rb +108 -0
  11. data/lib/specimen/commands/gem_help/USAGE +6 -3
  12. data/lib/specimen/config_parser.rb +31 -0
  13. data/lib/specimen/generator/configs/specimen_project_config.rb +2 -2
  14. data/lib/specimen/generator/cucumber/cucumber_project_generator.rb +2 -0
  15. data/lib/specimen/generator/cucumber/templates/config/cucumber.yml.tt +4 -1
  16. data/lib/specimen/generator/cucumber/templates/config/specimen.cukes.yml.tt +22 -0
  17. data/lib/specimen/generator/cucumber/templates/features/examples/add_numbers.feature.tt +4 -2
  18. data/lib/specimen/generator/cucumber/templates/features/step_definitions/examples/example_steps.rb.tt +9 -0
  19. data/lib/specimen/generator/cucumber/templates/features/support/env.rb.tt +22 -0
  20. data/lib/specimen/generator/project/project_root_generator.rb +0 -3
  21. data/lib/specimen/generator/project/specimen_project_generator.rb +37 -0
  22. data/lib/specimen/generator/project/templates/root/config/specimen.yml.tt +11 -7
  23. data/lib/specimen/generator/rspec/rspec_project_generator.rb +1 -0
  24. data/lib/specimen/generator/rspec/templates/config/.rspec.tt +0 -4
  25. data/lib/specimen/generator/rspec/templates/config/specimen.specs.yml.tt +19 -0
  26. data/lib/specimen/generator/rspec/templates/spec/examples/example_spec.rb.tt +9 -5
  27. data/lib/specimen/generator/rspec/templates/spec/spec_helper.rb.tt +7 -5
  28. data/lib/specimen/runtime.rb +124 -54
  29. data/lib/specimen/utils/encrypted_config_path.rb +54 -0
  30. data/lib/specimen/utils/encrypted_configuration.rb +156 -0
  31. data/lib/specimen/utils.rb +8 -0
  32. data/lib/specimen/version.rb +1 -1
  33. data/lib/specimen.rb +14 -5
  34. metadata +26 -6
  35. data/lib/specimen/command/runner/exec_runner.rb +0 -37
  36. data/lib/specimen/commands/exec/exec_command.rb +0 -9
  37. data/lib/specimen/runtime/yml_parser.rb +0 -49
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3fce910bcf39219d89c6e71fc7b55f49190059d3b667075efbf3cc52c856023
4
- data.tar.gz: 988fd2a04568f0e29bac692cc108e1086b9a3d200db7f74315ff4d56835a4bdf
3
+ metadata.gz: 336dd0051499f6384e21a5963dd70c869103950ddc55e9a832ca88c5de8cdfd2
4
+ data.tar.gz: 9b76085869efaaf62d49a896b769a58ccce5a5b7c470c437481e8896ab97d389
5
5
  SHA512:
6
- metadata.gz: 3445ddf6f2c1ff018d60153f9f6693d240ef61424f3783a6cc937ae6dfbd5f21e71354b24ea4aedca32ae0e7f301017adf59db1eb3cd564b938769c84000e64f
7
- data.tar.gz: 7e4ff97d90c40fe7bfc2ee43da5826cc355b49531fc65cbf84d8771742ce8b17e1b6b2a34911decc1656196070e3642e87f92f41e9e61297512be77f3da17444
6
+ metadata.gz: cfb84ce6b86528fca53e86090d0069bcce2f9efc96d186516d8a6927f4b00ebb9a644e2d664380968e897077b10d4aeeb7db67f173f8a445e20f37bac97f51d6
7
+ data.tar.gz: fcbb093a73acd7d10ac7fe85160b2346630f132d0c504592b3e5e2f557a25b1e53008da8770cb6080cb7ca6bf1f198b0c9b03d2f5dc5ff2348b3f034a87fb66c
data/README.md CHANGED
@@ -5,67 +5,72 @@ will help me with:
5
5
 
6
6
  - setting up a new test automation project, including README, Gemfile, rubocop.yml, etc...
7
7
  - run Cucumber and RSpec tests with configs that make sense (e.g. parallel execution, reporting)
8
- - provide a Rails like templating approach in terms of _convention over configuration_ to provide a maintainable base for
8
+ - provide a Rails like templating approach in terms of _convention over configuration_ to provide a maintainable base
9
+ for
9
10
  API or UI tests using RSpec and/or Cucumber.
10
11
 
12
+ ## How to start?
13
+
14
+ To get familiar with specimen, you can simply create initialize a new project by running the following command.
15
+
16
+ ```shell
17
+ specimen init --name example-project
18
+ ```
19
+
20
+ This will do the following things for you
21
+
22
+ - create a new directory `/example-project` relative to your current working directory
23
+ - create initial files for running Cucumber or RSpec tests as well as project root files such as a README.md, Gemfile,
24
+ etc...
25
+ - creates a new encrypted configuration in `/example-project/config/enc/example.yml.enc`
26
+ - creates a new key file in `/example-project/config/enc/example.key` containing the key value to decrypt the
27
+ configuration which is required when you need to update the encrypted config.
28
+ - creates a .env-file `/example-project/.example.env` containing the `MASTER_KEY` variable and the key value to decrypt
29
+ the config
30
+
31
+ Now you can switch to the newly created directory `/example-project` and run e.g. the following commands
32
+
33
+ ```shell
34
+ # run Cucumber tests without additional options
35
+ specimen cukes
36
+
37
+ # run Cucumber tests tagged with @pass
38
+ specimen cukes -t @pass
39
+
40
+ # run RSpec tests without additional options
41
+ specimen specs
42
+
43
+ # run RSpec tests tagged with pass: true
44
+ specimen specs -t pass
45
+
46
+ # run Cucumber|RSpec tests using the example specimen-profile
47
+ # The 'examples' profile will automatically load and decrypt the
48
+ # encrypted configuration /config/enc/example.yml.enc during execution.
49
+ specimen cukes|specs --sp|--specimen-profile examples
50
+ ```
51
+
11
52
  ## specimen commands
12
53
 
13
54
  ```shell
14
- ❯ specimen
15
55
  Usage:
16
56
  specimen COMMAND [options]
17
57
 
18
58
  You must specify a command:
19
59
 
20
60
  init Initialize a new specimen project
21
- cukes Run Cucumber tests (WIP)
22
- specs Run RSpec tests (WIP)
23
- exec Run tests via a config file (WIP)
61
+ cukes Run Cucumber tests
62
+ specs Run RSpec tests
63
+ enc Create or update encrypted configurations
64
+
65
+ -v|--version Show specimen version
66
+ -h|--help You are looking at it
24
67
 
25
68
  All commands can be run with -h (or --help) for more information.
26
69
  ```
27
70
 
28
71
  ### specimen init
29
72
 
30
- ```shell
31
- ❯ specimen init -h
32
- Usage:
33
- specimen init --name=NAME [options] # Create a new specimen project which will generate following dirs and files
34
-
35
- * default directories /config, /lib, /tmp
36
- * default directories (/features/..) and files for cucumber unless --skip-cucumber
37
- * default directories (/spec/..) and files for RSpec unless --skip-rspec
38
- * root path files:
39
- * .gemrc
40
- * .gitignore
41
- * .rspec (unless --skip-rspec)
42
- * .rubocop.yml
43
- * cucumber.yml (unless --skip-cucumber)
44
- * Gemfile (based on the used options)
45
- * README.md
46
- * specimen.yml (default configuration file for the specimen gem
47
-
48
- Options:
49
- -n, [--name=NAME] # required: true
50
- The name of your project and installation path relative to your current PWD
51
-
52
- [--ui-driver=UI_DRIVER] # Default: 'watir'
53
- Valid options are:
54
- * watir
55
- * selenium
56
- * selenium-webdriver
57
-
58
- [--skip-ui] # Default: false
59
- Don´t add selenium or watir gem to your Gemfile
60
-
61
- [--skip-cucumber] # Default: false
62
- No cucumber gems will be added to your Gemfile.
63
- Creation of cucumber directories and files will be skipped.
64
-
65
- [--skip-rspec] # Default: false
66
- RSpec will still be in your Gemfile (as it´s matchers are used for cucumber)
67
- but no RSpec directories and files will be generated
68
- ```
73
+ TBD
69
74
 
70
75
  ### specimen cukes
71
76
 
@@ -75,10 +80,9 @@ TBD
75
80
 
76
81
  TBD
77
82
 
78
- ### specimen exec
79
-
80
- TBD
81
-
82
83
  ### Known issues
83
84
 
84
- - tests are missing
85
+ - tests are missing
86
+ - tests do not run in parallel (yet)
87
+ - documentation about allowed options in config-yml´s
88
+ - templates for docker, Selenium, Watir and Playwright
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2.alpha
1
+ 0.0.4.alpha
@@ -3,30 +3,60 @@
3
3
  module Specimen
4
4
  module Command
5
5
  class ExecCommandBuilder
6
- attr_reader :config
6
+ VALID_FRAMEWORKS = %w[cucumber rspec]
7
7
 
8
- def initialize(config:, framework: nil, tests_path: '')
9
- @framework = framework
10
- @config = config
11
- @tests_path = tests_path
8
+ attr_reader :profile_data, :framework, :command, :runtime
9
+
10
+ def self.build_exec_cmd!
11
+ new.build_cmd
12
+ end
13
+
14
+ def initialize
15
+ @runtime = Specimen.runtime
16
+ @profile_data = runtime.profile_data
17
+ @framework = runtime.framework
18
+ @command = runtime.command
19
+ @tests_path = command&.tests_path || ''
12
20
  end
13
21
 
14
22
  def build_cmd
15
- raise 'Undefined framework' if base_cmd.nil?
23
+ raise "Invalid framework '#{framework}'" unless VALID_FRAMEWORKS.include?(framework)
16
24
 
17
- "#{env_string} #{base_cmd} #{options_string} #{@tests_path}".strip
18
- end
25
+ cmd_str = ''.dup
26
+ cmd_str << env_string unless env_string.empty?
27
+ cmd_str << framework.dup.prepend(' ')
28
+ cmd_str << options_string.prepend(' ') unless options_string.empty?
29
+ cmd_str << tags_string.prepend(' ') unless tags_string.empty?
30
+ cmd_str << @tests_path.dup.prepend(' ') unless @tests_path.empty?
19
31
 
20
- def base_cmd
21
- config['framework'] || @framework
32
+ cmd_str.strip
22
33
  end
23
34
 
24
35
  def env_vars
25
- config['env'] || []
36
+ profile_data['env'] || []
26
37
  end
27
38
 
28
39
  def command_options
29
- config['options'] || []
40
+ profile_data['options'] || []
41
+ end
42
+
43
+ def profile_tags
44
+ profile_data['tags'] || []
45
+ end
46
+
47
+ def command_tags
48
+ command&.options[:tags] || []
49
+ end
50
+
51
+ def tags_string
52
+ str = ''.dup
53
+ all_tags = profile_tags.concat(command_tags)
54
+
55
+ return '' if all_tags.empty?
56
+
57
+ # '-t' option works for both Cucumber and RSpec
58
+ all_tags.each { |tag| str << "-t \"#{tag}\" " }
59
+ str.rstrip
30
60
  end
31
61
 
32
62
  def env_string
@@ -41,7 +71,5 @@ module Specimen
41
71
  command_options.map(&:to_s).join(' ')
42
72
  end
43
73
  end
44
-
45
-
46
74
  end
47
75
  end
@@ -3,24 +3,8 @@
3
3
  module Specimen
4
4
  module Command
5
5
  class CukesRunner < PathRunner
6
- no_commands do
7
- def perform
8
- super
9
-
10
- check_config_not_nil!
11
- inside runtime.work_dir do
12
- run(exec_cmd)
13
- end
14
- end
15
-
16
- def framework
17
- profile_config['framework'] || 'cucumber'
18
- end
19
-
20
- def profile_name
21
- profile? ? profile : 'cucumber'
22
- end
23
- end
6
+ class_option :specimen_config, aliases: %w[--sc], type: :string, default: 'specimen.cukes.yml'
7
+ class_option :specimen_profile, aliases: %w[--sp], type: :string, default: 'cucumber'
24
8
  end
25
9
  end
26
10
  end
@@ -3,23 +3,8 @@
3
3
  module Specimen
4
4
  module Command
5
5
  class SpecsRunner < PathRunner
6
- no_commands do
7
- def perform
8
- super
9
- check_config_not_nil!
10
- inside runtime.work_dir do
11
- run(exec_cmd)
12
- end
13
- end
14
-
15
- def framework
16
- profile_config['framework'] || 'rspec'
17
- end
18
-
19
- def profile_name
20
- profile? ? profile : 'rspec'
21
- end
22
- end
6
+ class_option :specimen_config, aliases: %w[--sc], type: :string, default: 'specimen.specs.yml'
7
+ class_option :specimen_profile, aliases: %w[--sp], type: :string, default: 'rspec'
23
8
  end
24
9
  end
25
10
  end
@@ -10,47 +10,41 @@ module Specimen
10
10
  end
11
11
  end
12
12
 
13
- class_option :config_file, aliases: %w[-C --config], type: :string, default: 'specimen.yml'
13
+ class_option :tags, aliases: ['-t'], type: :string, repeatable: true, default: []
14
+ class_option :debug, type: :boolean, default: false
15
+ class_option :verbose, type: :boolean, default: false
14
16
 
15
17
  no_commands do
16
18
  def perform
17
- runtime
18
- end
19
+ runtime.set_testrunner!(specimen_config, specimen_profile, self)
19
20
 
20
- def runtime
21
- return @runtime if @runtime
21
+ inside runtime.wd_path do
22
+ ENV['SPECIMEN_CONFIG_NAME'] = runtime.specimen_config
23
+ ENV['SPECIMEN_PROFILE_NAME'] = runtime.specimen_profile
22
24
 
23
- runtime = Runtime.start!(self)
24
- Specimen.runtime = runtime
25
- @runtime = runtime
26
- end
25
+ ENV['DEBUG'] = 'true' if options[:debug]
26
+ ENV['VERBOSE'] = 'true' if options[:verbose]
27
27
 
28
- def framework
29
- nil
30
- end
28
+ @success = run(exec_cmd)
29
+ end
31
30
 
32
- def profile
33
- options[:profile]
31
+ @success == true ? exit(0) : exit(1)
34
32
  end
35
33
 
36
- def profile?
37
- !profile.nil?
34
+ def runtime
35
+ Specimen.runtime
38
36
  end
39
37
 
40
- def profile_config
41
- runtime.profile_yml_data(profile_name)
38
+ def specimen_config
39
+ options[:specimen_config]
42
40
  end
43
41
 
44
- def profile_name
45
- profile? ? profile : nil
42
+ def specimen_profile
43
+ options[:specimen_profile]
46
44
  end
47
45
 
48
46
  def exec_cmd
49
- ExecCommandBuilder.new(config: profile_config, framework:, tests_path:).build_cmd
50
- end
51
-
52
- def check_config_not_nil!
53
- raise ProfileDataNilError.new(profile_name, runtime.yml_name) if profile? && profile_config.nil?
47
+ ExecCommandBuilder.build_exec_cmd!
54
48
  end
55
49
  end
56
50
  end
@@ -3,19 +3,16 @@
3
3
  require 'colorize'
4
4
  require 'thor'
5
5
 
6
- require 'pry'
7
-
8
6
  require 'specimen/command/base'
9
7
  require 'specimen/command/base_group'
10
8
  require 'specimen/command/test_runner'
11
9
  require 'specimen/command/exec_command_builder'
12
10
  require 'specimen/command/runner/path_runner'
13
11
  require 'specimen/command/runner/cukes_runner'
14
- require 'specimen/command/runner/exec_runner'
15
12
  require 'specimen/command/runner/specs_runner'
16
13
 
17
14
  require 'specimen/commands/cukes/cukes_command'
18
- require 'specimen/commands/exec/exec_command'
15
+ require 'specimen/commands/encrypted_configuration/encrypted_configuration_command'
19
16
  require 'specimen/commands/gem_help/gem_help_command'
20
17
  require 'specimen/commands/init/init_command'
21
18
  require 'specimen/commands/specs/specs_command'
@@ -29,7 +26,7 @@ module Specimen
29
26
  autoload :Base
30
27
  autoload :BaseGroup
31
28
 
32
- COMMAND_MAPPINGS = %w[cukes exec init specs generate test].to_set
29
+ COMMAND_MAPPINGS = %w[cukes enc init specs generate].to_set
33
30
  HELP_MAPPINGS = %w[-h -? --help].to_set
34
31
  VERSION_MAPPINGS = %w[-v --version].to_set
35
32
 
@@ -65,7 +62,7 @@ module Specimen
65
62
 
66
63
  if exec_config[:verbose]
67
64
  shell.say(e.class.to_s.red.bold)
68
- shell.say(e.backtrace&.join("\n").red)
65
+ shell.say(e.backtrace.join("\n").red)
69
66
  end
70
67
 
71
68
  exit_specimen_failed
@@ -116,7 +113,7 @@ module Specimen
116
113
  def command
117
114
  @command ||= {
118
115
  cukes: CukesCommand,
119
- exec: ExecCommand,
116
+ enc: EncryptedConfigurationCommand,
120
117
  gem_help: GemHelpCommand,
121
118
  init: InitCommand,
122
119
  specs: SpecsCommand
@@ -180,6 +177,14 @@ module Specimen
180
177
  VERSION_MAPPINGS.include?(command_arg)
181
178
  end
182
179
 
180
+ def base_command?
181
+ command.ancestors.include?(Specimen::Command::Base)
182
+ end
183
+
184
+ def base_group_command?
185
+ command.ancestors.include?(Specimen::Command::BaseGroup)
186
+ end
187
+
183
188
  private
184
189
 
185
190
  def shell
@@ -0,0 +1,37 @@
1
+ Usage:
2
+ specimen enc
3
+
4
+ Commands:
5
+ specimen enc create # create a new encrypted configuration
6
+ specimen enc update # update an existing encrypted configuration
7
+ specimen enc validate # validates if encrypted configuration is YAML conform
8
+ specimen enc -h|--help # You are looking at it
9
+
10
+ Options:
11
+ -n, [--name=NAME] # required: true
12
+ The name of the encrypted config.
13
+
14
+ Examples:
15
+
16
+ # create/update/validate config/enc/example.yml.enc
17
+ $ specimen enc create/update/validate --name example
18
+
19
+ # create/update/validate config/enc/foobar/example.yml.enc
20
+ $ specimen enc create/update/validate --name foobar/example
21
+
22
+ -e, [--editor=EDITOR] # default: 'vi'
23
+ Is only used with the update command
24
+
25
+ If you have the variable EDITOR set on your shell, it will override the
26
+ default editor 'vi'
27
+
28
+ Examples:
29
+
30
+ # Uses EDITOR variable if set, otherwise 'vi' is used
31
+ $ specimen update --name example
32
+
33
+ # Uses 'nano' as EDITOR
34
+ $ EDITOR='nano' specimen update --name example
35
+
36
+ # Uses 'nano' as EDITOR
37
+ $ specimen update --name example --editor nano
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'specimen/utils'
4
+
5
+ module Specimen
6
+ module Command
7
+ class EncryptedConfigurationCommand < Base
8
+ class RequiredOptionError < StandardError
9
+ def initialize
10
+ @msg = "Please provide required option '--name'!"
11
+ super(@msg)
12
+ end
13
+ end
14
+
15
+ class OptionNameError < StandardError
16
+ def initialize
17
+ @msg = "Option '--name' can not be empty or equal 'name'!"
18
+ super(@msg)
19
+ end
20
+ end
21
+
22
+ class ExistingConfigFilesError < StandardError; end
23
+ class NoSuchConfigError < StandardError; end
24
+ class MissingKeyFileError < StandardError; end
25
+
26
+ include Utils
27
+
28
+ def self.source_root
29
+ File.dirname(__FILE__)
30
+ end
31
+
32
+ class_option :name, aliases: %w[-n], type: :string
33
+ class_option :editor, aliases: %w[-e], type: :string, default: 'vi'
34
+
35
+ desc 'create', 'create'
36
+
37
+ def create
38
+ encrypted_config = EncryptedConfiguration.create(name:)
39
+
40
+ say(gen_message(encrypted_config).green.bold)
41
+ say("\n NEVER COMMIT/PUBLISH '*.key' files to your repository !!!\n".bold)
42
+ end
43
+
44
+ desc 'update', 'update'
45
+
46
+ def update
47
+ ENV['EDITOR'] = ENV.fetch('EDITOR', options[:editor])
48
+ EncryptedConfiguration.update(name:)
49
+
50
+ say("Updated encrypted config '#{name}.yml.enc'".green)
51
+ end
52
+
53
+ desc 'validate', 'validate'
54
+
55
+ def validate
56
+ result = EncryptedConfiguration.validate(name:)
57
+
58
+ say("Config '#{name}.yml.enc' validated and ready to use".green) if result.is_a?(EncryptedConfigPath)
59
+ return if result.is_a?(EncryptedConfigPath)
60
+
61
+ say("#{result.class}\n #{result.message}".red)
62
+ say('Please fix the yml syntax errors before you proceed'.bold)
63
+ end
64
+
65
+ no_commands do
66
+ def perform
67
+ run_args_check!
68
+ run_options_checks!
69
+
70
+ send(task_arg)
71
+ end
72
+
73
+ def name
74
+ options[:name]
75
+ end
76
+
77
+ def task_arg
78
+ args.first
79
+ end
80
+
81
+ def task?
82
+ respond_to?(task_arg)
83
+ end
84
+
85
+ def run_args_check!
86
+ return if task?
87
+
88
+ raise "No such command: '#{task_arg}'. Either use 'specimen enc create' or 'specimen enc update'"
89
+ end
90
+
91
+ def run_options_checks!
92
+ raise RequiredOptionError if options[:name].nil?
93
+ raise RequiredOptionError if options[:name].empty?
94
+ raise OptionNameError if options[:name] == 'name'
95
+ end
96
+
97
+ def gen_message(enc_path)
98
+ <<~STRING
99
+ Generated new encrypted configuration: '#{enc_path.name}.yml.enc'
100
+
101
+ encrypted-config-path: #{enc_path.full_enc_path.to_path}
102
+ encryption-key-path: #{enc_path.full_key_path.to_path}
103
+ STRING
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -4,8 +4,11 @@ Usage:
4
4
  You must specify a command:
5
5
 
6
6
  init Initialize a new specimen project
7
- cukes Run Cucumber tests (WIP)
8
- specs Run RSpec tests (WIP)
9
- exec Run tests via a config file (WIP)
7
+ cukes Run Cucumber tests
8
+ specs Run RSpec tests
9
+ enc Create or update encrypted configurations
10
+
11
+ -v|--version Show specimen version
12
+ -h|--help You are looking at it
10
13
 
11
14
  All commands can be run with -h (or --help) for more information.
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Specimen
4
+ class ConfigParser
5
+ class YmlERBError < StandardError; end
6
+
7
+ def self.read!(file)
8
+ new(file).yml_load!
9
+ end
10
+
11
+ def initialize(file)
12
+ @file = file
13
+ end
14
+
15
+ def yml_load!
16
+ YAML.safe_load(erb_content, aliases: true)
17
+ end
18
+
19
+ private
20
+
21
+ def content
22
+ File.read(@file)
23
+ end
24
+
25
+ def erb_content
26
+ ERB.new(content, trim_mode: '%').result(binding)
27
+ rescue StandardError
28
+ raise YmlERBError, "#{@file} could not be parsed with ERB!"
29
+ end
30
+ end
31
+ end
@@ -11,7 +11,7 @@ module Specimen
11
11
  end
12
12
 
13
13
  GEM_LIST = %w[
14
- activesupport dotenv ffaker rest-client thor uuid
14
+ specimen ffaker rest-client uuid
15
15
  cucumber cuke_modeler parallel_tests rspec
16
16
  selenium-webdriver watir
17
17
  debug pry rubocop
@@ -35,7 +35,7 @@ module Specimen
35
35
  def config
36
36
  @config ||= {
37
37
  project_name: project_name,
38
- root_path: "#{Specimen.init_wd_path.to_path}/#{project_name}",
38
+ root_path: "#{Specimen.runtime.wd_path.to_path}/#{project_name}",
39
39
  gems: project_gems,
40
40
  skip_ui: skip_ui?,
41
41
  cucumber: !skip_cucumber?,
@@ -7,8 +7,10 @@ module Specimen
7
7
  TEMPLATES_DIR = 'cucumber/templates'
8
8
  TEMPLATES = %w[
9
9
  features/examples/add_numbers.feature
10
+ features/step_definitions/examples/example_steps.rb
10
11
  features/support/env.rb
11
12
  config/cucumber.yml
13
+ config/specimen.cukes.yml
12
14
  ].freeze
13
15
 
14
16
  def execute!
@@ -1 +1,4 @@
1
- default: --require features/support/env.rb
1
+ default: --profile entry_point --profile step_definitions
2
+
3
+ entry_point: --require features/support/env.rb
4
+ step_definitions: --require features/step_definitions
@@ -0,0 +1,22 @@
1
+ default_opts: &default_opts
2
+ - --publish-quiet
3
+ - --format pretty
4
+ - --format html --out tmp/cucumber_result.html
5
+
6
+ cucumber: &cucumber
7
+ profiles: []
8
+ options: *default_opts
9
+
10
+ examples:
11
+ <<: *cucumber
12
+ env_file: .example.env
13
+ enc_configs:
14
+ - name: example
15
+ env_key: MASTER_KEY
16
+
17
+ ci_cukes:
18
+ <<: *cucumber
19
+ env:
20
+ - CI='1'
21
+ profiles:
22
+ - regression
@@ -1,9 +1,11 @@
1
1
  Feature: Add numbers example feature
2
2
 
3
+ @pass
3
4
  Scenario:
4
5
  Given I add 1 and 1
5
6
  Then the result should be 2
6
7
 
8
+ @fail
7
9
  Scenario:
8
- Given I add 1 and 3
9
- Then the result should be 3
10
+ Given I add 1 and 1
11
+ Then the result should be 3