teuton 2.1.11 → 2.3.2

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -12
  3. data/bin/check_teuton +0 -2
  4. data/docs/changelog/ideas.md +132 -0
  5. data/docs/changelog/v2.1.md +14 -122
  6. data/docs/changelog/v2.2.md +52 -28
  7. data/docs/changelog/version2.1.md +4 -0
  8. data/docs/commands/README.md +58 -15
  9. data/docs/commands/example_check.md +0 -4
  10. data/docs/commands/example_run.md +0 -4
  11. data/docs/dsl/README.md +1 -1
  12. data/docs/dsl/definition/result.md +1 -0
  13. data/docs/dsl/definition/run_remote.md +12 -6
  14. data/docs/dsl/definition/target.md +9 -10
  15. data/docs/install/README.md +13 -18
  16. data/docs/install/vagrant_docker.md +1 -1
  17. data/docs/learn/README.md +11 -8
  18. data/docs/learn/example-01-target.md +25 -25
  19. data/docs/learn/example-02-config.md +38 -49
  20. data/docs/learn/example-03-remote-hosts.md +22 -22
  21. data/docs/learn/{example-11-first-test.md → example-04-new-test.md} +23 -24
  22. data/docs/learn/{example-04-use.md → example-05-use.md} +6 -6
  23. data/docs/learn/{example-05-debug.md → example-06-debug.md} +8 -8
  24. data/docs/learn/{example-06-log.md → example-07-log.md} +7 -7
  25. data/docs/learn/{example-07-readme.md → example-08-readme.md} +10 -10
  26. data/docs/learn/{example-08-preserve.md → example-09-preserve.md} +6 -6
  27. data/docs/videos.md +19 -0
  28. data/lib/teuton/application.rb +22 -3
  29. data/lib/teuton/case_manager/case/dsl/goto.rb +2 -2
  30. data/lib/teuton/case_manager/case/dsl/macro.rb +1 -0
  31. data/lib/teuton/case_manager/case/dsl/send.rb +2 -1
  32. data/lib/teuton/case_manager/case/play.rb +2 -0
  33. data/lib/teuton/case_manager/case/result/ext_compare.rb +16 -0
  34. data/lib/teuton/case_manager/case/result/result.rb +1 -1
  35. data/lib/teuton/case_manager/case/runner.rb +31 -4
  36. data/lib/teuton/case_manager/case_manager.rb +1 -1
  37. data/lib/teuton/case_manager/export_manager.rb +21 -11
  38. data/lib/teuton/case_manager/utils.rb +1 -1
  39. data/lib/teuton/{project/laboratory → check}/builtin.rb +0 -0
  40. data/lib/teuton/{project/laboratory → check}/dsl.rb +40 -28
  41. data/lib/teuton/{project/laboratory → check}/laboratory.rb +3 -8
  42. data/lib/teuton/{project/laboratory → check}/show.rb +53 -59
  43. data/lib/teuton/cli.rb +85 -14
  44. data/lib/teuton/{project/readme → readme}/dsl.rb +0 -0
  45. data/lib/teuton/{project/readme → readme}/lang.rb +1 -1
  46. data/lib/teuton/{project/readme → readme}/readme.rb +22 -18
  47. data/lib/teuton/report/formatter/array_formatter.rb +13 -1
  48. data/lib/teuton/report/formatter/base_formatter.rb +18 -5
  49. data/lib/teuton/{project/skeleton.rb → skeleton.rb} +7 -19
  50. data/lib/teuton/utils/configfile_reader.rb +121 -0
  51. data/lib/teuton/{project → utils}/name_file_finder.rb +46 -26
  52. data/lib/teuton/version.rb +8 -0
  53. data/lib/teuton.rb +30 -32
  54. metadata +107 -65
  55. data/lib/teuton/cli/check.rb +0 -38
  56. data/lib/teuton/cli/main.rb +0 -6
  57. data/lib/teuton/cli/play.rb +0 -38
  58. data/lib/teuton/cli/readme.rb +0 -26
  59. data/lib/teuton/cli/version.rb +0 -12
  60. data/lib/teuton/files/gitignore +0 -2
  61. data/lib/teuton/project/configfile_reader.rb +0 -49
  62. data/lib/teuton/project/project.rb +0 -80
