teuton 2.1.1 → 2.1.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -21
  3. data/docs/Challenge-Server-Project.md +50 -0
  4. data/docs/changelog/servidor-de-retos.md +53 -0
  5. data/docs/changelog/todo.md +46 -0
  6. data/docs/changelog/v2.0.md +17 -0
  7. data/docs/changelog/v2.1.md +139 -0
  8. data/docs/commands/commands.md +10 -0
  9. data/docs/commands/create_skeleton.md +31 -0
  10. data/docs/commands/help.md +13 -0
  11. data/docs/commands/revise_test.md +46 -0
  12. data/docs/commands/run_test_unit.md +78 -0
  13. data/docs/commands/show_version.md +9 -0
  14. data/docs/developers/01-telnet.md +121 -0
  15. data/docs/developers/02-ssh.md +93 -0
  16. data/docs/developers/03-encoding.md +153 -0
  17. data/docs/developers/comparative.md +17 -0
  18. data/docs/dsl/_Sidebar.md +30 -0
  19. data/docs/dsl/definition/expect.md +56 -0
  20. data/docs/dsl/definition/goto.md +112 -0
  21. data/docs/dsl/definition/group.md +16 -0
  22. data/docs/dsl/definition/result.md +76 -0
  23. data/docs/dsl/definition/run.md +23 -0
  24. data/docs/dsl/definition/target.md +35 -0
  25. data/docs/dsl/execution/export.md +39 -0
  26. data/docs/dsl/execution/play.md +16 -0
  27. data/docs/dsl/execution/send.md +54 -0
  28. data/docs/dsl/execution/show.md +21 -0
  29. data/docs/dsl/keywords.md +53 -0
  30. data/docs/dsl/setting/get.md +36 -0
  31. data/docs/dsl/setting/set.md +18 -0
  32. data/docs/install/install.md +32 -0
  33. data/docs/install/manual_install.md +25 -0
  34. data/docs/install/modes_of_use.md +38 -0
  35. data/docs/install/scripts_install.md +76 -0
  36. data/docs/install/tested_od.md +25 -0
  37. data/docs/install/vagrant_install.md +15 -0
  38. data/docs/learn/example-01-target.md +117 -0
  39. data/docs/learn/example-02-configfile.md +168 -0
  40. data/docs/learn/example-03-remote-hosts.md +90 -0
  41. data/docs/learn/example-04-use.md +74 -0
  42. data/docs/learn/example-05-debug.md +104 -0
  43. data/docs/learn/example-11-first-test.md +96 -0
  44. data/docs/learn/learning.md +34 -0
  45. data/docs/learn/quick-demo.md +168 -0
  46. data/docs/learn/videos.md +13 -0
  47. data/lib/teuton/application.rb +1 -1
  48. data/lib/teuton/command/readme.rb +3 -0
  49. data/lib/teuton/command/test.rb +3 -0
  50. data/lib/teuton/command.rb +2 -2
  51. metadata +91 -5
  52. data/docs/logo.png +0 -0
