teuton 2.4.1 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/docs/changelog/todo.md +1 -0
  4. data/docs/changelog/v2.4.md +9 -0
  5. data/docs/commands/README.md +8 -17
  6. data/docs/commands/example_check.md +4 -4
  7. data/docs/commands/example_run.md +10 -32
  8. data/docs/dsl/README.md +27 -39
  9. data/docs/dsl/{definition/expect.md → expect.md} +2 -18
  10. data/docs/dsl/{execution/export.md → export.md} +1 -6
  11. data/docs/dsl/{setting/get.md → get.md} +4 -10
  12. data/docs/dsl/{definition/group.md → group.md} +2 -7
  13. data/docs/dsl/{execution/play.md → play.md} +1 -6
  14. data/docs/dsl/{definition/result.md → result.md} +1 -6
  15. data/docs/dsl/{definition/run_remote.md → run.md} +57 -23
  16. data/docs/dsl/{execution/send.md → send.md} +1 -8
  17. data/docs/dsl/{setting/set.md → set.md} +1 -7
  18. data/docs/dsl/{execution/show.md → show.md} +7 -16
  19. data/docs/dsl/target.md +33 -0
  20. data/docs/ideas/todo.md +35 -115
  21. data/docs/learn/01-cmd_new.md +28 -0
  22. data/docs/learn/{01-target.md → 02-target.md} +13 -17
  23. data/docs/learn/03-remote_hosts.md +59 -87
  24. data/docs/learn/04-config.md +147 -0
  25. data/docs/learn/05-use.md +25 -45
  26. data/docs/learn/06-cmd_check.md +50 -0
  27. data/docs/learn/07-target_weight.md +44 -0
  28. data/docs/learn/08-unique_values.md +70 -0
  29. data/docs/learn/09-send.md +20 -0
  30. data/docs/learn/10-debug.md +45 -0
  31. data/docs/learn/11-export.md +35 -0
  32. data/docs/learn/{09-preserve.md → 12-preserve.md} +0 -0
  33. data/docs/learn/{17-hide-feedback.md → 13-feedback.md} +20 -23
  34. data/docs/learn/14-moodle_id.md +24 -0
  35. data/docs/learn/{08-readme.md → 15-readme.md} +5 -9
  36. data/docs/learn/{13-include.md → 16-include.md} +1 -3
  37. data/docs/learn/{14-alias.md → 17-alias.md} +0 -0
  38. data/docs/learn/{07-log.md → 18-log.md} +19 -23
  39. data/docs/learn/{12-get_vars.md → 19-read_vars.md} +3 -3
  40. data/docs/learn/20-macros.md +49 -0
  41. data/docs/learn/{16-exit_codes.md → 21-exit_codes.md} +0 -0
  42. data/docs/learn/{10-result.md → 22-result.md} +3 -3
  43. data/docs/learn/23-test-code.md +54 -0
  44. data/docs/learn/24-test-sql.md +69 -0
  45. data/docs/learn/README.md +24 -18
  46. data/lib/teuton/application.rb +0 -5
  47. data/lib/teuton/case_manager/case/case.rb +1 -1
  48. data/lib/teuton/case_manager/case/dsl/expect.rb +9 -2
  49. data/lib/teuton/case_manager/case/dsl/goto.rb +1 -1
  50. data/lib/teuton/case_manager/case/dsl/log.rb +5 -3
  51. data/lib/teuton/case_manager/case/dsl/target.rb +1 -1
  52. data/lib/teuton/case_manager/case/result/ext_compare.rb +20 -21
  53. data/lib/teuton/case_manager/case/result/ext_filter.rb +15 -8
  54. data/lib/teuton/check/show.rb +1 -1
  55. data/lib/teuton/files/config.yaml +1 -2
  56. data/lib/teuton/files/start.rb +4 -4
  57. data/lib/teuton/readme/dsl.rb +9 -1
  58. data/lib/teuton/readme/readme.rb +8 -1
  59. data/lib/teuton/report/show.rb +8 -0
  60. data/lib/teuton/version.rb +1 -1
  61. metadata +68 -54
  62. data/docs/dsl/definition/run_local.md +0 -33
  63. data/docs/dsl/definition/target.md +0 -40
  64. data/docs/learn/02-config.md +0 -117
  65. data/docs/learn/04-new_test.md +0 -87
  66. data/docs/learn/06-debug.md +0 -110
  67. data/docs/learn/11-moodle_id.md +0 -19
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.4.1
4
+ version: 2.4.3
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: 2023-01-21 00:00:00.000000000 Z
11
+ date: 2023-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -150,18 +150,17 @@ extra_rdoc_files:
150
150
  - docs/commands/example_check.md
