teuton 2.3.1 → 2.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbe8ad9c5430dd71ef38f136d6066965d6531b1e68e23f35cbc9b3ec31730690
4
- data.tar.gz: a0798325031d92db0e66e71152c9cbd20d776d043870067a6d79deda9d6930af
3
+ metadata.gz: 3bc9ff84fbd532b614173964e8de446a11e8126f324f4565a3d2e095ea7fd83d
4
+ data.tar.gz: dd2b0093dc4a36b1892678ae2ed05fe4611a978c506ca01215bd9e12b7a346fb
5
5
  SHA512:
6
- metadata.gz: 8a069613b2e5a73282f5eeb61c67f388f1d8c44a2dd785e7a1c44d760e31346db0868a1df8b2aa13b95d5bad0f36a9b64ec46566d61790e25993f625a9bcd7ed
7
- data.tar.gz: 7a7ef4a74dec5fb9ece8ad77714d9a4a3b76d810d2d173b95e7351513175af161bf19e22016167480ccc96307010a4fee7476d1885af458121cf6d20fbae00b8
6
+ metadata.gz: 6147fad14f2aa47b31fc66bc17fdb78db0f9387a9dfea6dee0fb20f89ed2c48b729943bd7bae06155db8234d897b78987c184e936708d4fcdda185d11fcf8ce9
7
+ data.tar.gz: '0949e0ed282c7faa26c590539c2dad96e9adfe1724709478004b4ae742ed2d2822f5768ef709a8df6ba7cf89823dd0177fd23cb805f0517595017bdd614bcc8a'
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  [![Gem Version](https://badge.fury.io/rb/teuton.svg)](https://badge.fury.io/rb/teuton)
3
3
  ![GitHub](https://img.shields.io/github/license/dvarrui/teuton)
4
- ![Gem](https://img.shields.io/gem/dv/teuton/2.3.0)
4
+ ![Gem](https://img.shields.io/gem/dv/teuton/2.3.1)
5
5
 
6
6
  # TEUTON
7
7
 
@@ -23,7 +23,7 @@ Teuton allow us:
23
23
 
24
24
  * [Installation](https://github.com/teuton-software/teuton/tree/master/docs/install/README.md)
25
25
  1. Install Ruby on your system.
26
- 1. `gem install teuton`, to install Teuton.
26
+ 1. Install Teuton with `gem install teuton`.
27
27
  * [Videos, blogs, news](docs/videos.md)
28
28
  * [Learning](docs/learn/README.md)
29
29
  * [Commands](docs/commands/README.md)
data/docs/learn/README.md CHANGED
@@ -17,8 +17,11 @@ Learn how to use Teuton language to write your own tests:
17
17
  - [Example 07 - Log](example-07-log.md)
18
18
  - [Example 08 - Readme](example-08-readme.md)
19
19
  - [Example 09 - Preserve](example-09-preserve.md)
20
- - Example 10 - Macros
21
- - Example 11 - Alias
20
+ - Example 10 - Result and Moodle
21
+ - Example 11 - Get vars
22
+ - Example 12 - Include
23
+ - Example 13 - Alias
24
+ - Example 14 - Macros
22
25
  - [Videos](videos.md)
23
26
 
24
27
  # Examples
@@ -78,7 +78,6 @@ CASES
78
78
  | 02 | Student-name-2 | 0 | ? |
79
79
  +------+----------------+-------+-------+
80
80
 
81
-
82
81
  RESULTS
83
82
  +-------------+---------------------------+
84
83
  | start_time | 2020-10-10 12:37:54 +0100 |
@@ -22,15 +22,10 @@ class Application
22
22
  attr_accessor :hall_of_fame
23
23
  attr_accessor :project_path, :script_path, :config_path, :test_name
24
24
 
25
- ##
26
- # Initialize Application instance
27
25
  def initialize
28
26
  reset
29
27
  end
30
28
 
31
- ##
32
- # Reset param values
33
- # rubocop:disable Metrics/MethodLength
34
29
  def reset
35
30
  @letter = { good: '.', bad: 'F', error: '?', none: ' ' }
36
31
  @running_basedir = Dir.getwd
@@ -46,25 +41,15 @@ class Application
46
41
  @uses = [] # TODO
47
42
  @hall_of_fame = []
48
43
  end
49
- # rubocop:enable Metrics/MethodLength
50
44
 
51
- ##
52
- # Return debug param
53
- # @return Boolean
54
45
  def debug
55
46
  @default[:debug]
56
47
  end
57
48
 
58
- ##
59
- # Return name param
60
- # @return String
61
49
  def name
62
50
  @default[:name]
63
51
  end
64
52
 
65
- ##
66
- # Return quiet param
67
- # @return Boolean
68
53
  def quiet?
69
54
  return true if Application.instance.options['quiet']
70
55
  return true unless Application.instance.verbose
@@ -76,7 +61,6 @@ class Application
76
61
  # Preprocess input options:
77
62
  # * Convert input case options String to an Array of integers
78
63
  # * Read color input option
79
- # rubocop:disable Metrics/AbcSize
80
64
  def add_input_params(projectpath, options)
81
65
  @options.merge! options
82
66
  NameFileFinder.find_filenames_for(projectpath)
@@ -89,5 +73,4 @@ class Application
89
73
  a = @options['case'].split(',')
90
74
  @options['case'] = a.collect!(&:to_i)
91
75
  end
92
- # rubocop:enable Metrics/AbcSize
93
76
  end
@@ -16,15 +16,16 @@ class Case
16
16
  end
17
17
  # TODO: Delete old reports???
18
18
  start_time = Time.now
19
- play_in_sequence if get(:tt_sequence) == true # Play in sequence
20
- play_in_parallel if get(:tt_sequence) != true # Play in parallel
19
+ if get(:tt_sequence) == true
20
+ play_in_sequence
21
+ else
22
+ play_in_parallel
23
+ end
21
24
  fill_report(start_time, Time.now)
22
25
  close_opened_sessions
23
26
  end
24
27
  alias start play
25
28
 
26
- ##
27
- # Close opened sessions for this case
28
29
  def close_opened_sessions
29
30
  @sessions.each_value do |s|
30
31
  s.close if s.class == Net::SSH::Connection::Session
@@ -46,9 +47,9 @@ class Case
46
47
  ##
47
48
  # Execute every play#group in sequence
48
49
  def play_in_sequence
49
- verboseln "Starting case <#{@config.get(:tt_members)}>"
50
+ verboseln "Starting case [#{@config.get(:tt_members)}]"
50
51
  @groups.each do |t|
51
- verbose "* Processing <#{t[:name]}> "
52
+ verbose "* Processing [#{t[:name]}] "
52
53
  @action[:groupname] = t[:name]
53
54
  instance_eval(&t[:block])
54
55
  verbose "\n"
@@ -58,7 +59,6 @@ class Case
58
59
 
59
60
  ##
60
61
  # Fill case report with time information
61
- # rubocop:disable Metrics/AbcSize
62
62
  def fill_report(start_time, finish_time)
63
63
  @report.head.merge! @config.global
64
64
  @report.head.merge! @config.local
@@ -68,5 +68,4 @@ class Case
68
68
  @report.tail[:finish_time] = finish_time
69
69
  @report.tail[:duration] = finish_time - start_time
70
70
  end
71
- # rubocop:enable Metrics/AbcSize
72
71
  end
@@ -69,7 +69,8 @@ class Case
69
69
  ip = @config.get("#{hostname}_ip".to_sym).to_s
70
70
  username = @config.get("#{hostname}_username".to_sym).to_s
71
71
  password = @config.get("#{hostname}_password".to_sym).to_s
72
- port = @config.get("#{hostname}_port".to_sym).to_i || 22
72
+ port = @config.get("#{hostname}_port".to_sym).to_i
73
+ port = 22 if port.zero?
73
74
 
74
75
  unless @config.get("#{hostname}_route".to_sym) == 'NODATA'
75
76
  # Reconfigure command with gateway. Example host1_route: IP.
@@ -39,12 +39,12 @@ class CaseManager
39
39
  # Run all cases
40
40
  def run_all_cases
41
41
  start_time = Time.now
42
- if Application.instance.global[:tt_sequence]
43
- verboseln Rainbow("[INFO] Running in sequence (#{start_time})").yellow.bright
42
+ if Application.instance.global[:tt_sequence] == true
43
+ verboseln Rainbow("==> Teuton: Running in sequence (#{start_time})").yellow.bright
44
44
  # Run every case in sequence
45
45
  @cases.each(&:play)
46
46
  else
47
- verboseln Rainbow("[INFO] Running in parallel (#{start_time})").yellow.bright
47
+ verboseln Rainbow("==> Teuton: Running in parallel (#{start_time})").yellow.bright
48
48
  threads = []
49
49
  # Run all cases in parallel
50
50
  @cases.each { |c| threads << Thread.new { c.play } }
@@ -78,7 +78,6 @@ class CaseManager
78
78
  @cases.each { |c| threads << Thread.new { c.close uniques } }
79
79
  threads.each(&:join)
80
80
 
81
- # Build Hall of Fame
82
81
  build_hall_of_fame
83
82
  end
84
83
  end
@@ -1,4 +1,3 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require_relative 'check_cases'
4
3
  require_relative 'hall_of_fame'
@@ -12,17 +12,13 @@ class CaseManager
12
12
  def open_main_report(config_filepath)
13
13
  app = Application.instance
14
14
 
15
- @report.head[:tt_title] = "Executing [#{app.name}] (version #{Application::VERSION})"
15
+ @report.head[:tt_title] = "Teuton (#{Teuton::VERSION})"
16
16
  @report.head[:tt_scriptname] = trim(app.script_path)
17
17
  @report.head[:tt_configfile] = trim(config_filepath)
18
18
  @report.head[:tt_pwd] = app.running_basedir
19
19
  @report.head[:tt_debug] = true if @debug
20
20
  # @report.head[:tt_uses] = app.uses.join(', ') # TO-REVISE
21
21
  @report.head.merge!(app.global)
22
-
23
- verboseln ' '
24
- verboseln '=' * @report.head[:tt_title].length
25
- verboseln Rainbow(@report.head[:tt_title]).yellow.bright
26
22
  end
27
23
 
28
24
  def close_main_report(start_time)
@@ -31,9 +27,8 @@ class CaseManager
31
27
  @report.tail[:finish_time] = finish_time
32
28
  @report.tail[:duration] = finish_time - start_time
33
29
 
34
- verbose Rainbow("\n[INFO] Duration = #{format('%3.3f',(finish_time - start_time))}").yellow.bright
35
- verboseln Rainbow(" (#{finish_time})").yellow.bright
36
- verboseln '=' * @report.head[:tt_title].length
30
+ verbose Rainbow("\n==> Teuton: Duration=#{format('%3.3f',(finish_time - start_time))}").yellow.bright
31
+ verboseln Rainbow(" (#{finish_time})").yellow.bright
37
32
  verboseln ' '
38
33
 
39
34
  app = Application.instance
@@ -1,5 +1,5 @@
1
1
  ---
2
- :global:
3
- :cases:
4
- - :tt_members: MEMBERS
5
- :tt_moodle_id: MOODLE_ID
2
+ global:
3
+ cases:
4
+ - tt_members: MEMBERS
5
+ tt_moodle_id: MOODLE_ID
@@ -1,9 +1,9 @@
1
1
 
2
2
  group "GROUP NAME" do
3
3
 
4
- target "TARGET-1 DESCRIPTION"
5
- run "COMMAND-1"
6
- expect "TEXT-1"
4
+ target "TARGET.1 DESCRIPTION"
5
+ run "COMMAND.1"
6
+ expect "TEXT.1"
7
7
 
8
8
  end
9
9
 
@@ -1,4 +1,3 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require 'yaml'
4
3
  require 'json/pure'
@@ -29,9 +28,6 @@ module ConfigFileReader
29
28
  # Read YAML config file
30
29
  # @param filepath (String) Path to YAML config file
31
30
  # @return Hash with config data
32
- # rubocop:disable Metrics/MethodLength
33
- # rubocop:disable Metrics/AbcSize
34
- # rubocop:disable Security/YAMLLoad
35
31
  def self.read_yaml(filepath)
36
32
  begin
37
33
  data = YAML.load(File.open(filepath))
@@ -49,9 +45,6 @@ module ConfigFileReader
49
45
  read_included_files!(filepath, data)
50
46
  data
51
47
  end
52
- # rubocop:enable Metrics/MethodLength
53
- # rubocop:enable Metrics/AbcSize
54
- # rubocop:enable Security/YAMLLoad
55
48
 
56
49
  ##
57
50
  # Read JSON config file
@@ -71,7 +64,6 @@ module ConfigFileReader
71
64
  # Read all configuration files from "filepath" folder.
72
65
  # @param filepath (String) Folder with config files
73
66
  # @param data (Hash) Input configuration
74
- # rubocop:disable Security/YAMLLoad
75
67
  private_class_method def self.read_included_files!(filepath, data)
76
68
  return if data[:global][:tt_include].nil?
77
69
 
@@ -94,10 +86,7 @@ module ConfigFileReader
94
86
  end
95
87
  }
96
88
  end
97
- # rubocop:enable Security/YAMLLoad
98
89
 
99
- # rubocop:disable Metrics/MethodLength
100
- # rubocop:disable Metrics/AbcSize
101
90
  private_class_method def self.convert_string_keys_to_symbol(input)
102
91
  return input if input.class != Hash
103
92
 
@@ -116,6 +105,4 @@ module ConfigFileReader
116
105
  end
117
106
  output
118
107
  end
119
- # rubocop:enable Metrics/MethodLength
120
- # rubocop:enable Metrics/AbcSize
121
108
  end
@@ -1,4 +1,3 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require 'rainbow'
4
3
  require_relative '../application'
@@ -29,8 +28,6 @@ module NameFileFinder
29
28
  ##
30
29
  # Find project filenames from input folder path
31
30
  # @param folder_path (String)
32
- # rubocop:disable Metrics/AbcSize
33
- # rubocop:disable Metrics/MethodLength
34
31
  def self.find_filenames_from_directory(folder_path)
35
32
  # COMPLEX MODE: We use start.rb as main RB file
36
33
  script_path = File.join(folder_path, 'start.rb')
@@ -48,15 +45,10 @@ module NameFileFinder
48
45
 
49
46
  find_configfilename_from_directory(folder_path)
50
47
  end
51
- # rubocop:enable Metrics/AbcSize
52
- # rubocop:enable Metrics/MethodLength
53
48
 
54
49
  ##
55
50
  # Find project config filename from input folder path
56
51
  # @param folder_path (String)
57
- # rubocop:disable Metrics/AbcSize
58
- # rubocop:disable Metrics/MethodLength
59
- # rubocop:disable Style/IfUnlessModifier
60
52
  def self.find_configfilename_from_directory(folder_path)
61
53
  # COMPLEX MODE: We use config.yaml by default
62
54
  app = Application.instance
@@ -76,12 +68,7 @@ module NameFileFinder
76
68
  end
77
69
  app.config_path = config_path
78
70
  end
79
- # rubocop:enable Metrics/AbcSize
80
- # rubocop:enable Metrics/MethodLength
81
- # rubocop:enable Style/IfUnlessModifier
82
71
 
83
- # rubocop:disable Metrics/AbcSize
84
- # rubocop:disable Metrics/MethodLength
85
72
  def self.find_filenames_from_rb(script_path)
86
73
  # SIMPLE MODE: We use script_path as main RB file
87
74
  # This must be fullpath to DSL script file
@@ -99,12 +86,7 @@ module NameFileFinder
99
86
 
100
87
  find_configfilenames_from_rb(script_path)
101
88
  end
102
- # rubocop:enable Metrics/AbcSize
103
- # rubocop:enable Metrics/MethodLength
104
89
 
105
- # rubocop:disable Metrics/MethodLength
106
- # rubocop:disable Metrics/AbcSize
107
- # rubocop:disable Style/IfUnlessModifier
108
90
  def self.find_configfilenames_from_rb(script_path)
109
91
  # SIMPLE MODE: We use script_path as main RB file
110
92
  # This must be fullpath to DSL script file
@@ -126,33 +108,6 @@ module NameFileFinder
126
108
  end
127
109
  app.config_path = config_path
128
110
  end
129
- # rubocop:enable Metrics/MethodLength
130
- # rubocop:enable Metrics/AbcSize
131
- # rubocop:enable Style/IfUnlessModifier
132
-
133
- # def self.puts_input_info_on_screen
134
- # app = Application.instance
135
- #
136
- # verbose Rainbow('[INFO] ScriptPath => ').blue
137
- # verboseln Rainbow(trim(app.script_path)).blue.bright
138
- # verbose Rainbow('[INFO] ConfigPath => ').blue
139
- # verboseln Rainbow(trim(app.config_path)).blue.bright
140
- # verbose Rainbow('[INFO] Pwd => ').blue
141
- # verboseln Rainbow(app.running_basedir).blue.bright
142
- # verbose Rainbow('[INFO] TestName => ').blue
143
- # verboseln Rainbow(trim(app.test_name)).blue.bright
144
- # end
145
-
146
- ##
147
- # Trim string text when is too long
148
- # def self.trim(input)
149
- # return input unless input.to_s.start_with? Dir.pwd.to_s
150
- #
151
- # output = input.to_s
152
- # offset = (Dir.pwd).length + 1
153
- # output = "#{input[offset, input.size]}"
154
- # output.to_s
155
- # end
156
111
 
157
112
  def self.verboseln(text)
158
113
  verbose(text + "\n")
@@ -1,7 +1,6 @@
1
1
 
2
2
  require_relative '../application'
3
3
 
4
- # Define general use methods
5
4
  module Verbose
6
5
  def verboseln(text)
7
6
  verbose(text + "\n")
@@ -9,7 +8,7 @@ module Verbose
9
8
 
10
9
  def verbose(text)
11
10
  return if Application.instance.quiet?
12
-
11
+
13
12
  print text
14
13
  end
15
14
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Teuton
3
- VERSION = '2.3.1'
3
+ VERSION = '2.3.4'
4
4
  APPNAME = 'teuton'
5
5
  GEMNAME = 'teuton'
6
6
  DOCKERNAME = "dvarrui/#{GEMNAME}"
data/lib/teuton.rb CHANGED
@@ -1,4 +1,3 @@
1
- # frozen_string_literal: true
2
1
 
3
2
  require_relative 'teuton/application'
4
3
  require_relative 'teuton/skeleton'
@@ -8,18 +7,13 @@ module Teuton
8
7
  Skeleton.create(path_to_new_dir)
9
8
  end
10
9
 
11
- # Run test
12
- # @param projectpath (String) Path to teuton test
13
- # @param options (Array) Array of input options
14
10
  def self.run(projectpath, options = {})
15
11
  Application.instance.add_input_params(projectpath, options)
16
12
  require_dsl_and_script('teuton/case_manager/dsl') # Define DSL keywords
17
13
  end
18
14
 
19
- # Create Readme file for a test
20
- # @param projectpath (String) Path to teuton test
21
- # @param options (Array) Array of input options
22
15
  def self.readme(projectpath, options = {})
16
+ # Create Readme file for a test
23
17
  Application.instance.add_input_params(projectpath, options)
24
18
  require_dsl_and_script('teuton/readme/readme') # Define DSL keywords
25
19
 
@@ -28,9 +22,6 @@ module Teuton
28
22
  readme.show
29
23
  end
30
24
 
31
- # Check teuton test syntax
32
- # @param projectpath (String) Path to teuton test
33
- # @param options (Array) Array of input options
34
25
  def self.check(projectpath, options = {})
35
26
  Application.instance.add_input_params(projectpath, options)
36
27
  require_dsl_and_script('teuton/check/laboratory') # Define DSL keywords
@@ -48,7 +39,7 @@ module Teuton
48
39
  require_relative app.script_path
49
40
  rescue SyntaxError => e
50
41
  puts e.to_s
51
- puts Rainbow.new("[ FAIL ] SyntaxError into file #{app.script_path}").red
42
+ puts Rainbow.new("==> [FAIL] SyntaxError into file #{app.script_path}").red
52
43
  end
53
44
  end
54
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teuton
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-28 00:00:00.000000000 Z
11
+ date: 2022-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize