teuton 2.1.8 → 2.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -8
- data/bin/check_teuton +43 -0
- data/docs/changelog/contributions.md +32 -0
- data/docs/changelog/v2.1.md +22 -0
- data/docs/changelog/v2.2.md +29 -0
- data/docs/commands/README.md +105 -7
- data/docs/commands/example_check.md +54 -0
- data/docs/commands/example_run.md +112 -0
- data/docs/dsl/README.md +11 -9
- data/docs/dsl/definition/expect.md +25 -21
- data/docs/dsl/definition/group.md +5 -1
- data/docs/dsl/definition/result.md +45 -34
- data/docs/dsl/definition/run_local.md +34 -0
- data/docs/dsl/definition/run_remote.md +119 -0
- data/docs/dsl/definition/target.md +6 -0
- data/docs/dsl/execution/export.md +27 -19
- data/docs/dsl/execution/play.md +4 -0
- data/docs/dsl/execution/send.md +21 -2
- data/docs/dsl/execution/show.md +13 -8
- data/docs/dsl/setting/get.md +24 -8
- data/docs/dsl/setting/set.md +8 -3
- data/docs/install/README.md +19 -26
- data/docs/install/modes_of_use.md +27 -26
- data/docs/install/scripts.md +53 -36
- data/docs/install/vagrant_docker.md +56 -0
- data/docs/learn/README.md +13 -6
- data/docs/learn/example-01-target.md +78 -61
- data/docs/learn/example-02-config.md +152 -0
- data/docs/learn/example-03-remote-hosts.md +31 -25
- data/docs/learn/example-04-use.md +23 -17
- data/docs/learn/example-05-debug.md +24 -17
- data/docs/learn/example-06-log.md +70 -0
- data/lib/teuton/application.rb +7 -4
- data/lib/teuton/case_manager/case/case.rb +4 -1
- data/lib/teuton/case_manager/case/dsl/expect.rb +3 -1
- data/lib/teuton/case_manager/case/dsl/goto.rb +12 -7
- data/lib/teuton/case_manager/case/dsl/macro.rb +38 -0
- data/lib/teuton/case_manager/case/dsl/main.rb +1 -2
- data/lib/teuton/case_manager/case/dsl/target.rb +1 -1
- data/lib/teuton/case_manager/case/runner.rb +7 -7
- data/lib/teuton/case_manager/case_manager.rb +1 -20
- data/lib/teuton/case_manager/check_cases.rb +12 -2
- data/lib/teuton/case_manager/dsl.rb +4 -6
- data/lib/teuton/case_manager/export_manager.rb +29 -3
- data/lib/teuton/case_manager/report.rb +29 -8
- data/lib/teuton/case_manager/show.rb +8 -4
- data/lib/teuton/cli.rb +1 -0
- data/lib/teuton/cli/play.rb +1 -0
- data/lib/teuton/cli/version.rb +1 -4
- data/lib/teuton/files/config.yaml +0 -1
- data/lib/teuton/files/start.rb +1 -1
- data/lib/teuton/files/template/case.html +135 -0
- data/lib/teuton/files/template/resume.html +115 -0
- data/lib/teuton/project/laboratory/builtin.rb +2 -1
- data/lib/teuton/project/laboratory/dsl.rb +13 -15
- data/lib/teuton/project/laboratory/laboratory.rb +5 -1
- data/lib/teuton/project/laboratory/show.rb +21 -13
- data/lib/teuton/project/name_file_finder.rb +6 -1
- data/lib/teuton/project/project.rb +7 -3
- data/lib/teuton/project/readme/dsl.rb +3 -1
- data/lib/teuton/project/readme/readme.rb +37 -26
- data/lib/teuton/project/skeleton.rb +20 -4
- data/lib/teuton/report/close.rb +15 -11
- data/lib/teuton/report/formatter/formatter_factory.rb +10 -6
- data/lib/teuton/report/formatter/html_formatter.rb +16 -79
- data/lib/teuton/report/formatter/resume_html_formatter.rb +39 -0
- data/lib/teuton/report/formatter/resume_yaml_formatter.rb +7 -1
- data/lib/teuton/report/report.rb +5 -4
- data/lib/teuton/report/show.rb +55 -26
- metadata +26 -39
- data/docs/changelog/todo.md +0 -46
- data/docs/commands/create_skeleton.md +0 -31
- data/docs/commands/help.md +0 -13
- data/docs/commands/revise_test.md +0 -46
- data/docs/commands/run_test_unit.md +0 -78
- data/docs/commands/show_version.md +0 -9
- data/docs/developers/01-telnet.md +0 -121
- data/docs/developers/02-ssh.md +0 -93
- data/docs/developers/03-encoding.md +0 -153
- data/docs/developers/comparative.md +0 -17
- data/docs/dsl/_Sidebar.md +0 -30
- data/docs/dsl/definition/goto.md +0 -112
- data/docs/dsl/definition/run.md +0 -23
- data/docs/install/tested_os.md +0 -25
- data/docs/install/vagrant.md +0 -9
- data/docs/learn/example-02-configfile.md +0 -174
- data/docs/learn/quick-demo.md +0 -170
- data/lib/teuton/case_manager/case/dsl/check.rb +0 -24
- data/lib/teuton/case_manager/case/dsl/missing.rb +0 -12
- data/lib/teuton/files/gitignore +0 -2
@@ -1,153 +0,0 @@
|
|
1
|
-
|
2
|
-
# 03 - Encoding (Charset)
|
3
|
-
|
4
|
-
---
|
5
|
-
|
6
|
-
# 1. Introducción
|
7
|
-
|
8
|
-
Supongamos que tenemos la siguiente instrucción de SysadminGame:
|
9
|
-
|
10
|
-
`goto :host1, :exec => "whoami"`
|
11
|
-
|
12
|
-
Con esta instrucción se abre una conexión remota al equipo `:host1` y se ejecuta el comando `whoami`.
|
13
|
-
Luego el texto obtenido se guarda en una variable String que luego se convierte en un Array con cada
|
14
|
-
una de las líneas del texto de salida del comando. Ejemplo:
|
15
|
-
|
16
|
-
```
|
17
|
-
# Si text es el texto devuelto por el comando entonces output es un Array de Strings
|
18
|
-
output = text.split("\n")
|
19
|
-
```
|
20
|
-
|
21
|
-
La variable String de ruby trabaja con codificación 'UTF-8'. En el momento de ejecutar
|
22
|
-
`text.split("\n")` se espera que text esté codificado 'UTF-8'. En caso contrario tenemos un error.
|
23
|
-
|
24
|
-
---
|
25
|
-
|
26
|
-
# 2. Problema
|
27
|
-
|
28
|
-
Cuando ejecutamos:
|
29
|
-
|
30
|
-
`goto :win1, :exec => "get-windowsfeature -name rds-rd-server"`
|
31
|
-
|
32
|
-
siendo `:win1` un Windows 2012 server tenemos un error.
|
33
|
-
|
34
|
-
Si ejecutamos el comando manualmente obtenemos la siguiente salida:
|
35
|
-
|
36
|
-
```
|
37
|
-
david@camaleon:~/proy/tools/sysadmin-game> ssh administrador@192.168.1.114 'get-windowsfeature -name rds-rd-server'
|
38
|
-
administrador@192.168.1.114's password:
|
39
|
-
|
40
|
-
Display Name Name
|
41
|
-
------------ ----
|
42
|
-
[ ] Host de sesi�n de Escritorio remoto RDS-RD-Server
|
43
|
-
```
|
44
|
-
|
45
|
-
Como podemos comprobar, este comando genera una salida con tildes codificada en ISO-8859-1. Y ahí están el problema.
|
46
|
-
|
47
|
-
---
|
48
|
-
|
49
|
-
# 3. Solución
|
50
|
-
|
51
|
-
La solución que se propone es poner la siguiente instrucción en esos casos:
|
52
|
-
|
53
|
-
`goto :win1, :exec => "get-windowsfeature -name rds-rd-server", :encoding => "ISO-8859-1"`
|
54
|
-
|
55
|
-
Esto es, para las salidas de los comandos que requieran conversión de tipo, se debe
|
56
|
-
especificar con `:encoding` el tipo de codificación que se recibirá. Luego ésta se convierte
|
57
|
-
internamente a 'UTF-8' y a partir de ahí todo funcionará correctamente.
|
58
|
-
|
59
|
-
---
|
60
|
-
|
61
|
-
# 4. Comentarios
|
62
|
-
|
63
|
-
Entiendo que es una molestia indicar la codificación en algunos comandos/servidores especiales. Pero por ahora no se puede asumir que siempre se recibirán los caracteres con la misma codificación.
|
64
|
-
|
65
|
-
---
|
66
|
-
|
67
|
-
# 5. ¿Cómo averiguar el encoding (charset) de forma automática?
|
68
|
-
|
69
|
-
Hablando con _Albérica_, el problema anterior, ella comenta la idea de buscar la forma de encontrar el `encoding` de forma automática. Me pongo a pensar y escribo lo siguiente:
|
70
|
-
|
71
|
-
> **Leer el encoding de los ficheros y cómo cambiarlo**
|
72
|
-
>
|
73
|
-
> En ciertas ocasiones es necesario [cambiar el encoding de una archivo](http://lacapa8v2.blogspot.com/2012/07/como-saber-y-cambiar-el-charset.html#.XDvPZqHLfQo), Con el comando file y la opción mime se puede saber el charset de un archivo.
|
74
|
-
> Veamos un ejemplo:
|
75
|
-
>
|
76
|
-
> $ file --mime test.html
|
77
|
-
> test.html: text/plain; charset=iso-8859-1
|
78
|
-
>
|
79
|
-
> Para cambiar el charset, usaremos el comando iconv:
|
80
|
-
>
|
81
|
-
> $ iconv --from-code=iso-8859-1 --to-code=utf-8 test.html > test_new.html
|
82
|
-
|
83
|
-
**¿Qué pasa con la salida de los comandos de un OpenSUSE en español?**
|
84
|
-
|
85
|
-
Me aseguro que tengo el sistema operativo en español:
|
86
|
-
```
|
87
|
-
> locale
|
88
|
-
|
89
|
-
LANG=es_ES.utf8
|
90
|
-
LC_CTYPE=es_ES.utf8
|
91
|
-
LC_NUMERIC="es_ES.utf8"
|
92
|
-
LC_TIME="es_ES.utf8"
|
93
|
-
LC_COLLATE="es_ES.utf8"
|
94
|
-
LC_MONETARY="es_ES.utf8"
|
95
|
-
LC_MESSAGES="es_ES.utf8"
|
96
|
-
LC_PAPER="es_ES.utf8"
|
97
|
-
LC_NAME="es_ES.utf8"
|
98
|
-
LC_ADDRESS="es_ES.utf8"
|
99
|
-
LC_TELEPHONE="es_ES.utf8"
|
100
|
-
LC_MEASUREMENT="es_ES.utf8"
|
101
|
-
LC_IDENTIFICATION="es_ES.utf8"
|
102
|
-
LC_ALL=
|
103
|
-
```
|
104
|
-
Ahora vamos a comprobar el charset de la salida de algún comando:
|
105
|
-
```
|
106
|
-
$ pwd > /tmp/pwd.tmp
|
107
|
-
$ file --mime /tmp/pwd.tmp
|
108
|
-
pwd.tmp: text/plain; charset=us-ascii
|
109
|
-
```
|
110
|
-
|
111
|
-
> Interesante... La salida de los comandos tienen charset `us-ascii`,
|
112
|
-
a pesar de que mi sistema está en español.
|
113
|
-
>
|
114
|
-
> Me pregunto ¿funcionarán todos los comandos de la misma forma? Lo lógico es pensar que sí. En dicho caso podremos asumir que todos los comandos de GNU/Linux generan la salida con enconding us-ascii.
|
115
|
-
|
116
|
-
**¿Qué pasa con los comandos de W2012 en español?**
|
117
|
-
|
118
|
-
Averiguar el encoding que está usando por el terminal:
|
119
|
-
```
|
120
|
-
$ ssh administrador@192.168.1.114 'chcp' > chcp.tmp
|
121
|
-
administrador@192.168.1.114's password:
|
122
|
-
|
123
|
-
$ more /tmp/chcp.tmp
|
124
|
-
P�gina de c�digos activa: 850
|
125
|
-
|
126
|
-
$ file --mime /tmp/chcp.tmp
|
127
|
-
/tmp/chcp.tmp: text/plain; charset=iso-8859-1
|
128
|
-
```
|
129
|
-
|
130
|
-
O sea, que según el comando tiene charser `850` y luego el resultado del comando está en `iso-8859-1`. Pero no queda claro porque hay comandos que generan la salida en una codificación y otros en otra. Veamos:
|
131
|
-
|
132
|
-
```
|
133
|
-
$ ssh administrador@192.168.1.114 'pwd' > win.tmp
|
134
|
-
administrador@192.168.1.114's password:
|
135
|
-
|
136
|
-
$ file --mime win.tmp
|
137
|
-
win.tmp: text/plain; charset=us-ascii
|
138
|
-
|
139
|
-
$ ssh administrador@192.168.1.114 'chcp' > chcp.tmp
|
140
|
-
administrador@192.168.1.114's password:
|
141
|
-
|
142
|
-
$ ssh administrador@192.168.1.114 'get-windowsfeature -name rds-rd-server' > gwf.tmp
|
143
|
-
administrador@192.168.1.114's password:
|
144
|
-
|
145
|
-
$ file --mime /tmp/gwf.tmp
|
146
|
-
/tmp/gwf.tmp: text/plain; charset=iso-8859-1
|
147
|
-
```
|
148
|
-
|
149
|
-
> Pues la salida de los comandos de W2012 son:
|
150
|
-
> * `us-ascii` algunas veces, y otras en
|
151
|
-
> * `iso-8859-1`
|
152
|
-
>
|
153
|
-
> ¿De qué depende? ¿Qué comandos usan cada encoding?
|
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
# Infrastructure test comparison
|
3
|
-
|
4
|
-
|
5
|
-
| Features | Teuton | Testinfra | Goss |
|
6
|
-
| -------- | ------ | --------- | ---- |
|
7
|
-
| URL | https://github.com/teuton-software/teuton | https://testinfra.readthedocs.io/en/latest/index.html | https://github.com/aelsabbahy/goss |
|
8
|
-
| License | GPL v.3 | Apache license 2.0 | Apache license 2.0 |
|
9
|
-
| Programming language | Ruby | Python | Go |
|
10
|
-
| Platforms | Multiplatform | Multiplatform | GNU/Linux |
|
11
|
-
| Remote connections | SSH, Telnet | SSH | ? |
|
12
|
-
| Installed on | Master | Slave | |
|
13
|
-
| Test Units Lenguage definition | Teuton DSL | Python | YAML |
|
14
|
-
| Configuration input files | YAML, JSON | Python | YAML |
|
15
|
-
| Output formats | Documentation, TXT, YAML, JSON, silent | ? | rspecish, documentation, JSON, TAP, JUnit, nagios, silent |
|
16
|
-
| Builtin functions | Yes | Yes | ... |
|
17
|
-
| Function creation | Yes | ? | ? |
|
data/docs/dsl/_Sidebar.md
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
|
2
|
-
# Keywords (DSL)
|
3
|
-
|
4
|
-
- [[DSL keywords]]
|
5
|
-
|
6
|
-
Definition
|
7
|
-
|
8
|
-
- [[group]]
|
9
|
-
- [[target]]
|
10
|
-
- [[goto]]
|
11
|
-
- [[run]]
|
12
|
-
- [[result]]
|
13
|
-
- [[expect]]
|
14
|
-
- [[result]]
|
15
|
-
|
16
|
-
Execution
|
17
|
-
|
18
|
-
- [[play]]
|
19
|
-
- [[show]]
|
20
|
-
- [[export]]
|
21
|
-
- [[send]]
|
22
|
-
|
23
|
-
Settings
|
24
|
-
|
25
|
-
- [[get]]
|
26
|
-
- [[set]]
|
27
|
-
|
28
|
-
---
|
29
|
-
|
30
|
-
- [[Home]]
|
data/docs/dsl/definition/goto.md
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
|
2
|
-
## Description
|
3
|
-
|
4
|
-
Connect to remote host and executes command. The commadn output is saved into result object.
|
5
|
-
|
6
|
-
## Usage
|
7
|
-
|
8
|
-
```ruby
|
9
|
-
goto :host1, :exec => "id fran"
|
10
|
-
goto :host1, :execute => "id fran"
|
11
|
-
```
|
12
|
-
|
13
|
-
> ADVISE: I know that programers dislike `goto` sentence, but this is diferent. Think of it as english speaker, not as developer.
|
14
|
-
|
15
|
-
* This example connect to remote host identified by `host1`. Then we execute the command into it and save the output commadn into result object.
|
16
|
-
* `host1` is a lbal that identifies specific machine. Host information (ip, username, password, protocol) cames from config file.
|
17
|
-
|
18
|
-
## Examples
|
19
|
-
|
20
|
-
Execute `id obiwan` comand into remote host `linux1`.
|
21
|
-
```Ruby
|
22
|
-
goto :linux1, :exec => "id obiwan"
|
23
|
-
goto :linux1, :execute => "id obiwan"
|
24
|
-
goto :linux1, exec: "id obiwan"
|
25
|
-
goto :linux1, execute: "id obiwan"
|
26
|
-
```
|
27
|
-
|
28
|
-
Execute `id david` command into `localhost`.
|
29
|
-
|
30
|
-
```Ruby
|
31
|
-
goto :localhost, :exec => "id david"
|
32
|
-
goto :localhost, :execute => "id david"
|
33
|
-
run "id david"
|
34
|
-
```
|
35
|
-
|
36
|
-
## Protocol
|
37
|
-
|
38
|
-
**SSH connection**
|
39
|
-
|
40
|
-
By default, when invoking `goto :host1` sentence, Teuton try to open remote SSH session. This config files examples do the same:
|
41
|
-
|
42
|
-
Sample 1:
|
43
|
-
```
|
44
|
-
---
|
45
|
-
:config:
|
46
|
-
---
|
47
|
-
:global:
|
48
|
-
:cases:
|
49
|
-
- :tt_members: Student1
|
50
|
-
:host1_ip: 1.1.1.1
|
51
|
-
:host1_username: student
|
52
|
-
:host1_password: secret
|
53
|
-
```
|
54
|
-
|
55
|
-
Sample 2:
|
56
|
-
```
|
57
|
-
---
|
58
|
-
:config:
|
59
|
-
---
|
60
|
-
:global:
|
61
|
-
:cases:
|
62
|
-
- :tt_members: Student1
|
63
|
-
:host1_ip: 1.1.1.1
|
64
|
-
:host1_username: student
|
65
|
-
:host1_password: secret
|
66
|
-
:host1_protocol: ssh
|
67
|
-
```
|
68
|
-
|
69
|
-
**Telnet connection**
|
70
|
-
|
71
|
-
If you need to use telnet, then it's necessary specified that into config file. For example:
|
72
|
-
```
|
73
|
-
---
|
74
|
-
:global:
|
75
|
-
:cases:
|
76
|
-
- :tt_members: Student2
|
77
|
-
:host1_ip: 2.2.2.2
|
78
|
-
:host1_username: student
|
79
|
-
:host1_password: secret
|
80
|
-
:host1_protocol: telnet
|
81
|
-
```
|
82
|
-
|
83
|
-
**Localhost**
|
84
|
-
|
85
|
-
If our hostname is localhost, or the IP is 127.0.0.X, then Teuton will assume that you want to run your command on local system, and no session is opened. This examples are the same:
|
86
|
-
|
87
|
-
```
|
88
|
-
goto :localhost, :exec => "id david"
|
89
|
-
```
|
90
|
-
|
91
|
-
And
|
92
|
-
|
93
|
-
```
|
94
|
-
run "id david"
|
95
|
-
```
|
96
|
-
|
97
|
-
**SSH to localhost**
|
98
|
-
|
99
|
-
> NOTE: Only works on Teuton version >= 2.1.X
|
100
|
-
|
101
|
-
If you want to open SSH session to your localhost, then force SSH protocol into your config file, like this:
|
102
|
-
|
103
|
-
```
|
104
|
-
---
|
105
|
-
:global:
|
106
|
-
:cases:
|
107
|
-
- :tt_members: Student3
|
108
|
-
:host1_ip: 127.0.0.1
|
109
|
-
:host1_username: student
|
110
|
-
:host1_password: secret
|
111
|
-
:host1_protocol: ssh
|
112
|
-
```
|
data/docs/dsl/definition/run.md
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
|
2
|
-
## Description
|
3
|
-
|
4
|
-
Execute command on localhost and save output into result object.
|
5
|
-
|
6
|
-
**Alias**: In fact it's the same as doing `goto :localhost, :execute => "COMMAND"`.
|
7
|
-
|
8
|
-
> Then, why have another instruction? Because there are people who like doing this way.
|
9
|
-
|
10
|
-
## Usage
|
11
|
-
|
12
|
-
```ruby
|
13
|
-
run "id david"
|
14
|
-
```
|
15
|
-
|
16
|
-
## Example
|
17
|
-
|
18
|
-
```ruby
|
19
|
-
run "id david"
|
20
|
-
```
|
21
|
-
|
22
|
-
* This instruction execute "id david" command on local machine, and save results into `result` object.
|
23
|
-
* Local machine is where the `Teuton` program is running.
|
data/docs/install/tested_os.md
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
## GNU/Linux
|
2
|
-
|
3
|
-
| O.S. | Version | Arch | T-node | S-node |
|
4
|
-
| --------- | -------------- | ------ | ------ | ------ |
|
5
|
-
| CentOS | 7 | x86-64 | | |
|
6
|
-
| Debian | 9.7.0 | x86-64 | Ok | |
|
7
|
-
| Fedora | Workstation 29 | x84-64 | Ok | |
|
8
|
-
| LinuxMint | 18.3 | x86-64 | Ok | |
|
9
|
-
| openSUSE | Leap 15 | x86-64 | Ok | Ok |
|
10
|
-
| Ubuntu | 18.04 | x86-64 | Ok | Ok |
|
11
|
-
|
12
|
-
## Windows
|
13
|
-
|
14
|
-
| O.S. | Version | Arch | Nodo-T | Nodo-S |
|
15
|
-
| ------- | -------------- | ------ | ------ | ------ |
|
16
|
-
| Windows | 7 Enterprise | x86 | Ok | |
|
17
|
-
| Windows | 10 Pro | x86-64 | Ok | Ok |
|
18
|
-
| Windows | Server 2012 R2 | x86-64 | | |
|
19
|
-
|
20
|
-
## Mac OS X
|
21
|
-
|
22
|
-
| O.S | Version | Arch | T-Node | S-Node |
|
23
|
-
| -------- | -------------------- | ------ | ------ | ------ |
|
24
|
-
| Mac OS X | El Capitán (10.11.6) | x86-64 | Ok | Ok |
|
25
|
-
| Mac OS X | Sierra (10.12) | x86-64 | Ok | |
|
data/docs/install/vagrant.md
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
[<< back](README.md)
|
2
|
-
|
3
|
-
# Teuton installation using Vagrant
|
4
|
-
|
5
|
-
* First, you must have `Vagrant` installed.
|
6
|
-
* Create directory for your vagrant project. For example, `mkdir teuton-vagrant`.
|
7
|
-
* Move into that directory: `cd teuton-vagrant`.
|
8
|
-
* Choose and download [Vagrantfile](../../install/vagrant).
|
9
|
-
* Run `vagrant up` to create your Virtual Machine.
|
@@ -1,174 +0,0 @@
|
|
1
|
-
[<< back](README.md)
|
2
|
-
|
3
|
-
# Example: learn-02-config
|
4
|
-
|
5
|
-
* Learn how to use config file.
|
6
|
-
* Tests use params defined into config files.
|
7
|
-
* It's good idea save variable data separated into external config file.
|
8
|
-
|
9
|
-
> This example is on GitHub repository at `examples/learn-02-config`.
|
10
|
-
|
11
|
-
---
|
12
|
-
## Config file
|
13
|
-
|
14
|
-
By default, `config.yaml` is our config file. Let's an example:
|
15
|
-
|
16
|
-
```yaml
|
17
|
-
---
|
18
|
-
:global:
|
19
|
-
:cases:
|
20
|
-
- :tt_members: Student-name-1
|
21
|
-
:username: david
|
22
|
-
- :tt_members: Student-name-2
|
23
|
-
:username: fran
|
24
|
-
```
|
25
|
-
|
26
|
-
## Definitions
|
27
|
-
|
28
|
-
By default, `start.rb` it's our main execution file.
|
29
|
-
|
30
|
-
```ruby
|
31
|
-
group "learn 02 config" do
|
32
|
-
|
33
|
-
target "Create user " + get(:username)
|
34
|
-
run "id " + get(:username)
|
35
|
-
expect get(:username)
|
36
|
-
|
37
|
-
end
|
38
|
-
```
|
39
|
-
|
40
|
-
In this section we define targets using keywords: target, run, expect and get.
|
41
|
-
|
42
|
-
* **get** keyword is used to read param from configuracion file. It's posible personalize tests separated for every case.
|
43
|
-
|
44
|
-
> Localhost's OS must be GNU/Linux (any other compatible OS) because the command used is `id david`.
|
45
|
-
|
46
|
-
## Main execution block
|
47
|
-
|
48
|
-
```ruby
|
49
|
-
play do
|
50
|
-
show
|
51
|
-
export
|
52
|
-
end
|
53
|
-
```
|
54
|
-
|
55
|
-
Runing this example and see `show` keyword output:
|
56
|
-
|
57
|
-
```bash
|
58
|
-
$ teuton learn/learn-02-config
|
59
|
-
[INFO] ScriptPath => learn/learn-02-config/start.rb
|
60
|
-
[INFO] ConfigPath => learn/learn-02-config/config.yaml
|
61
|
-
[INFO] TestName => learn-02-config
|
62
|
-
==================================
|
63
|
-
Executing [teuton] (version 2.0.1)
|
64
|
-
[INFO] Running in parallel (2019-06-20 11:20:49 +0100)
|
65
|
-
.id: «darth-maul»: no existe ese usuario
|
66
|
-
F
|
67
|
-
[INFO] Duration = 0.008375141 (2019-06-20 11:20:49 +0100)
|
68
|
-
|
69
|
-
|
70
|
-
==================================
|
71
|
-
INITIAL CONFIGURATIONS
|
72
|
-
+---------------+------------------------------------------------------------------------------+
|
73
|
-
| tt_title | Executing [teuton] (version 2.0.1) |
|
74
|
-
| tt_scriptname | learn/learn-02-config/start.rb |
|
75
|
-
| tt_configfile | learn/learn-02-config/config.yaml |
|
76
|
-
| tt_testname | learn-02-config |
|
77
|
-
| tt_sequence | false |
|
78
|
-
+---------------+------------------------------------------------------------------------------+
|
79
|
-
CASE RESULTS
|
80
|
-
+---------+-------------+----------------+
|
81
|
-
| Case ID | % Completed | Members |
|
82
|
-
| Case_01 | 100% | Student-name-1 |
|
83
|
-
| Case_02 | 0% ? | Student-name-2 |
|
84
|
-
+---------+-------------+----------------+
|
85
|
-
FINAL VALUES
|
86
|
-
+-------------+---------------------------+
|
87
|
-
| start_time | 2019-06-20 11:20:49 +0100 |
|
88
|
-
| finish_time | 2019-06-20 11:20:49 +0100 |
|
89
|
-
| duration | 0.008375141 |
|
90
|
-
+-------------+---------------------------+
|
91
|
-
HALL OF FAME
|
92
|
-
+-----+---+
|
93
|
-
| 100 | * |
|
94
|
-
| 0 | * |
|
95
|
-
+-----+---+
|
96
|
-
|
97
|
-
```
|
98
|
-
---
|
99
|
-
|
100
|
-
## Results
|
101
|
-
|
102
|
-
Output reports are saved into `var/learn-02-config/` directory. Detail output report is created for every case.
|
103
|
-
|
104
|
-
```
|
105
|
-
var/learn-02-config
|
106
|
-
├── case-01.txt
|
107
|
-
├── case-02.txt
|
108
|
-
└── resume.txt
|
109
|
-
```
|
110
|
-
|
111
|
-
Let's see `export` keyword output for case 01.
|
112
|
-
|
113
|
-
```
|
114
|
-
$ more var/learn-02-config/case-01.txt
|
115
|
-
|
116
|
-
CONFIGURATIONS
|
117
|
-
+------------+----------------+
|
118
|
-
| tt_members | Student-name-1 |
|
119
|
-
| username | root |
|
120
|
-
| tt_skip | false |
|
121
|
-
+------------+----------------+
|
122
|
-
|
123
|
-
TEST
|
124
|
-
======================
|
125
|
-
GROUP: learn 02 config
|
126
|
-
01 (1.0/1.0)
|
127
|
-
Description : Checking user <root>
|
128
|
-
Command : id root
|
129
|
-
Duration : 0.003 (local)
|
130
|
-
Alterations : find(root) & count
|
131
|
-
Expected : Greater than 0 (String)
|
132
|
-
Result : 1 (Integer)
|
133
|
-
|
134
|
-
RESULTS
|
135
|
-
+--------------+---------------------------+
|
136
|
-
| case_id | 1 |
|
137
|
-
| start_time_ | 2019-06-20 12:29:41 +0100 |
|
138
|
-
| finish_time | 2019-06-20 12:29:42 +0100 |
|
139
|
-
| duration | 0.003650038 |
|
140
|
-
| unique_fault | 0 |
|
141
|
-
| max_weight | 1.0 |
|
142
|
-
| good_weight | 1.0 |
|
143
|
-
| fail_weight | 0.0 |
|
144
|
-
| fail_counter | 0 |
|
145
|
-
| grade | 100 |
|
146
|
-
+--------------+---------------------------+
|
147
|
-
```
|
148
|
-
|
149
|
-
---
|
150
|
-
## Using other config file names
|
151
|
-
|
152
|
-
**Default names:**:
|
153
|
-
By default, when you run `teuton run foo`, this will search for:
|
154
|
-
* `foo/start.rb` test file and
|
155
|
-
* `foo/config.yaml` config file.
|
156
|
-
|
157
|
-
**Using cname param:**
|
158
|
-
But it's posible run `teuton run --cname=rock foo`, and choose diferent config file into projet folder:
|
159
|
-
* `foo/start.rb` test file and
|
160
|
-
* `foo/rock.yaml` config file.
|
161
|
-
|
162
|
-
`cname` param searchs YAML config file into the same project folder.
|
163
|
-
|
164
|
-
**Using cpath param:**
|
165
|
-
An also, it's posible run `teuton run --cpath=/home/david/startwars.yaml foo`, and choose config file using its absolute path:
|
166
|
-
* `foo/start.rb` test file and
|
167
|
-
* `/home/david/starwars.yaml` config file.
|
168
|
-
|
169
|
-
`cpath` param selects YAML config file, from the specified path.
|
170
|
-
|
171
|
-
**Using diferent main rb name:**
|
172
|
-
When you run `teuton run foo/mazingerz.rb`, this will search for:
|
173
|
-
* `foo/mazingerz.rb` test file and
|
174
|
-
* `foo/mazingerz.yaml` config file.
|