151
151
  - docs/commands/example_run.md
152
152
  - docs/dsl/README.md
153
- - docs/dsl/definition/expect.md
154
- - docs/dsl/definition/group.md
155
- - docs/dsl/definition/result.md
156
- - docs/dsl/definition/run_local.md
157
- - docs/dsl/definition/run_remote.md
158
- - docs/dsl/definition/target.md
159
- - docs/dsl/execution/export.md
160
- - docs/dsl/execution/play.md
161
- - docs/dsl/execution/send.md
162
- - docs/dsl/execution/show.md
163
- - docs/dsl/setting/get.md
164
- - docs/dsl/setting/set.md
153
+ - docs/dsl/expect.md
154
+ - docs/dsl/export.md
155
+ - docs/dsl/get.md
156
+ - docs/dsl/group.md
157
+ - docs/dsl/play.md
158
+ - docs/dsl/result.md
159
+ - docs/dsl/run.md
160
+ - docs/dsl/send.md
161
+ - docs/dsl/set.md
162
+ - docs/dsl/show.md
163
+ - docs/dsl/target.md
165
164
  - docs/es/exit_code.md
166
165
  - docs/es/guess_os.md
167
166
  - docs/ideas/Challenge-Server-Project.md
@@ -174,22 +173,30 @@ extra_rdoc_files:
174
173
  - docs/install/s-node.md
175
174
  - docs/install/t-node.md
176
175
  - docs/install/vagrant_docker.md
177
- - docs/learn/01-target.md
178
- - docs/learn/02-config.md
176
+ - docs/learn/01-cmd_new.md
177
+ - docs/learn/02-target.md
179
178
  - docs/learn/03-remote_hosts.md
180
- - docs/learn/04-new_test.md
179
+ - docs/learn/04-config.md
181
180
  - docs/learn/05-use.md
182
- - docs/learn/06-debug.md
183
- - docs/learn/07-log.md
184
- - docs/learn/08-readme.md
185
- - docs/learn/09-preserve.md
186
- - docs/learn/10-result.md
187
- - docs/learn/11-moodle_id.md
188
- - docs/learn/12-get_vars.md
189
- - docs/learn/13-include.md
190
- - docs/learn/14-alias.md
191
- - docs/learn/16-exit_codes.md
192
- - docs/learn/17-hide-feedback.md
181
+ - docs/learn/06-cmd_check.md
182
+ - docs/learn/07-target_weight.md
183
+ - docs/learn/08-unique_values.md
184
+ - docs/learn/09-send.md
185
+ - docs/learn/10-debug.md
186
+ - docs/learn/11-export.md
187
+ - docs/learn/12-preserve.md
188
+ - docs/learn/13-feedback.md
189
+ - docs/learn/14-moodle_id.md
190
+ - docs/learn/15-readme.md
191
+ - docs/learn/16-include.md
192
+ - docs/learn/17-alias.md
193
+ - docs/learn/18-log.md
194
+ - docs/learn/19-read_vars.md
195
+ - docs/learn/20-macros.md
196
+ - docs/learn/21-exit_codes.md
197
+ - docs/learn/22-result.md
198
+ - docs/learn/23-test-code.md
199
+ - docs/learn/24-test-sql.md
193
200
  - docs/learn/README.md
194
201
  - docs/learn/videos.md
195
202
  - docs/videos.md
