teuton 2.4.0 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -6
  3. data/docs/changelog/todo.md +10 -1
  4. data/docs/changelog/v2.4.md +5 -1
  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} +4 -8
  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/install/README.md +26 -42
  22. data/docs/install/s-node.md +35 -0
  23. data/docs/install/t-node.md +76 -0
  24. data/docs/learn/01-cmd_new.md +28 -0
  25. data/docs/learn/{01-target.md → 02-target.md} +21 -28
  26. data/docs/learn/03-remote_hosts.md +59 -87
  27. data/docs/learn/04-config.md +147 -0
  28. data/docs/learn/05-use.md +25 -45
  29. data/docs/learn/06-cmd_check.md +50 -0
  30. data/docs/learn/07-target_weight.md +44 -0
  31. data/docs/learn/08-unique_values.md +70 -0
  32. data/docs/learn/09-send.md +20 -0
  33. data/docs/learn/10-debug.md +45 -0
  34. data/docs/learn/11-export.md +35 -0
  35. data/docs/learn/{09-preserve.md → 12-preserve.md} +1 -1
  36. data/docs/learn/13-feedback.md +49 -0
  37. data/docs/learn/14-moodle_id.md +24 -0
  38. data/docs/learn/{08-readme.md → 15-readme.md} +5 -9
  39. data/docs/learn/{13-include.md → 16-include.md} +1 -3
  40. data/docs/learn/{14-alias.md → 17-alias.md} +0 -0
  41. data/docs/learn/{07-log.md → 18-log.md} +19 -23
  42. data/docs/learn/{12-get_vars.md → 19-read_vars.md} +3 -3
  43. data/docs/learn/20-macros.md +49 -0
  44. data/docs/learn/{16-exit_codes.md → 21-exit_codes.md} +0 -0
  45. data/docs/learn/{10-result.md → 22-result.md} +3 -3
  46. data/docs/learn/23-test-code.md +54 -0
  47. data/docs/learn/24-test-sql.md +69 -0
  48. data/docs/learn/README.md +31 -32
  49. data/lib/teuton/application.rb +2 -5
  50. data/lib/teuton/case_manager/case/case.rb +2 -1
  51. data/lib/teuton/case_manager/case/dsl/expect.rb +3 -1
  52. data/lib/teuton/case_manager/case/dsl/goto.rb +1 -1
  53. data/lib/teuton/case_manager/case/dsl/log.rb +5 -3
  54. data/lib/teuton/case_manager/case/dsl/send.rb +2 -2
  55. data/lib/teuton/case_manager/case/dsl/target.rb +1 -1
  56. data/lib/teuton/case_manager/case/result/ext_compare.rb +20 -21
  57. data/lib/teuton/case_manager/case/result/ext_filter.rb +15 -8
  58. data/lib/teuton/case_manager/case_manager.rb +10 -8
  59. data/lib/teuton/check/show.rb +1 -1
  60. data/lib/teuton/files/config.yaml +1 -2
  61. data/lib/teuton/files/start.rb +4 -4
  62. data/lib/teuton/readme/dsl.rb +9 -1
  63. data/lib/teuton/readme/readme.rb +8 -1
  64. data/lib/teuton/report/formatter/base_formatter.rb +2 -0
  65. data/lib/teuton/report/formatter/formatter.rb +1 -0
  66. data/lib/teuton/report/show.rb +8 -0
  67. data/lib/teuton/version.rb +1 -1
  68. data/lib/teuton.rb +2 -1
  69. metadata +72 -54
  70. data/docs/dsl/definition/run_local.md +0 -33
  71. data/docs/dsl/definition/target.md +0 -40
  72. data/docs/install/scripts.md +0 -96
  73. data/docs/learn/02-config.md +0 -121
  74. data/docs/learn/04-new_test.md +0 -87
  75. data/docs/learn/06-debug.md +0 -110
  76. data/docs/learn/11-moodle_id.md +0 -19
@@ -1,121 +0,0 @@
1
- [<< back](README.md)
2
-
3
- # Example: 02-config
4
-
5
- * Learn how to use config file.
6
- * Use params defined into config files.
7
- * It's good idea save variable data separated into external config file.
8
-
9
- 1. [Config file](#config-file).
10
- 2. [Definition section](#definition-section).
11
- 3. [Execution section](#execution-section).
12
- 4. [Results](#results).
13
-
14
- ## Config file
15
-
16
- By default, `config.yaml` is our config file. Let's an example:
17
-
18
- ```yaml
19
- ---
20
- global:
21
- cases:
22
- - tt_members: Student-name-1
23
- username: root
24
- - tt_members: Student-name-2
25
- username: vargas
26
- ```
27
-
28
- ## Definition section
29
-
30
- By default, `start.rb` it's our main execution file.
31
-
32
- ```ruby
33
- group "Reading params from config file" do
34
-
35
- target "Create user #{get(:username)}"
36
- run "id #{get(:username)}"
37
- expect get(:username)
38
-
39
- end
40
- ```
41
-
42
- In this section we define targets using keywords: target, run, expect and get.
43
-
44
- * **get** keyword is used to read params from configuracion file. It's posible personalize tests with diferent values for every case.
45
-
46
- > NOTE: In this example, we assume GNU/Linux as localhost's OS.
47
-
48
- ## Execution section
49
-
50
- Main execution block:
51
- ```ruby
52
- play do
53
- show
54
- export
55
- end
56
- ```
57
-
58
- Runing this example and see `show` keyword output:
59
-
60
- ```bash
61
- > teuton run examples/02-config
62
-
63
- CASE RESULTS
64
- +------+----------------+-------+-------+
65
- | CASE | MEMBERS | GRADE | STATE |
66
- | 01 | Student-name-1 | 100.0 | ✔ |
67
- | 02 | Student-name-2 | 0.0 | ? |
68
- +------+----------------+-------+-------+
69
- ```
70
-
71
- ## Results
72
-
73
- Output reports are saved into `var/02-config/` directory. Detail output report is created for every case.
74
-
75
- ```
76
- var/02-config
77
- ├── case-01.txt
78
- ├── case-02.txt
79
- ├── moodle.csv
80
- └── resume.txt
81
- ```
82
-
83
- Let's see `export` keyword output for case 01.
84
-
85
- ```
86
- > more var/02-config/case-01.txt
87
- CONFIGURATION
88
- +-------------+----------------+
89
- | tt_members | Student-name-1 |
90
- | tt_sequence | false |
91
- | tt_skip | false |
92
- | tt_testname | 02-config |
93
- | username | root |
94
- +-------------+----------------+
95
-
96
- GROUPS
97
- - Reading params from config file
98
- 01 (1.0/1.0)
99
- Description : Create user root
100
- Command : id root
101
- Duration : 0.002 (local)
102
- Alterations : find(root) & count
103
- Expected : Greater than 0 (String)
104
- Result : 1 (Integer)
105
-
106
- RESULTS
107
- +--------------+---------------------------+
108
- | case_id | 01 |
109
- | start_time | 2022-12-24 13:33:49 +0000 |
110
- | finish_time | 2022-12-24 13:33:49 +0000 |
111
- | duration | 0.001777756 |
112
- | unique_fault | 0 |
113
- | max_weight | 1.0 |
114
- | good_weight | 1.0 |
115
- | fail_weight | 0.0 |
116
- | fail_counter | 0 |
117
- | grade | 100 |
118
- +--------------+---------------------------+
119
- ```
120
-
121
- > **How to choose another config file?** Read this [document](../commands/example_run.md#3-choosing-config-file).
@@ -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
- ```