@@ -1,21 +1,21 @@
1
1
  [<< back](README.md)
2
2
 
3
- 1. [Definition section](#definition-section)
4
- 2. [Execute command](#execute-command)
5
- 3. [Result](#result)
6
-
7
3
  # Example: learn-07-readme
8
4
 
5
+ > This example is on GitHub repository at `examples/learn-08-readme/`.
6
+
9
7
  Create README files (with test instructions) from our test definition.
10
8
 
11
- > This example is on GitHub repository at `examples/learn-07-readme/`.
9
+ 1. [Definition section](#definition-section)
10
+ 2. [Execute command](#execute-command)
11
+ 3. [Result](#result)
12
12
 
13
13
  ## Definition section
14
14
 
15
15
  Take a look at our test definition section (Group):
16
16
  ```ruby
17
17
  group "Customize readme output" do
18
- readme "This is our example 07."
18
+ readme "This is our README example."
19
19
  readme "And here we'll see how to use readme keyword"
20
20
 
21
21
  target "Create user david."
@@ -37,19 +37,19 @@ There exists some `readme` instructions after `group` and `target` lines.
37
37
  To generate automatically a README file from previous test, execute this:
38
38
 
39
39
  ```
40
- teuton readme example/learn-07-readme > example/learn-07-readme/README.md
40
+ teuton readme example/learn-08-readme > example/learn-08-readme/README.md
41
41
  ```
42
42
 
43
43
  ## Result
44
44
 
45
- **Let's see the output**: Content of `example/learn-07-readme/README.md` file.
45
+ **Let's see the output**: Content of `example/learn-08-readme/README.md` file.
46
46
 
47
47
  ---
48
- # learn-07-readme
48
+ # learn-08-readme
49
49
 
50
50
  ## Customize readme output
51
51
 
52
- This is our example 07.
52
+ This is our README example.
53
53
  And here we'll see how to use readme keyword
54
54
 
55
55
  Go to [LOCALHOST](#required-hosts) host, and do next:
@@ -1,13 +1,13 @@
1
1
  [<< back](README.md)
2
2
 
3
- 1. [Execution section](#execution-section)
4
- 2. [Result](#result)
3
+ # Example: learn-09-preserve
5
4
 
6
- # Example: learn-08-preserve
5
+ > This example is on GitHub repository at `examples/learn-09-preserve/`.
7
6
 
8
7
  Older output report files are overwritten with new reports, every time we run teuton test. With `preserve` option we keep copies.
9
8
 
10
- > This example is on GitHub repository at `examples/learn-08-preserve/`.
9
+ 1. [Execution section](#execution-section)
10
+ 2. [Result](#result)
11
11
 
12
12
  ## Execution section
13
13
 
@@ -22,11 +22,11 @@ end
22
22
  > More information about [export](../dsl/execution/export.md) keyword.
23
23
  ## Result
24
24
 
25
- Example, executing `teuton run example/learn-08-preserve` twice:
25
+ Example, executing `teuton run example/learn-09-preserve` twice:
26
26
 
27
27
  ```
28
28
  var
29
- └── learn-08-preserve
29
+ └── learn-09-preserve
30
30
  ├── 20200519-113035
31
31
  │   ├── case-01.txt
32
32
  │   ├── moodle.csv
data/docs/videos.md ADDED
@@ -0,0 +1,19 @@
1
+ [<< back](../README.md)
2
+
3
+ # News
4
+
5
+ * [Introducción a Teuton](https://elpuig.xeill.net/Members/vcarceler/articulos/introduccion-a-teuton): iniciarse en el uso de Teutón gracias al fantástico artículo de Víctor Carceler.
6
+ * [Verificar prácticas de GNS3 con Teuton](https://elpuig.xeill.net/Members/juanmorote/articulos/verificar-practicas-de-gns3-con-teuton): GNS3 es un excelente simulador de red Open Source que además se entiende con Teuton a las mil maravillas.
7
+
8
+ # Videos
9
+
10
+ Teuton en el 2016 se llamaba "sysadmingame".
11
+ * [CHAPI16 - Presentación sysadmingame chapi16 - Abril 2016](https://youtu.be/cNJaB5xzHHQ)
12
+ * sysadmingame:
13
+ 1. [Instalación del programa](https://youtu.be/dnyMq9_KDco)
14
+ 2. [Crear un caso simple](https://youtu.be/0e2g5Izvc6c)
15
+ 3. [Crear un caso complejo](https://youtu.be/ebEK6OXH8kQ)
16
+
17
+ Teuton:
18
+ * [Apuntes FP Informática - I Congreso Virtual - Mayo 2020](https://youtu.be/RxIV26BAoGo)
19
+ * [Teuton Software 2.1 - Tutorial - Oct 2020](https://youtu.be/cyBN-rOYQeY)
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'singleton'
4
+ require_relative 'version'
5
+ require_relative 'utils/name_file_finder'
4
6
 
5
7
  # This Singleton contains application params
6
8
  class Application
7
9
  include Singleton
8
-
9
- VERSION = '2.1.11' # Application version
10
- NAME = 'teuton' # Application name
10
+ include Teuton
11
11
 
12
12
  attr_reader :letter
13
13
  attr_reader :running_basedir, :output_basedir
@@ -71,4 +71,23 @@ class Application
71
71
 
72
72
  false
73
73
  end
74
+
75
+ ##
76
+ # Preprocess input options:
77
+ # * Convert input case options String to an Array of integers
78
+ # * Read color input option
79
+ # rubocop:disable Metrics/AbcSize
80
+ def add_input_params(projectpath, options)
81
+ @options.merge! options
82
+ NameFileFinder.find_filenames_for(projectpath)
83
+ @options['color'] = true if @options['color'].nil?
84
+ Rainbow.enabled = @options['color']
85
+ @options['panel'] = false if @options['panel'].nil?
86
+
87
+ return if @options['case'].nil?
88
+
89
+ a = @options['case'].split(',')
90
+ @options['case'] = a.collect!(&:to_i)
91
+ end
92
+ # rubocop:enable Metrics/AbcSize
74
93
  end
@@ -22,8 +22,8 @@ module DSL
22
22
  def goto(host = :localhost, args = {})
23
23
  @result.reset
24
24
  args[:on] = host unless args[:on]
25
- @action[:command] = args[:execute] if args[:execute]
26
- @action[:command] = args[:exec] if args[:exec]
25
+ @action[:command] = args[:execute].to_s if args[:execute]
26
+ @action[:command] = args[:exec].to_s if args[:exec]
27
27
  tempfile(args[:tempfile]) if args[:tempfile]
28
28
  @action[:encoding] = args[:encoding] || 'UTF-8'
29
29
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative '../../../application'
3
+ require 'os'
3
4
 
4
5
  # DSL module methods: assert, missing_method
5
6
  module DSL
@@ -18,6 +18,7 @@ module DSL
18
18
  ip = get((host + '_ip').to_sym)
19
19
  username = get((host + '_username').to_sym).to_s
20
20
  password = get((host + '_password').to_sym).to_s
21
+ port = get((host + '_port').to_sym) || 22
21
22
 
22
23
  filename = @report.filename + '.' + @report.format.to_s
23
24
  localfilepath = File.join(@report.output_dir, filename)
@@ -32,7 +33,7 @@ module DSL
32
33
 
33
34
  # Upload a file or directory to the remote host
34
35
  begin
35
- Net::SFTP.start(ip, username, password: password) do |sftp|
36
+ Net::SFTP.start(ip, username, password: password, port: port) do |sftp|
36
37
  sftp.upload!(localfilepath, remotefilepath)
37
38
  end
38
39
  verboseln("=> [ OK ] #{(get(:tt_members)[0,15]).ljust(16)} : #{remotefilepath}")
@@ -58,6 +58,7 @@ class Case
58
58
 
59
59
  ##
60
60
  # Fill case report with time information
61
+ # rubocop:disable Metrics/AbcSize
61
62
  def fill_report(start_time, finish_time)
62
63
  @report.head.merge! @config.global
63
64
  @report.head.merge! @config.local
@@ -67,4 +68,5 @@ class Case
67
68
  @report.tail[:finish_time] = finish_time
68
69
  @report.tail[:duration] = finish_time - start_time
69
70
  end
71
+ # rubocop:enable Metrics/AbcSize
70
72
  end
@@ -1,7 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # This is an extension of Result class
4
+ # rubocop:disable Metrics/ClassLength
4
5
  class Result
6
+ # rubocop:disable Metrics/MethodLength
7
+ # Return true when content is equal than input
8
+ # @param input (Object)
5
9
  def eq(input)
6
10
  @expected = input
7
11
 
@@ -21,11 +25,13 @@ class Result
21
25
  end
22
26
  value == input
23
27
  end
28
+ # rubocop:enable Metrics/MethodLength
24
29
  alias eq? eq
25
30
  alias equal eq
26
31
  alias equal? eq
27
32
  alias is_equal? eq
28
33
 
34
+ # rubocop:disable Metrics/MethodLength
29
35
  def neq(external)
30
36
  @expected = "Not equal to #{external}"
31
37
 
@@ -43,10 +49,12 @@ class Result
43
49
  end
44
50
  internal != external
45
51
  end
52
+ # rubocop:enable Metrics/MethodLength
46
53
  alias neq? neq
47
54
  alias not_equal neq
48
55
  alias not_equal? neq
49
56
 
57
+ # rubocop:disable Metrics/MethodLength
50
58
  def ge(input)
51
59
  @expected = "Greater or equal to #{input}"
52
60
  return false if @content.nil? || @content[0].nil?
@@ -64,9 +72,11 @@ class Result
64
72
  end
65
73
  value >= input
66
74
  end
75
+ # rubocop:enable Metrics/MethodLength
67
76
  alias greater_or_equal ge
68
77
  alias greater_or_equal? ge
69
78
 
79
+ # rubocop:disable Metrics/MethodLength
70
80
  def gt(input)
71
81
  @expected = "Greater than #{input}"
72
82
  return false if @content.nil? || @content[0].nil?
@@ -84,9 +94,11 @@ class Result
84
94
  end
85
95
  value > input
86
96
  end
97
+ # rubocop:enable Metrics/MethodLength
87
98
  alias greater gt
88
99
  alias greater_than gt
89
100
 
101
+ # rubocop:disable Metrics/MethodLength
90
102
  def le(input)
91
103
  @expected = "Lesser or equal to #{input}"
92
104
 
@@ -105,9 +117,11 @@ class Result
105
117
  end
106
118
  value <= input
107
119
  end
120
+ # rubocop:enable Metrics/MethodLength
108
121
  alias lesser_or_equal le
109
122
  alias lesser_or_equal? le
110
123
 
124
+ # rubocop:disable Metrics/MethodLength
111
125
  def lt(input)
112
126
  @expected = "Lesser than #{input}"
113
127
  return false if @content.nil? || @content[0].nil?
@@ -125,6 +139,7 @@ class Result
125
139
  end
126
140
  value < input
127
141
  end
142
+ # rubocop:enable Metrics/MethodLength
128
143
  alias lesser lt
129
144
  alias smaller lt
130
145
  alias lesser_than lt
@@ -145,3 +160,4 @@ class Result
145
160
  alias near? near_to?
146
161
  alias near near_to?
147
162
  end
163
+ # rubocop:enable Metrics/ClassLength
@@ -44,7 +44,7 @@ class Result
44
44
  print " [DEBUG] count=#{@content.count} "
45
45
  puts '*' * 20
46
46
  @content.each_with_index do |item, index|
47
- puts format('%2d: %s', index, item)
47
+ puts format('%<index>2d: %<item>s', { index: index, item: item })
48
48
  end
49
49
  puts '*' * 57
50
50
  end
@@ -8,6 +8,7 @@ require_relative 'dsl/log'
8
8
  # * run_local_cmd
9
9
  # * run_remote_cmd
10
10
  # * run_remote_cmd_ssh
11
+ # * reconfigure_command_with_gateway
11
12
  # * run_remote_cmd_telnet
12
13
  class Case
13
14
 
@@ -65,21 +66,46 @@ class Case
65
66
  def run_cmd_remote_ssh(input_hostname)
66
67
  @action[:conn_type] = :ssh
67
68
  hostname = input_hostname.to_s
68
- ip = @config.get((hostname + '_ip').to_sym)
69
- username = @config.get((hostname + '_username').to_sym).to_s
70
- password = @config.get((hostname + '_password').to_sym).to_s
69
+ ip = @config.get("#{hostname}_ip".to_sym).to_s
70
+ username = @config.get("#{hostname}_username".to_sym).to_s
71
+ password = @config.get("#{hostname}_password".to_sym).to_s
72
+ port = @config.get("#{hostname}_port".to_sym).to_i
73
+ port = 22 if port.zero?
74
+
75
+ unless @config.get("#{hostname}_route".to_sym) == 'NODATA'
76
+ # Reconfigure command with gateway. Example host1_route: IP.
77
+ hostname2 = hostname
78
+ ip2 = ip
79
+ username2 = username
80
+ password2 = password
81
+ command2 = @action[:command]
82
+ hostname = @config.get("#{hostname}_route".to_sym)
83
+ ip = @config.get("#{hostname}_ip".to_sym).to_s
84
+ username = @config.get("#{hostname}_username".to_sym).to_s
85
+ password = @config.get("#{hostname}_password".to_sym).to_s
86
+ ostype = @config.get("#{hostname}_ostype".to_sym).to_s
87
+
88
+ if ostype.downcase.start_with? 'win'
89
+ # echo y | plink idp@2.tcp.eu.ngrok.io -ssh -P 16256 -pw idp "echo > Desktop\hola.txt"
90
+ @action[:command] = "echo y | plink #{username2}@#{ip2} -ssh -pw #{password2} \"#{command2}\""
91
+ else
92
+ @action[:command] = "sshpass -p #{password2} #{username2}@#{ip2} #{command2}"
93
+ end
94
+ end
95
+
71
96
  text = ''
72
97
  begin
73
98
  if @sessions[hostname].nil?
74
99
  @sessions[hostname] = Net::SSH.start(ip,
75
100
  username,
101
+ port: port,
76
102
  password: password,
77
103
  keepalive: true,
78
104
  timeout: 30,
79
105
  non_interactive: true)
80
106
  end
81
107
  if @sessions[hostname].class == Net::SSH::Connection::Session
82
- text = @sessions[hostname].exec!(@action[:command].to_s)
108
+ text = @sessions[hostname].exec!(@action[:command])
83
109
  end
84
110
  rescue Errno::EHOSTUNREACH
85
111
  @sessions[hostname] = :nosession
@@ -109,6 +135,7 @@ class Case
109
135
  " exec: #{@action[:command]}", :error)
110
136
  end
111
137
  output = encode_and_split(@action[:encoding], text)
138
+ # revise: @result.exitstatus = text.exitstatus
112
139
  @result.content = output
113
140
  @result.content.compact!
114
141
  end
@@ -3,7 +3,7 @@
3
3
  require 'singleton'
4
4
  require_relative '../application'
5
5
  require_relative '../report/report'
6
- require_relative '../project/configfile_reader'
6
+ require_relative '../utils/configfile_reader'
7
7
  require_relative 'case/case'
8
8
  require_relative 'export_manager'
9
9
  require_relative 'main'
@@ -10,16 +10,10 @@ module ExportManager
10
10
  # @param main_report (Report)
11
11
  # @param cases (Array)
12
12
  # @param input (Hash) Selected export options
13
- # rubocop: disable Metrics/AbcSize
13
+ # rubocop:disable Metrics/AbcSize
14
+ # rubocop:disable Metrics/CyclomaticComplexity
14
15
  def self.run(main_report, cases, input)
15
- args = {}
16
- input.each_pair do |key, value|
17
- if value.class == String
18
- args[key] = value.to_sym
19
- else
20
- args[key] = value
21
- end
22
- end
16
+ args = strings2symbols(input)
23
17
 
24
18
  # default :mode=>:all, :format=>:txt
25
19
  format = args[:format] || Application.instance.default[:format]
@@ -36,12 +30,29 @@ module ExportManager
36
30
  preserve_files if args[:preserve] == true
37
31
  end
38
32
  # rubocop:enable Metrics/AbcSize
33
+ # rubocop:enable Metrics/CyclomaticComplexity
34
+
35
+ ##
36
+ # Convert Hash String values into Symbol values
37
+ # @param input (Hash)
38
+ # rubocop:disable Style/ConditionalAssignment
39
+ private_class_method def self.strings2symbols(input)
40
+ args = {}
41
+ input.each_pair do |key, value|
42
+ if value.class == String
43
+ args[key] = value.to_sym
44
+ else
45
+ args[key] = value
46
+ end
47
+ end
48
+ args
49
+ end
50
+ # rubocop:enable Style/ConditionalAssignment
39
51
 
40
52
  ##
41
53
  # Preserve output files for current project
42
54
  # rubocop:disable Metrics/AbcSize
43
55
  # rubocop:disable Metrics/MethodLength
44
- # rubocop:disable Layout/LineLength
45
56
  private_class_method def self.preserve_files
46
57
  app = Application.instance
47
58
  t = Time.now
@@ -57,5 +68,4 @@ module ExportManager
57
68
  end
58
69
  # rubocop:enable Metrics/AbcSize
59
70
  # rubocop:enable Metrics/MethodLength
60
- # rubocop:enable Layout/LineLength
61
71
  end
@@ -26,7 +26,7 @@ module Utils
26
26
  text = ec.convert(text)
27
27
  rescue StandardError => e
28
28
  puts "[ERROR] #{e}: Declare text encoding..."
29
- puts " goto :host, :exec => 'command', :encoding => 'ISO-8859-1'"
29
+ puts " run 'command', on: :host, :encoding => 'ISO-8859-1'"
30
30
  end
31
31
 
32
32
  text.split("\n")
File without changes
@@ -1,36 +1,27 @@
1
- # Laboratory
2
- # * target
3
- # * request (development)
4
- # * tempfile
5
- # * goto
6
- # * run
7
- # * expect
8
- # * get
9
- # * unique
10
- # * log
11
- # * set
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # Include Teuton DSL keywords into Laboratory class
12
5
  class Laboratory
6
+ ##
7
+ # Execute Teuton DSL readme keyword
13
8
  def readme(_text)
14
9
  # Usefull for "teuton readme" command action.
15
10
  end
16
11
 
12
+ ##
13
+ # Execute Teuton DSL target keyword
17
14
  def target(desc, args = {})
18
15
  @stats[:targets] += 1
19
16
  @targetid += 1
20
17
  weight = args[:weight] || 1.0
21
- verboseln '(%03d' % @targetid + ") target #{desc}"
18
+ verboseln format('(%03<targetid>d) target %<desc>s', targetid: @targetid, desc: desc)
22
19
  verboseln " weight #{weight}"
23
20
  end
24
21
  alias goal target
25
22
 
26
- # def request(text)
27
- # @requests << text.to_s
28
- # end
29
-
30
- def tempfile(_tempfile = nil)
31
- 'tempfile'
32
- end
33
-
23
+ ##
24
+ # Execute Teuton DSL run keyword
34
25
  def run(command, args = {})
35
26
  args[:exec] = command
36
27
  host = :localhost
@@ -38,6 +29,8 @@ class Laboratory
38
29
  goto(host, args)
39
30
  end
40
31
 
32
+ ##
33
+ # Execute Teuton DSL goto keyword
41
34
  def goto(host = :localhost, args = {})
42
35
  result.reset
43
36
  args[:on] = host unless args[:on]
@@ -50,24 +43,32 @@ class Laboratory
50
43
  verboseln " run '#{args[:exec]}' on #{args[:on]}"
51
44
  end
52
45
 
53
- def expect(_cond, args = {})
46
+ ##
47
+ # Execute Teuton DSL expect keyword
48
+ def expect(cond)
54
49
  verboseln " alter #{result.alterations}" unless result.alterations.empty?
55
- verboseln " expect #{_cond} (#{_cond.class})"
50
+ verboseln " expect #{cond} (#{cond.class})"
56
51
  verboseln ''
57
52
  end
58
53
 
59
- def expect_one(_cond, args = {})
54
+ ##
55
+ # Execute Teuton DSL expect_one keyword
56
+ def expect_one(cond)
60
57
  verboseln " alter #{result.alterations}" unless result.alterations.empty?
61
- verboseln " expect_one #{_cond} (#{_cond.class})"
58
+ verboseln " expect_one #{cond} (#{cond.class})"
62
59
  verboseln ''
63
60
  end
64
61
 
65
- def expect_none(_cond, args = {})
62
+ ##
63
+ # Execute Teuton DSL expect_none keyword
64
+ def expect_none(cond)
66
65
  verboseln " alter #{result.alterations}" unless result.alterations.empty?
67
- verboseln " expect_none #{_cond} (#{_cond.class})"
66
+ verboseln " expect_none #{cond} (#{cond.class})"
68
67
  verboseln ''
69
68
  end
70
69
 
70
+ ##
71
+ # Execute Teuton DSL get keyword
71
72
  def get(varname)
72
73
  @stats[:gets] += 1
73
74
 
@@ -80,17 +81,24 @@ class Laboratory
80
81
  "get(#{varname})"
81
82
  end
82
83
 
83
- # If a method call is missing, then delegate to concept parent.
84
+ # If a method call is missing, then try to call get(var)
85
+ # rubocop:disable Style/MissingRespondToMissing
84
86
  def method_missing(method)
85
87
  a = method.to_s
86
- instance_eval("get(:#{a[0, a.size - 1]})") if a[a.size - 1] == '?'
88
+ instance_eval("get(:#{a[0, a.size - 1]})", __FILE__, __LINE__) if a[a.size - 1] == '?'
87
89
  end
90
+ # rubocop:enable Style/MissingRespondToMissing
88
91
 
92
+ ##
93
+ # Execute Teuton DSL gett keyword
94
+ # Same as get keyword, but show pretty output when used by readme command.
89
95
  def gett(option)
90
96
  value = get(option)
91
97
  value
92
98
  end
93
99
 
100
+ ##
101
+ # Execute Teuton DSL unique keyword
94
102
  def unique(key, _value)
95
103
  @stats[:uniques] += 1
96
104
 
@@ -98,11 +106,15 @@ class Laboratory
98
106
  verboseln ''
99
107
  end
100
108
 
109
+ ##
110
+ # Execute Teuton DSL log keyword
101
111
  def log(text = '', type = :info)
102
112
  @stats[:logs] += 1
103
113
  verboseln " log [#{type}]: " + text.to_s
104
114
  end
105
115
 
116
+ ##
117
+ # Execute Teuton DSL set keyword
106
118
  def set(key, value)
107
119
  @stats[:sets] += 1
108
120
 
@@ -1,10 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'terminal-table'
4
- require 'rainbow'
5
-
6
- require_relative '../../application'
7
- require_relative '../../case_manager/case/result/result'
3
+ require_relative '../application'
4
+ require_relative '../case_manager/case/result/result'
8
5
  require_relative 'show'
9
6
  require_relative 'dsl'
10
7
  require_relative 'builtin'
@@ -35,7 +32,7 @@ alias task group
35
32
  # DSL start: Define main teuton test execution
36
33
  # @param block (Proc)
37
34
  def start(&block)
38
- # don't do nothing
35
+ # Don't do nothing. We are checking test not running it
39
36
  end
40
37
  alias play start
41
38
 
@@ -54,8 +51,6 @@ class Laboratory
54
51
  reset
55
52
  end
56
53
 
57
- ##
58
- # Set attibutes to default values
59
54
  def reset
60
55
  @result = Result.new
61
56
  @targetid = 0