@@ -209,18 +216,17 @@ files:
209
216
  - docs/commands/example_check.md
210
217
  - docs/commands/example_run.md
211
218
  - docs/dsl/README.md
212
- - docs/dsl/definition/expect.md
213
- - docs/dsl/definition/group.md
214
- - docs/dsl/definition/result.md
215
- - docs/dsl/definition/run_local.md
216
- - docs/dsl/definition/run_remote.md
217
- - docs/dsl/definition/target.md
218
- - docs/dsl/execution/export.md
219
- - docs/dsl/execution/play.md
220
- - docs/dsl/execution/send.md
221
- - docs/dsl/execution/show.md
222
- - docs/dsl/setting/get.md
223
- - docs/dsl/setting/set.md
219
+ - docs/dsl/expect.md
220
+ - docs/dsl/export.md
221
+ - docs/dsl/get.md
222
+ - docs/dsl/group.md
223
+ - docs/dsl/play.md
224
+ - docs/dsl/result.md
225
+ - docs/dsl/run.md
226
+ - docs/dsl/send.md
227
+ - docs/dsl/set.md
228
+ - docs/dsl/show.md
229
+ - docs/dsl/target.md
224
230
  - docs/es/exit_code.md
225
231
  - docs/es/guess_os.md
226
232
  - docs/ideas/Challenge-Server-Project.md
@@ -233,22 +239,30 @@ files:
233
239
  - docs/install/s-node.md
234
240
  - docs/install/t-node.md
235
241
  - docs/install/vagrant_docker.md
236
- - docs/learn/01-target.md
237
- - docs/learn/02-config.md
242
+ - docs/learn/01-cmd_new.md
243
+ - docs/learn/02-target.md
238
244
  - docs/learn/03-remote_hosts.md
239
- - docs/learn/04-new_test.md
245
+ - docs/learn/04-config.md
240
246
  - docs/learn/05-use.md
241
- - docs/learn/06-debug.md
242
- - docs/learn/07-log.md
243
- - docs/learn/08-readme.md
244
- - docs/learn/09-preserve.md
245
- - docs/learn/10-result.md
246
- - docs/learn/11-moodle_id.md
247
- - docs/learn/12-get_vars.md
248
- - docs/learn/13-include.md
249
- - docs/learn/14-alias.md
250
- - docs/learn/16-exit_codes.md
251
- - docs/learn/17-hide-feedback.md
247
+ - docs/learn/06-cmd_check.md
248
+ - docs/learn/07-target_weight.md
249
+ - docs/learn/08-unique_values.md
250
+ - docs/learn/09-send.md
251
+ - docs/learn/10-debug.md
252
+ - docs/learn/11-export.md
253
+ - docs/learn/12-preserve.md
254
+ - docs/learn/13-feedback.md
255
+ - docs/learn/14-moodle_id.md
256
+ - docs/learn/15-readme.md
257
+ - docs/learn/16-include.md
258
+ - docs/learn/17-alias.md
259
+ - docs/learn/18-log.md
260
+ - docs/learn/19-read_vars.md
261
+ - docs/learn/20-macros.md
262
+ - docs/learn/21-exit_codes.md
263
+ - docs/learn/22-result.md
264
+ - docs/learn/23-test-code.md
265
+ - docs/learn/24-test-sql.md
252
266
  - docs/learn/README.md
253
267
  - docs/learn/videos.md
254
268
  - docs/videos.md