@@ -0,0 +1,168 @@
1
+
2
+ Learn how to use config file into your tests.
3
+ Tests can use params defined into config files. It's good idea save variable data separated into external config file.
4
+
5
+ > This example is on GitHub repository `teuton-challenge` at `learn/learn-02-config`.
6
+
7
+ ## Config file (`config.yaml`)
8
+
9
+ ```yaml
10
+ ---
11
+ :global:
12
+ :cases:
13
+ - :tt_members: Student-name-1
14
+ :username: david
15
+ - :tt_members: Student-name-2
16
+ :username: fran
17
+ ```
18
+
19
+ ## Definitions (`start.rb`)
20
+
21
+ ```ruby
22
+ group "learn 02 config" do
23
+
24
+ target "Create user " + get(:username)
25
+ run "id " + get(:username)
26
+ expect get(:username)
27
+
28
+ end
29
+ ```
30
+
31
+ In this section we define targets using keywords: target, run, expect and get.
32
+
33
+ * **get** keyword is used to read param from configuracion file. It's posible personalize tests separated for every case.
34
+
35
+ > Localhost's OS must be GNU/Linux (any other compatible OS) because the command used is `id david`.
36
+
37
+ ## Main execution block
38
+
39
+ ```ruby
40
+ play do
41
+ show
42
+ # export using other output formats
43
+ export :format => :colored_text
44
+ end
45
+
46
+ ```
47
+
48
+ Runing this example and see `show` keyword output:
49
+
50
+ ```bash
51
+ $ teuton learn/learn-02-config
52
+ [INFO] ScriptPath => learn/learn-02-config/start.rb
53
+ [INFO] ConfigPath => learn/learn-02-config/config.yaml
54
+ [INFO] TestName => learn-02-config
55
+ ==================================
56
+ Executing [teuton] (version 2.0.1)
57
+ [INFO] Running in parallel (2019-06-20 11:20:49 +0100)
58
+ .id: «darth-maul»: no existe ese usuario
59
+ F
60
+ [INFO] Duration = 0.008375141 (2019-06-20 11:20:49 +0100)
61
+
62
+
63
+ ==================================
64
+ INITIAL CONFIGURATIONS
65
+ +---------------+------------------------------------------------------------------------------+
66
+ | tt_title | Executing [teuton] (version 2.0.1) |
67
+ | tt_scriptname | learn/learn-02-config/start.rb |
68
+ | tt_configfile | learn/learn-02-config/config.yaml |
69
+ | tt_testname | learn-02-config |
70
+ | tt_sequence | false |
71
+ +---------------+------------------------------------------------------------------------------+
72
+ CASE RESULTS
73
+ +---------+-------------+----------------+
74
+ | Case ID | % Completed | Members |
75
+ | Case_01 | 100% | Student-name-1 |
76
+ | Case_02 | 0% ? | Student-name-2 |
77
+ +---------+-------------+----------------+
78
+ FINAL VALUES
79
+ +-------------+---------------------------+
80
+ | start_time | 2019-06-20 11:20:49 +0100 |
81
+ | finish_time | 2019-06-20 11:20:49 +0100 |
82
+ | duration | 0.008375141 |
83
+ +-------------+---------------------------+
84
+ HALL OF FAME
85
+ +-----+---+
86
+ | 100 | * |
87
+ | 0 | * |
88
+ +-----+---+
89
+
90
+ ```
91
+ ---
92
+
93
+ ## Results
94
+
95
+ Output reports are saved into `var/learn-02-config/` directory.
96
+
97
+ ```
98
+ var/learn-02-config
99
+ ├── case-01.txt
100
+ ├── case-02.txt
101
+ └── resume.txt
102
+ ```
103
+
104
+ Let's see `export` keyword output.
105
+
106
+ ```
107
+ $ more var/learn-02-config/case-01.txt
108
+
109
+ CONFIGURATIONS
110
+ +------------+----------------+
111
+ | tt_members | Student-name-1 |
112
+ | username | root |
113
+ | tt_skip | false |
114
+ +------------+----------------+
115
+
116
+ TEST
117
+ ======================
118
+ GROUP: learn 02 config
119
+ 01 (1.0/1.0)
120
+ Description : Checking user <root>
121
+ Command : id root
122
+ Duration : 0.003 (local)
123
+ Alterations : find(root) & count
124
+ Expected : Greater than 0 (String)
125
+ Result : 1 (Integer)
126
+
127
+ RESULTS
128
+ +--------------+---------------------------+
129
+ | case_id | 1 |
130
+ | start_time_ | 2019-06-20 12:29:41 +0100 |
131
+ | finish_time | 2019-06-20 12:29:42 +0100 |
132
+ | duration | 0.003650038 |
133
+ | unique_fault | 0 |
134
+ | max_weight | 1.0 |
135
+ | good_weight | 1.0 |
136
+ | fail_weight | 0.0 |
137
+ | fail_counter | 0 |
138
+ | grade | 100 |
139
+ +--------------+---------------------------+
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Using other config files
145
+
146
+ **Default names:**:
147
+ By default, when you run `teuton play foo`, this will search for:
148
+ * `foo/start.rb` test file and
149
+ * `foo/config.yaml` config file.
150
+
151
+ **Using cname param:**
152
+ But it's posible run `teuton play --cname=rock foo`, and this will search for:
153
+ * `foo/start.rb` test file and
154
+ * `foo/rock.yaml` config file.
155
+
156
+ `cname` param searchs YAML config file into the same project folder.
157
+
158
+ **Using cpath param:**
159
+ An also, it's posible run `teuton play --cpath=/home/david/startwars.yaml foo`, and this will search for:
160
+ * `foo/start.rb` test file and
161
+ * `/home/david/starwars.yaml` config file.
162
+
163
+ `cpath` param use YAML config file, from the specified path.
164
+
165
+ **Using diferent main rb name:**
166
+ When you run `teuton play foo/mazingerz.rb`, this will search for:
167
+ * `foo/mazingerz.rb` test file and
168
+ * `foo/mazingerz.yaml` config file.
@@ -0,0 +1,90 @@
1
+
2
+ Learn how to:
3
+ * Check a group of remote hosts.
4
+ * Export reports using other output formats.
5
+ * Checking remote machine (host1) with Windows OS.
6
+
7
+ > This example is on GitHub repository `teuton-challenge` at `learn/learn-03-remote-hosts`.
8
+
9
+ ## Config file (`config.yaml`)
10
+
11
+ ```yaml
12
+ ---
13
+ :global:
14
+ :host1_username: root
15
+ :host1_password: profesor
16
+ :cases:
17
+ - :tt_members: Darth Maul
18
+ :host1_ip: 192.168.1.201
19
+ :host1_hostname: siths
20
+ :username: maul
21
+ - :tt_members: R2D2
22
+ :host1_ip: 192.168.1.202
23
+ :host1_hostname: robots
24
+ :username: r2d2
25
+ - :tt_members: Obiwan Kenobi
26
+ :host1_ip: 192.168.1.203
27
+ :host1_hostname: jedis
28
+ :username: obiwan
29
+ ```
30
+
31
+ ## Definitions (group section)
32
+
33
+ Defining 3 targets to be checked:
34
+
35
+ ```ruby
36
+ group "learn 03 remote hosts" do
37
+
38
+ target "Hostname is <#{get(:host1_hostname)}>"
39
+ goto :host1, :exec => "hostname"
40
+ expect_one get(:host1_hostname)
41
+
42
+ target "DNS Server OK"
43
+ goto :host1, :exec => "nslookup www.google.es"
44
+ expect "Nombre:"
45
+
46
+ target "Exist user <#{get(:username)}>"
47
+ goto :host1, :exec => "net user"
48
+ expect get(:username)
49
+
50
+ end
51
+ ```
52
+
53
+ > Remote machine (host1) OS must be Windows.
54
+
55
+ ## Execution (play section)
56
+
57
+ ```ruby
58
+ play do
59
+ show
60
+ # export using other output formats
61
+ export :format => :colored_text
62
+ export :format => :json
63
+ send :copy_to => :host1
64
+ end
65
+ ```
66
+
67
+ * `show`, show process log on screen.
68
+ * `export :format => :json`, create output reports into `var/learn-03-remote-host/` directory. We can use diferents format to export: txt, colored_text, json and yaml.
69
+ * `send :copy_to => :host1` keyword copy output report into remote machine (host1).
70
+
71
+ ## Output reports
72
+
73
+ ```
74
+ $ tree var
75
+ var
76
+ └── learn-03-remote-hosts
77
+ ├── case-01.colored_text
78
+ ├── case-01.json
79
+ ├── case-02.colored_text
80
+ ├── case-02.json
81
+ ├── case-03.colored_text
82
+ ├── case-03.json
83
+ ├── resume.colored_text
84
+ └── resume.json
85
+ ```
86
+
87
+ * `case-01`, report with details about case 01 (maul)
88
+ * `case-02`, report with details about case 02 (r2d2)
89
+ * `case-03`, report with details about case 03 (obiwan)
90
+ * `cresume`, report with global resumed information about all cases.
@@ -0,0 +1,74 @@
1
+
2
+ Learn how to:
3
+ * Organize huge amount of groups/targets into several files.
4
+ * Checking Windows OS infrastructure (host1).
5
+
6
+ > This example is on GitHub repository `teuton-challenge` at `learn/learn-04-use`.
7
+
8
+ ## Tree directory
9
+
10
+ This example has more files:
11
+
12
+ ```bash
13
+ $ tree learn/learn-04-use
14
+ learn/learn-04-require
15
+ ├── config.yaml
16
+ ├── network.rb
17
+ ├── README.md
18
+ ├── start.rb
19
+ └── users.rb
20
+ ```
21
+
22
+ * `README.md` and `config.yaml` are the same as previous examples.
23
+
24
+ ## Execution (play section)
25
+
26
+ Previous `start.rb` file is splited in: start.rb, users.rb and network.rb.
27
+
28
+ Let's see current `start.rb` file:
29
+
30
+ ```ruby
31
+ use 'users'
32
+ use 'network'
33
+
34
+ play do
35
+ show
36
+ export
37
+ end
38
+ ```
39
+
40
+ * `use`, indicates external rb file that will be included/imported into main rb file. It's a good idea to organize project files, when the number of groups/targets is high.
41
+
42
+ ## Definitions (user section)
43
+
44
+ > Require Windows OS on remote machine.
45
+
46
+ Let's see `users.rb` file
47
+ ```ruby
48
+ group "User configuration" do
49
+ target "Exist user <#{get(:username)}>"
50
+ goto :host1, :exec => "net user"
51
+ expect get(:username)
52
+ end
53
+
54
+ ```
55
+
56
+ ## Definitions (network section)
57
+
58
+ > Require Windows OS on remote machine.
59
+
60
+ Let's see `network.rb` file:
61
+
62
+ ```ruby
63
+ group "Network configuracion" do
64
+
65
+ target "Hostname is <#{get(:host1_hostname)}>"
66
+ goto :host1, :exec => "hostname"
67
+ expect_one get(:host1_hostname)
68
+
69
+ target "DNS Server OK"
70
+ goto :host1, :exec => "nslookup www.nba.es"
71
+ expect "Nombre:"
72
+
73
+ end
74
+ ```
@@ -0,0 +1,104 @@
1
+
2
+ Learn how to:
3
+ * Check test syntax.
4
+ * Debug your tests.
5
+
6
+ > This example is on GitHub repository `teuton-challenge` at `learn/learn-05-debug`.
7
+
8
+ ## Tree directory
9
+
10
+ ```bash
11
+ $ tree learn/learn-05-debug
12
+ learn/learn-05-debug
13
+ ├── config.yaml
14
+ ├── external.rb
15
+ ├── internal.rb
16
+ ├── README.md
17
+ └── start.rb
18
+ ```
19
+
20
+ ## Execution (play section)
21
+
22
+ The `start.rb` is main execution rb file, and uses `external` and `internal` rb files.
23
+
24
+ Let's see current `start.rb` file:
25
+
26
+ ```ruby
27
+ use 'external'
28
+ use 'internal'
29
+
30
+ play do
31
+ show
32
+ export :format => :colored_text
33
+ end
34
+ ```
35
+
36
+ ## Debugging: Testing rb files
37
+
38
+ 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 (That's good) to load other files.
39
+
40
+ When this happend, sometimes we need to verify or check rb file consistency and syntax, and we will do it with `teuton test PATH/TO/PROJECT/FOLDER`. Let's see an example:
41
+
42
+ ```bash
43
+ $ teuton test learn/learn-01-target
44
+ [INFO] ScriptPath => ...epos/teuton.d/units/learn/learn-01-target/start.rb
45
+ [INFO] ConfigPath => ...s/teuton.d/units/learn/learn-01-target/config.yaml
46
+ [INFO] TestName => learn-01-target
47
+
48
+ +------------------------+
49
+ | GROUP: learn-01-target |
50
+ +------------------------+
51
+ (001) target Create user <david>
52
+ weight 1.0
53
+ goto localhost and {:exec=>"id david"}
54
+ expect david (String)
55
+
56
+ +--------------+-------+
57
+ | DSL Stats | Count |
58
+ +--------------+-------+
59
+ | Groups | 1 |
60
+ | Targets | 1 |
61
+ | Goto | 1 |
62
+ | * localhost | 1 |
63
+ | Uniques | 0 |
64
+ | Logs | 0 |
65
+ | | |
66
+ | Gets | 0 |
67
+ | Sets | 0 |
68
+ +--------------+-------+
69
+ +----------------------+
70
+ | Revising CONFIG file |
71
+ +----------------------+
72
+ [WARN] File /home/david/proy/repos/teuton.d/units/learn/learn-01-target/config.yaml not found!
73
+ [INFO] Recomended content:
74
+ ---
75
+ :global:
76
+ :cases:
77
+ - :tt_members: VALUE
78
+ ```
79
+
80
+ In this case, Teuton detects that there isn't config file and propose us content for `config.yaml`.
81
+
82
+ ## Debugging: Result content
83
+
84
+ Every time we invoke `goto` or `run` keywork, a OS command is executed and the output showed on screen is captured by Teuton and saved into `result` internal object.
85
+
86
+ We coul debug it invoking `result.debug` into our rb file. Let's see an example from `external.rb.rb` file:
87
+
88
+ ```ruby
89
+ group "Windows: external configuration" do
90
+
91
+ target "Localhost: Verify connectivity with #{gett(:windows1_ip)}"
92
+ run "ping #{get(:windows1_ip)} -c 1"
93
+ result.debug
94
+ expect_one "0% packet loss"
95
+ result.debug
96
+
97
+ target "Localhost: netbios-ssn service working on #{gett(:windows1_ip)}"
98
+ run "nmap -Pn #{get(:windows1_ip)}"
99
+ expect "139/tcp", "open"
100
+
101
+ end
102
+ ```
103
+
104
+ `result.debug` it's usefull when you are verifying what command ouput has been captured by Teuton.
@@ -0,0 +1,96 @@
1
+
2
+ Steps:
3
+ 1. Create skeleton
4
+ 2. Personalize targets
5
+ 3. Personalize configuration file
6
+ 4. Run the challenge
7
+
8
+ ---
9
+
10
+ ## STEP 1: Create skeleton
11
+
12
+ Create skeleton for a new project: `teuton create foo`
13
+
14
+ ```bash
15
+ $ teuton create foo
16
+
17
+ [INFO] Create project <foo>
18
+ * Create dir => foo
19
+ * Create dir => foo/assets
20
+ * Create file => foo/start.rb
21
+ * Create file => foo/config.yaml
22
+ * Create file => foo/.gitignore
23
+ * Create file => foo/assets/README.md
24
+ ```
25
+
26
+ > It's posible to create these files by hand.
27
+
28
+ This command will create:
29
+
30
+ | File/Directory | Description |
31
+ | --------------- | -------------- |
32
+ | foo | Base directory |
33
+ | foo/assets | Base directory for assest (images and text files) |
34
+ | foo/start.rb | Main Script |
35
+ | foo/config.yaml | YAML configuration file |
36
+ | foo/.gitignore | Prevent uploading YAML files to git repository |
37
+ | foo/assets/README.md | Statement of practice |
38
+
39
+ ---
40
+
41
+ ## STEP 2: Personalize targets
42
+
43
+ Write your own targets using the keywords: `target`, `goto` and `expect`. Let's see an example:
44
+
45
+ ```ruby
46
+ group "Demo group" do
47
+
48
+ target "Exist </home/david> directory"
49
+ goto :host1, :exec => "file /home/david"
50
+ expect ["/home/david", "directory"]
51
+
52
+ end
53
+ ```
54
+
55
+ The above example checks if exists 'yoda' user, on *host1* system.
56
+
57
+ > Let's see the keywords used:
58
+ >
59
+ > * `target "Exist </home/david> directory"`, Describe the target with our words, so every one could easily understand what we are trying
60
+ to check.
61
+ > * `goto :host1, :exec => "file /home/david"`: Execute the command
62
+ into the remote machine (host1).
63
+ > * `expect ["/home/david", "directory"]`: Compare command ouput with our expectations.
64
+
65
+ ---
66
+
67
+ ## STEP 3: Personalize Configfile
68
+
69
+ 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).
70
+
71
+ **Example**:
72
+
73
+ ```yaml
74
+ ---
75
+ :global:
76
+ :host1_username: root
77
+ :cases:
78
+ - :tt_members: Student 01 name or alias
79
+ :host1_ip: 1.1.1.1
80
+ :host1_password: root-password-student-01
81
+ - :tt_members: Student 02 name or alias
82
+ :host1_ip: 2.2.2.2
83
+ :host1_password: root-password-student-02
84
+ ```
85
+
86
+ > The above file configures 2 diferents cases with their own params. The script use this information when execute every case.
87
+
88
+ ---
89
+
90
+ ## STEP 4: run the challenge
91
+
92
+ Now we only have to run the challenge:
93
+
94
+ ```bash
95
+ $ teuton foo
96
+ ```
@@ -0,0 +1,34 @@
1
+
2
+ # Learning
3
+
4
+ Learn how to write your own tests reading examples.
5
+ - [Quick demo](quick-demo.md)
6
+ - [Example 01 - Target](example-01-target.md)
7
+ - [Example 02 - Config file](example-02-configfile.md)
8
+ - [Example 03 - Remote hosts](example-03-remote-hosts.md)
9
+ - [Example 04 - Use](example-04-use.md)
10
+ - [Example 05 - Debug](example-05-debug.md)
11
+ - [Example 11 - Create your first test](example-11-first-test.md)
12
+ - [Videos](videos.md)
13
+
14
+ ---
15
+ # More examples
16
+
17
+ * Let's see examples at [teuton-challenges](https://github.com/teuton-software/teuton-challenges) GitHub repository.
18
+ * Ask us by email at `teuton.software@protonmail.com` or Twitter at `@SoftwareTeuton`.
19
+ * [CHAPI19 - Spanish Teuton demo](https://github.com/dvarrui/proyectos-de-ejemplo/tree/master/charlas/teuton)
20
+
21
+ ---
22
+ # Videos
23
+
24
+ By now there are no English videos. We are sorry!
25
+ But if you want to see Spanish videos, here you are:
26
+
27
+ Teuton (v2.0):
28
+ * [CHAPI19 - Charla Teuton](https://youtu.be/KFWQDfNAFxI?t=12221)
29
+
30
+ Sysadmingame (Teuton v1.0)
31
+ * [Sysadmingame (1 de 3): Instalación del programa](https://youtu.be/dnyMq9_KDco)
32
+ * [Sysadmingame (2 de 3): Crear un caso simple](https://youtu.be/0e2g5Izvc6c)
33
+ * [Sysadmingame (3 de 3): Crear un caso complejo](https://youtu.be/ebEK6OXH8kQ)
34
+ * [CHAPI16 - Charla sysadmingame](https://youtu.be/cNJaB5xzHHQ)