@@ -1,33 +0,0 @@
1
- [<< back](../README.md)
2
-
3
- 1. [Description](#description)
4
- 2. [Usage](#usage)
5
- 3. [Alias](#alias)
6
- 4. [Example](#example)
7
-
8
- ## Description
9
-
10
- Execute command on localhost and save output into result object.
11
-
12
- ## Usage
13
-
14
- ```ruby
15
- run "id COMMAND"
16
- ```
17
-
18
- ## Alias
19
-
20
- In fact it's the same as doing next:
21
-
22
- ```ruby
23
- run "COMMAND", on: :localhost
24
- ```
25
-
26
- ## Example
27
-
28
- ```ruby
29
- run "id david"
30
- ```
31
-
32
- * This instruction execute "id david" command on local machine, and save results into **result** object.
33
- * Local machine is where the `Teuton` program is running.
@@ -1,40 +0,0 @@
1
- [<< back](../README.md)
2
-
3
- 1. [Description](#description)
4
- 2. [Usage](#usage)
5
- 4. [Weight](#weight)
6
-
7
- ## Description
8
-
9
- `target` instruction is used to begin new target/goal definition, and sets its description.
10
-
11
- ## Usage
12
-
13
- ```ruby
14
- target "Write here your description"
15
- ```
16
-
17
- * Define target description. Use your own words to describe it, so everybody could understand what is going to be measured.
18
- * This text will be shown into reports to help us understand output information easily.
19
-
20
- ## Weight
21
-
22
- By default weight is 1.0, but it's posible specified other value:
23
-
24
- ```ruby
25
- target "Write here your description", weight: 2.5
26
- ```
27
-
28
- ## [DEPRECATED] Alias
29
-
30
- `goal` keyword is an alias of `target`. So it's the same:
31
-
32
- ```ruby
33
- target "Write here your description"
34
- ```
35
-
36
- or
37
-
38
- ```ruby
39
- goal "Write here your description"
40
- ```
@@ -1,117 +0,0 @@
1
- [<< back](README.md)
2
-
3
- # Example: config
4
-
5
- _It's good idea save variables into config file._
6
-
7
- Learn:
8
- * How to use config file.
9
- * How to use params defined into config files.
10
-
11
- ## Config file
12
-
13
- By default, `config.yaml` is our default config file. Example:
14
-
15
- ```yaml
16
- ---
17
- global:
18
- cases:
19
- - tt_members: Student-name-1
20
- username: root
21
- - tt_members: Student-name-2
22
- username: david
23
- ```
24
-
25
- > **How to choose another config file?** Read this [document](../commands/example_run.md#3-choosing-config-file).
26
-
27
- ## Definition section
28
-
29
- By default, `start.rb` it's our main execution file. Example:
30
-
31
- ```ruby
32
- group "Reading params from config file" do
33
-
34
- target "Create user #{get(:username)}"
35
- run "id #{get(:username)}"
36
- expect get(:username)
37
-
38
- end
39
- ```
40
-
41
- In this section, we define targets using `target`, `run`, `expect` and `get` keywords.
42
-
43
- * **get** keyword read params from configuration file. It's posible personalize tests with diferent values for every case.
44
-
45
- ## Execution section
46
-
47
- Main execution block:
48
-
49
- ```ruby
50
- play do
51
- show
52
- export
53
- end
54
- ```
55
-
56
- This example run test and show (`show` keyword) output on screen:
57
-
58
- ```console
59
- > teuton run examples/02-config
60
-
61
- CASE RESULTS
62
- +------+----------------+-------+-------+
63
- | CASE | MEMBERS | GRADE | STATE |
64
- | 01 | Student-name-1 | 100.0 | ✔ |
65
- | 02 | Student-name-2 | 0.0 | ? |
66
- +------+----------------+-------+-------+
67
- ```
68
-
69
- ## Results
70
-
71
- Output reports are saved into `var/02-config/` directory. Detail output report is created for every case.
72
-
73
- ```
74
- var/02-config
75
- ├── case-01.txt
76
- ├── case-02.txt
77
- ├── moodle.csv
78
- └── resume.txt
79
- ```
80
-
81
- Let's see `export` keyword output for case 01.
82
-
83
- ```
84
- > more var/02-config/case-01.txt
85
- CONFIGURATION
86
- +-------------+----------------+
87
- | tt_members | Student-name-1 |
88
- | tt_sequence | false |
89
- | tt_skip | false |
90
- | tt_testname | 02-config |
91
- | username | root |
92
- +-------------+----------------+
93
-
94
- GROUPS
95
- - Reading params from config file
96
- 01 (1.0/1.0)
97
- Description : Create user root
98
- Command : id root
99
- Duration : 0.002 (local)
100
- Alterations : find(root) & count
101
- Expected : Greater than 0 (String)
102
- Result : 1 (Integer)
103
-
104
- RESULTS
105
- +--------------+---------------------------+
106
- | case_id | 01 |
107
- | start_time | 2022-12-24 13:33:49 +0000 |
108
- | finish_time | 2022-12-24 13:33:49 +0000 |
109
- | duration | 0.001777756 |
110
- | unique_fault | 0 |
111
- | max_weight | 1.0 |
112
- | good_weight | 1.0 |
113
- | fail_weight | 0.0 |
114
- | fail_counter | 0 |
115
- | grade | 100 |
116
- +--------------+---------------------------+
117
- ```
@@ -1,87 +0,0 @@
1
-
2
- [<< back](README.md)
3
-
4
- # Example: 04-new_test
5
-
6
- Steps:
7
- 1. Create skeleton
8
- 2. Personalize targets
9
- 3. Personalize configuration file
10
- 4. Run the challenge
11
-
12
- ## STEP 1: Create skeleton
13
-
14
- Create skeleton for a new project: `teuton create foo`
15
-
16
- ```
17
- > teuton new foo
18
-
19
- [INFO] Creating foo project skeleton
20
- * Create dir => foo
21
- * Create file => foo/config.yaml
22
- * Create file => foo/start.rb
23
- ```
24
-
25
- > NOTA: It is posible to create these files by hand.
26
-
27
- This command will create:
28
-
29
- | File/Directory | Description |
30
- | --------------- | -------------- |
31
- | foo | Base directory |
32
- | foo/start.rb | Main Script |
33
- | foo/config.yaml | YAML configuration file |
34
-
35
- ---
36
-
37
- ## STEP 2: Personalize targets
38
-
39
- Write your own targets using the keywords: `target`, `run` and `expect`. Let's see:
40
-
41
- ```ruby
42
- group "Create new test" do
43
- target "Exist </home/vader> directory"
44
- run "file /home/vader", on: :host1
45
- expect_none "No such file or directory"
46
- end
47
- ```
48
-
49
- The above example checks if exists '/home/david' directory, into *host1* device.
50
-
51
- > Let's see the keywords used:
52
- >
53
- > * `target "Exist </home/vader> directory"`, Describe the target with our words, so every one could easily understand what we are trying
54
- to check.
55
- > * `run "file /home/vader", on: :host1`, : Execute the command into the remote machine (host1).
56
- > * ` expect_none "No such file or directory"`: Compare command ouput with our expectations.
57
-
58
- ## STEP 3: Personalize Configfile
59
-
60
- Use a YAML file (`foo/config.yaml`) or JSON for your own configurations. In this example, the file contains params used by our challenge (script).
61
-
62
- **Example**:
63
-
64
- ```yaml
65
- ---
66
- :global:
67
- :host1_username: root
68
- :cases:
69
- - :tt_members: student-name-01
70
- :host1_ip: 1.1.1.1
71
- :host1_password: root-password-student-01
72
- - :tt_members: student-name-02
73
- :host1_ip: 2.2.2.2
74
- :host1_password: root-password-student-02
75
- ```
76
-
77
- > The above file configures 2 differents cases with their own params. The script use this information when execute every case.
78
-
79
- ## STEP 4: run the challenge
80
-
81
- Now we only have to run the challenge:
82
-
83
- ```bash
84
- > teuton run foo
85
- ```
86
-
87
- Output files are saved into `var/foo` directory.
@@ -1,110 +0,0 @@
1
-
2
- [<< back](README.md)
3
-
4
- # Example: 06-debug
5
-
6
- Learn how to:
7
- * Check test syntax.
8
- * Debug your tests.
9
-
10
- 1. [Tree directory](#tree-directory)
11
- 2. [Execution section](#execution-section)
12
- 3. [Check test](#check-test)
13
- 4. [Debug](#debug)
14
-
15
- ## Tree directory
16
-
17
- ```
18
- > tree learn/learn-06-debug
19
-
20
- example/learn-06-debug
21
- ├── config.yaml
22
- ├── external.rb
23
- ├── internal.rb
24
- ├── README.md
25
- └── start.rb
26
- ```
27
-
28
- ## Execution section
29
-
30
- The `start.rb` is main execution rb file, and uses `external` and `internal` rb files.
31
-
32
- Let's see current `start.rb` file:
33
-
34
- ```ruby
35
- use 'external'
36
- use 'internal'
37
-
38
- play do
39
- show
40
- export :format => :colored_text
41
- end
42
- ```
43
-
44
- ## Check test
45
-
46
- Tests grows and becames huge, with a lot of targets (That isn't a problem). Then, we organize them spliting into several files and invoke `use` keywork from our main rb file to load other files (That's good idea) .
47
-
48
- When this happend, sometimes we need to verify or check rb file consistency and syntax, and we will do it with `teuton check PATH/TO/PROJECT/FOLDER`.
49
-
50
- Let's see example `teuton check examples/learn-01-target`:
51
-
52
- ```
53
- +----------------------------+
54
- | GROUP: Learn about targets |
55
- +----------------------------+
56
- (001) target Create user david
57
- weight 1.0
58
- run 'id david' on localhost
59
- expect david (String)
60
-
61
- +--------------+-------+
62
- | DSL Stats | Count |
63
- +--------------+-------+
64
- | Groups | 1 |
65
- | Targets | 1 |
66
- | Goto | 1 |
67
- | * localhost | 1 |
68
- | Uniques | 0 |
69
- | Logs | 0 |
70
- | | |
71
- | Gets | 0 |
72
- | Sets | 0 |
73
- +--------------+-------+
74
- +----------------------+
75
- | Revising CONFIG file |
76
- +----------------------+
77
- [WARN] File /home/david/proy/repos/teuton.d/teuton/examples/01-target/config.yaml not found!
78
- [INFO] Recomended content:
79
- ---
80
- :global:
81
- :cases:
82
- - :tt_members: VALUE
83
-
84
- ```
85
-
86
- In this case, Teuton detects that there isn't exist config file, and propose us content for `config.yaml`.
87
-
88
- ## Debug
89
-
90
- Every time we invoke `run` or `goto` keywork, an OS command is executed. The output is showed on screen and saved into **result** internal object.
91
-
92
- We could debug it invoking `result.debug` into our tests. Let's see an example from `external.rb` file:
93
-
94
- ```ruby
95
- group "Windows: external configuration" do
96
-
97
- target "Localhost: Verify connectivity with #{gett(:windows1_ip)}"
98
- run "ping #{get(:windows1_ip)} -c 1"
99
- result.debug
100
- expect_one "0% packet loss"
101
- result.debug
102
-
103
- target "Localhost: netbios-ssn service working on #{gett(:windows1_ip)}"
104
- run "nmap -Pn #{get(:windows1_ip)}"
105
- expect "139/tcp", "open"
106
-
107
- end
108
- ```
109
-
110
- `result.debug` it's usefull when you are verifying command output captured by Teuton.
@@ -1,19 +0,0 @@
1
- [<< back](README.md)
2
-
3
- # Example: 11-moodle_id
4
-
5
- If you are a teacher and are using the Moodle platform, probably you will want to upload the results of the evaluation carried out by Teuton in Moodle.
6
-
7
- Teuton generates a file called "moodle.csv" with the grades of each student. Only have to import the file into Moodle.
8
-
9
- In the configuration file "config.yaml" add a field called "moodle_id" to each case. Fill it with the student's identification (For example, the email registered on the Moodle).
10
-
11
- Example:
12
- ```
13
- global:
14
- cases:
15
- - tt_members: Darth Vader
16
- tt_moodle_id: vader@starwars.com
17
- - tt_members: Obiwan Kenobi
18
- tt_moodle_id: obiwan@starwars.com
19
- ```