teuton 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/docs/changelog/todo.md +1 -0
- data/docs/changelog/v2.4.md +4 -0
- data/docs/commands/README.md +8 -17
- data/docs/commands/example_check.md +4 -4
- data/docs/commands/example_run.md +10 -32
- data/docs/dsl/README.md +27 -39
- data/docs/dsl/{definition/expect.md → expect.md} +2 -18
- data/docs/dsl/{execution/export.md → export.md} +1 -6
- data/docs/dsl/{setting/get.md → get.md} +4 -10
- data/docs/dsl/{definition/group.md → group.md} +2 -7
- data/docs/dsl/{execution/play.md → play.md} +1 -6
- data/docs/dsl/{definition/result.md → result.md} +1 -6
- data/docs/dsl/{definition/run_remote.md → run.md} +57 -23
- data/docs/dsl/{execution/send.md → send.md} +1 -8
- data/docs/dsl/{setting/set.md → set.md} +1 -7
- data/docs/dsl/{execution/show.md → show.md} +7 -16
- data/docs/dsl/target.md +33 -0
- data/docs/ideas/todo.md +35 -115
- data/docs/learn/01-cmd_new.md +28 -0
- data/docs/learn/{01-target.md → 02-target.md} +13 -17
- data/docs/learn/03-remote_hosts.md +59 -87
- data/docs/learn/04-config.md +147 -0
- data/docs/learn/05-use.md +25 -45
- data/docs/learn/06-cmd_check.md +50 -0
- data/docs/learn/07-target_weight.md +44 -0
- data/docs/learn/08-unique_values.md +70 -0
- data/docs/learn/09-send.md +20 -0
- data/docs/learn/10-debug.md +45 -0
- data/docs/learn/11-export.md +35 -0
- data/docs/learn/{09-preserve.md → 12-preserve.md} +0 -0
- data/docs/learn/{17-hide-feedback.md → 13-feedback.md} +20 -23
- data/docs/learn/14-moodle_id.md +24 -0
- data/docs/learn/{08-readme.md → 15-readme.md} +5 -9
- data/docs/learn/{13-include.md → 16-include.md} +1 -3
- data/docs/learn/{14-alias.md → 17-alias.md} +0 -0
- data/docs/learn/{07-log.md → 18-log.md} +19 -23
- data/docs/learn/{12-get_vars.md → 19-read_vars.md} +3 -3
- data/docs/learn/20-macros.md +49 -0
- data/docs/learn/{16-exit_codes.md → 21-exit_codes.md} +0 -0
- data/docs/learn/{10-result.md → 22-result.md} +3 -3
- data/docs/learn/23-test-code.md +54 -0
- data/docs/learn/24-test-sql.md +69 -0
- data/docs/learn/README.md +24 -18
- data/lib/teuton/application.rb +2 -5
- data/lib/teuton/case_manager/case/case.rb +1 -1
- data/lib/teuton/case_manager/case/dsl/expect.rb +3 -1
- data/lib/teuton/case_manager/case/dsl/goto.rb +1 -1
- data/lib/teuton/case_manager/case/dsl/log.rb +5 -3
- data/lib/teuton/case_manager/case/dsl/target.rb +1 -1
- data/lib/teuton/case_manager/case/result/ext_compare.rb +20 -21
- data/lib/teuton/case_manager/case/result/ext_filter.rb +15 -8
- data/lib/teuton/check/show.rb +1 -1
- data/lib/teuton/files/config.yaml +1 -2
- data/lib/teuton/files/start.rb +4 -4
- data/lib/teuton/readme/dsl.rb +9 -1
- data/lib/teuton/readme/readme.rb +8 -1
- data/lib/teuton/report/show.rb +8 -0
- data/lib/teuton/version.rb +1 -1
- metadata +68 -54
- data/docs/dsl/definition/run_local.md +0 -33
- data/docs/dsl/definition/target.md +0 -40
- data/docs/learn/02-config.md +0 -117
- data/docs/learn/04-new_test.md +0 -87
- data/docs/learn/06-debug.md +0 -110
- data/docs/learn/11-moodle_id.md +0 -19
data/docs/ideas/todo.md
CHANGED
@@ -1,124 +1,44 @@
|
|
1
1
|
|
2
|
-
#
|
2
|
+
# TODO list
|
3
3
|
|
4
|
-
|
4
|
+
## Add
|
5
5
|
|
6
|
-
|
6
|
+
* Option roadmap_ok_only. When expect returns false... test stop. The rest of targets are forced to fails.
|
7
|
+
* `expect_equal "camaleon"`, same as `expect result.equal "camaleon"`.
|
8
|
+
* **FEATURE** Define a loop of executions of our activity. For example:
|
9
|
+
every 5 minutes, run the activity, and repeat this 10 times.
|
10
|
+
`start :times=>10, :every=>5 do`
|
11
|
+
* Script to set **static IP**
|
12
|
+
* Change export to show **command output** into reports.
|
13
|
+
* **TEST**: actualizar las pruebas con vagrant para la versión actual. Mejora de la calidad del código.
|
14
|
+
* **DOCS** PROMOCIONAR. Documentar y hacer videos. Tener foros de la comunidad o presencia en reddit o stackoverflow.... o algo parecido???
|
15
|
+
* Create 2 evaluation modes:
|
16
|
+
1. Evaluate targets (current mode): `start eval: :targets`
|
17
|
+
1. Evaluate task: `start eval: :groups` and perhaps add group weight?
|
18
|
+
1. config file with `tt_eval: groups`
|
19
|
+
|
20
|
+
Improve RESUME report or create stat-report, with stat information:
|
21
|
+
* the worst target/task/case,
|
22
|
+
* the best target/task/case,
|
23
|
+
* the slowest target/task/case,
|
24
|
+
* the fastest target/task/case, etc.
|
25
|
+
* Related targets: group of targets that always have the same state in every case.
|
26
|
+
|
27
|
+
## Ideas
|
7
28
|
|
8
|
-
|
9
|
-
NO. quizás mejor enfoque. Tener un servidor dedicado con una página Web para lanzar test desde el propio servidor.
|
29
|
+
Esta es una lista de ideas para que no se me olvide... lo podemos ir ajustando 😊
|
10
30
|
|
11
|
-
|
12
|
-
|
13
|
-
si hay valores con NODATA... entonces que pregunte al usuario y complete la
|
31
|
+
1. TEST-EN-CADENA (smart-shell): es un proyecto en curso que trabajará en colaboración ceon teuton. Detecta las acciones del usuario dentro de la shell y automáticamente lanza el test para validar el cumplimiento de los objetivos. Si se supera un % se pasa al siguiente test.
|
32
|
+
2. SERVIDOR TEUTON: Teuton web para recibir peticiones de los clientes... ?! Enganchar con teuton-server y teuton-client. NO. quizás mejor enfoque. Tener un servidor dedicado con una página Web para lanzar test desde el propio servidor.
|
33
|
+
3. Editor de ficheros de configuración.... una especie de asistente de ayuda.. no le veo mucho sentido tener un editor específico pero si al ejecutar un reto si hay valores con NODATA... entonces que pregunte al usuario y complete la
|
14
34
|
configuración sobre la marcha???
|
15
|
-
|
16
35
|
4. Editor de tests ?! .... lo veo complejo... a menos que se empiece por una versión simplificada.. El DSL es tan sencillo que no le veo sentido a un editor de retos. Pero si podemos aprovechar y crear una" librería " de los módulos más frecuentes?!... una ayuda para facilitar la creación de test... esto se puede emparejar con el editor de test...
|
36
|
+
5. `send :email_to => :members_emails`... esto requiere que cada caso tenga un email y que además el profesor tenga configurado el acceso a su cuenta de correo... para poder enviar copias de los informes....
|
37
|
+
6. When students demand help they could recibe some advises. More ideas: bonus, lives, etc.
|
38
|
+
7. save partial grades. Before play challenge read previous moodle.cvs. Then play challenge and when creates new moodle.csv... we could preseve old cases(grades) 100% for example.
|
17
39
|
|
18
|
-
|
19
|
-
6. `send :email_to => :members_emails`
|
20
|
-
|
21
|
-
7. Empaquetar tests para facilitar su movilidad . Esto se combina muy bien con la opción de búsqueda de retos.... pensar en firma gpg o md5 de comprobación etc..
|
22
|
-
Al ejecutar un test poder hacerlo "teuton run PATH/TO/FILE.zip"
|
23
|
-
|
24
|
-
|
25
|
-
# Gamification ideas
|
26
|
-
|
27
|
-
* When students demand help they could recibe some advises.
|
28
|
-
* Define a loop of executions of our activity. For example:
|
29
|
-
every 5 minutes, run the activity, and repeat this 10 times.
|
30
|
-
`start :times=>10, :duration=>5 do`
|
31
|
-
* More ideas: bonus, lives, etc.
|
32
|
-
|
33
|
-
# Ideas para QA
|
34
|
-
|
35
|
-
* actualizar las pruebas con vagrant para la versión actual. Mejora de la calidad del código.
|
36
|
-
|
37
|
-
# Ideas para PROMOCIONAR
|
38
|
-
|
39
|
-
* Documentar y hacer videos.
|
40
|
-
* Tener foros de la comunidad o presencia en reddit o stackoverflow.... o algo parecido???
|
41
|
-
|
42
|
-
Create 2 evaluation modes:
|
43
|
-
1. Evaluate targets (current mode): `start :score=>:targets do ...`
|
44
|
-
1. Evaluate task: `start :score=>:groups do ...`
|
45
|
-
|
46
|
-
|
47
|
-
## Pending
|
48
|
-
|
49
|
-
### moodle.csv and save partial grades.
|
50
|
-
|
51
|
-
* Before play challenge read previous moodle.cvs. Then play challenge and when creates new moodle.csv... we could preseve old cases(grades) 100% for example.
|
52
|
-
|
53
|
-
### expect keyword
|
54
|
-
|
55
|
-
* `expect_equal "camaleon"`, same as `expect result.equal "camaleon"`.
|
56
|
-
* `expect_not_equal "lagarto"`, same as not expect equal.
|
57
|
-
* `expect regexp("val1|var2")`, regexp function creates regular expresion from String.
|
58
|
-
* `expect result.ok?`, result from previous goto exec.
|
59
|
-
* `result.exit_code`, exit code from previous goto exec.
|
60
|
-
|
61
|
-
### Reports and export keyword
|
62
|
-
|
63
|
-
* Work on more output formats: CSV, HTML, XML.
|
64
|
-
* `export :format=>:html, :prefix => IAN`
|
65
|
-
* `export :format=>:xml, :prefix => IAN`
|
66
|
-
* `export :format=>:csv, :prefix => IAN`
|
67
|
-
* Improve RESUME report or create stat-report, with stat information:
|
68
|
-
* the worst target/task/case,
|
69
|
-
* the best target/task/case,
|
70
|
-
* the slowest target/task/case,
|
71
|
-
* the fastest target/task/case, etc.
|
72
|
-
* Related targets: group of targets that always have the same state in every case.
|
73
|
-
|
74
|
-
### File extension
|
75
|
-
|
76
|
-
* Change ".rb" file extension by ".tt" for example. To avoid users think on ruby when using teuton files.
|
77
|
-
* So move "ruby language" documentation to other section like "expert mode"...
|
78
|
-
* Change "start.rb" or "play.rb" name to "run.tt".
|
79
|
-
|
80
|
-
### loop keyword
|
81
|
-
|
82
|
-
* Create keyword to do loops without using ruby style:
|
83
|
-
```
|
84
|
-
loop i: 1..5 do
|
85
|
-
puts i
|
86
|
-
end
|
87
|
-
|
88
|
-
loop :a => [3,5,7] do
|
89
|
-
puts a
|
90
|
-
end
|
91
|
-
```
|
92
|
-
|
93
|
-
### Feedback
|
94
|
-
|
95
|
-
Add new features to DSL
|
96
|
-
* `feedback or advise "Some usefull information"` provide this information when studends demand help.
|
97
|
-
## Working
|
98
|
-
|
99
|
-
### Remote temp folder
|
100
|
-
|
101
|
-
Modify send keyword so it could works with all OS. Now only work with GNU/Linux. So we need to detect remote OS, then choose remote teuton folder where uploading files.
|
102
|
-
|
103
|
-
* First goto open new session to remote host. And then:
|
104
|
-
1. Detect remote OSTYPE: (a) GNU/Linux and MAC using "uname -a", (b) Windows using "ver" command.
|
105
|
-
2. Create teuton remote uploading folder: (a) /tmp/teuton for GNU/Linux and MAC, (b) %windir%/temp/teuton for Windows.
|
106
|
-
* Every time we send files to remote host we will use this remote folder.
|
107
|
-
|
108
|
-
### Readme
|
109
|
-
|
110
|
-
* Pass usefull information into README.md:
|
111
|
-
```
|
112
|
-
readme do
|
113
|
-
title ...
|
114
|
-
intro ...
|
115
|
-
author ...
|
116
|
-
requirements ...
|
117
|
-
tags ...
|
118
|
-
end
|
119
|
-
```
|
120
|
-
|
121
|
-
---
|
40
|
+
# Propuestas de sdelquin
|
122
41
|
|
123
|
-
|
124
|
-
|
42
|
+
- Docker en vez de vagrant?? → https://www.cloudbees.com/blog/ssh-into-a-docker-container-how-to-execute-your-commands
|
43
|
+
- Tablas "bonitas" en terminal → https://github.com/piotrmurach/tty-markdown#17-table
|
44
|
+
- Documentación en https://readthedocs.org/ ??
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
[<< back](README.md)
|
3
|
+
|
4
|
+
# new test
|
5
|
+
|
6
|
+
Create skeleton for a new project: `teuton create foo`
|
7
|
+
|
8
|
+
```
|
9
|
+
> teuton new foo
|
10
|
+
|
11
|
+
[INFO] Creating foo project skeleton
|
12
|
+
* Create dir => foo
|
13
|
+
* Create file => foo/config.yaml
|
14
|
+
* Create file => foo/start.rb
|
15
|
+
```
|
16
|
+
|
17
|
+
> NOTA: It is posible to create these files by hand.
|
18
|
+
|
19
|
+
This command will create:
|
20
|
+
|
21
|
+
| File/Directory | Description |
|
22
|
+
| --------------- | -------------- |
|
23
|
+
| foo | Base directory |
|
24
|
+
| foo/start.rb | Main Script |
|
25
|
+
| foo/config.yaml | YAML configuration file |
|
26
|
+
|
27
|
+
|
28
|
+
Now it is time to customize your targets.
|
@@ -1,16 +1,14 @@
|
|
1
1
|
[<< back](README.md)
|
2
2
|
|
3
|
-
#
|
3
|
+
# target
|
4
4
|
|
5
|
-
A target is a feature you want to check.
|
5
|
+
A [target](../dsl/target.md) is a feature you want to check. Targets are defined into `group` sections and every evaluation has 3 parts:
|
6
6
|
|
7
|
-
##
|
7
|
+
## Target definition
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
*
|
12
|
-
* **run**: Execute a command `id david` on localhost.
|
13
|
-
* **expect**: Ensure the result contains expected value.
|
9
|
+
* [target](dsl/target.md): Description of the element to be tested.
|
10
|
+
* [run](../dsl/run.md): Execute a command `id david` on localhost.
|
11
|
+
* [expect](../&dsl/expect.md): Verify that the result contains expected value.
|
14
12
|
|
15
13
|
```ruby
|
16
14
|
group "Learn about targets" do
|
@@ -22,14 +20,14 @@ group "Learn about targets" do
|
|
22
20
|
end
|
23
21
|
```
|
24
22
|
|
25
|
-
> In this example, localhost's OS
|
23
|
+
> In this example, our localhost's OS is GNU/Linux (or any other compatible OS) because the command executed is `id david`.
|
26
24
|
|
27
25
|
## Execution section
|
28
26
|
|
29
|
-
|
27
|
+
When we run this teuton test, the execution section (`play`) is processed. This seccion now contains this:
|
30
28
|
|
31
|
-
*
|
32
|
-
*
|
29
|
+
* [show](../dsl/show.md): display process information on screen.
|
30
|
+
* [export](../dsl/export.md): build output reports.
|
33
31
|
|
34
32
|
```ruby
|
35
33
|
play do
|
@@ -38,7 +36,7 @@ play do
|
|
38
36
|
end
|
39
37
|
```
|
40
38
|
|
41
|
-
##
|
39
|
+
## Example
|
42
40
|
|
43
41
|
Execute this command to run the test:
|
44
42
|
|
@@ -52,9 +50,7 @@ CASE RESULTS
|
|
52
50
|
+------+-----------+-------+-------+
|
53
51
|
```
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
Report files created into `var/01-target/`:
|
53
|
+
Report files are created into `var/02-target/` folder:
|
58
54
|
|
59
55
|
```console
|
60
56
|
var
|
@@ -67,7 +63,7 @@ var
|
|
67
63
|
Let's see one report:
|
68
64
|
|
69
65
|
```
|
70
|
-
> more var/
|
66
|
+
> more var/02-target/case-01.txt
|
71
67
|
|
72
68
|
CONFIGURATION
|
73
69
|
+-------------+-----------+
|
@@ -1,121 +1,93 @@
|
|
1
1
|
[<< back](README.md)
|
2
2
|
|
3
|
-
#
|
3
|
+
# Remote hosts
|
4
4
|
|
5
|
-
|
6
|
-
* Check a group of remote hosts.
|
7
|
-
* Export reports using other output formats.
|
8
|
-
* Checking remote machine (host1) with Windows OS.
|
5
|
+
To run test on remote host we have to define them into config file.
|
9
6
|
|
10
|
-
|
11
|
-
|
12
|
-
3
|
13
|
-
4. [Results](#results).
|
14
|
-
|
15
|
-
## Config file
|
16
|
-
|
17
|
-
This configuration file contains:
|
18
|
-
* 2 global params denitions.
|
19
|
-
* 3 cases.
|
20
|
-
* 4 specific case params definitions.
|
7
|
+
Let's see an example with:
|
8
|
+
* 1 global param.
|
9
|
+
* 3 cases with 3 params.
|
21
10
|
|
22
11
|
```yaml
|
23
12
|
---
|
24
13
|
global:
|
25
14
|
host1_username: root
|
26
|
-
host1_password: profesor
|
27
15
|
cases:
|
28
|
-
- tt_members:
|
16
|
+
- tt_members: student_1
|
29
17
|
host1_ip: 192.168.1.201
|
30
|
-
|
31
|
-
|
32
|
-
- tt_members: R2D2
|
18
|
+
host1_password: secret_1
|
19
|
+
- tt_members: student_2
|
33
20
|
host1_ip: 192.168.1.202
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
host1_hostname: jedis
|
39
|
-
username: obiwan
|
21
|
+
host1_password: secret_2
|
22
|
+
- tt_members: student_3
|
23
|
+
host1_ip: 127.0.0.1
|
24
|
+
host1_password: secret_3
|
40
25
|
```
|
41
26
|
|
42
|
-
|
43
|
-
|
44
|
-
Define 3 targets (items to be checked):
|
27
|
+
Every remote host definition require some params:
|
45
28
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
expect "Nombre:"
|
55
|
-
|
56
|
-
target "Create user #{gett(:username)}"
|
57
|
-
run "net user", on: :host1
|
58
|
-
expect get(:username)
|
59
|
-
end
|
60
|
-
```
|
29
|
+
| Param | Description | Default value |
|
30
|
+
| ----- | -------------- | ------------- |
|
31
|
+
| ip | Remote host IP | |
|
32
|
+
| port | Remote host port | 22 |
|
33
|
+
| username | Remote user account | Not required with public SSH id |
|
34
|
+
| password | Remote user pasword | Not required with public SSH id |
|
35
|
+
| protocol | SSH or Telner | SSH |
|
36
|
+
| route | Defines host2 used as gateway to reach host | |
|
61
37
|
|
62
|
-
|
38
|
+
## Definition section
|
63
39
|
|
64
|
-
|
40
|
+
Define 1 target (item to be checked):
|
65
41
|
|
66
42
|
```ruby
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
export format: :html
|
72
|
-
send copy_to: :host1
|
43
|
+
group "Remote hosts" do
|
44
|
+
target "Create user david"
|
45
|
+
run "id david", on: :host1
|
46
|
+
expect "david"
|
73
47
|
end
|
74
48
|
```
|
75
49
|
|
76
|
-
|
77
|
-
* `export format: :txt`, create output reports files into `var/learn-03-remote-host/` directory using `txt` format.
|
78
|
-
* `export format: :html`, create output reports into `var/learn-03-remote-host/` directory using `html` format.
|
79
|
-
|
80
|
-
> Several output formats available: txt, colored_text, html, json and yaml.
|
81
|
-
|
82
|
-
* `send copy_to: :host1` keyword copy output report into remote machine (host1).
|
50
|
+
> NOTE: This example requires GNU/Linux OS on remote machine (host1).
|
83
51
|
|
84
|
-
|
52
|
+
Execution:
|
85
53
|
|
86
54
|
```
|
55
|
+
> teuton run examples/03-remote_hosts
|
56
|
+
|
87
57
|
CASE RESULTS
|
88
|
-
|
89
|
-
| CASE | MEMBERS
|
90
|
-
| 01 |
|
91
|
-
|
|
92
|
-
| 03 |
|
93
|
-
|
58
|
+
+------+-----------+-------+-------+
|
59
|
+
| CASE | MEMBERS | GRADE | STATE |
|
60
|
+
| 01 | student_1 | 0.0 | ? |
|
61
|
+
| 02 | student_2 | 0.0 | ? |
|
62
|
+
| 03 | student_3 | 100.0 | ✔ |
|
63
|
+
+------+-----------+-------+-------+
|
94
64
|
|
95
65
|
CONN ERRORS
|
96
|
-
|
97
|
-
| CASE | MEMBERS
|
98
|
-
| 01 |
|
99
|
-
|
|
100
|
-
|
66
|
+
+------+-----------+-------+------------------+
|
67
|
+
| CASE | MEMBERS | HOST | ERROR |
|
68
|
+
| 01 | student_1 | host1 | host_unreachable |
|
69
|
+
| 02 | student_2 | host1 | host_unreachable |
|
70
|
+
+------+-----------+-------+------------------+
|
101
71
|
```
|
102
72
|
|
103
|
-
|
73
|
+
Notice that case-03 is 100% and conection works. It is running on localhost because has localhost IP (127.0.0.1)
|
74
|
+
|
75
|
+
Results:
|
104
76
|
|
105
77
|
```
|
106
|
-
var
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
└── resume.txt
|
78
|
+
❯ tree var/03-remote_hosts
|
79
|
+
|
80
|
+
var/03-remote_hosts
|
81
|
+
├── case-01.txt
|
82
|
+
├── case-02.txt
|
83
|
+
├── case-03.txt
|
84
|
+
├── moodle.csv
|
85
|
+
└── resume.txt
|
115
86
|
```
|
116
87
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
* `
|
121
|
-
* `
|
88
|
+
## tt_skip param
|
89
|
+
|
90
|
+
To disable a case, add skip param `tt_skip: true`.
|
91
|
+
* `tt_skip` it is true by default.
|
92
|
+
* `tt_skip: false` ignore this case.
|
93
|
+
* `tt_skip: true`, evaluate this case.
|
@@ -0,0 +1,147 @@
|
|
1
|
+
[<< back](README.md)
|
2
|
+
|
3
|
+
# config
|
4
|
+
|
5
|
+
_It's good idea save dinamic data into config file._
|
6
|
+
|
7
|
+
By default, `config.yaml` is our config file. Example:
|
8
|
+
|
9
|
+
```yaml
|
10
|
+
global:
|
11
|
+
cases:
|
12
|
+
- tt_members: name_student_1
|
13
|
+
username: david
|
14
|
+
- tt_members: name_student_2
|
15
|
+
username: fran
|
16
|
+
```
|
17
|
+
|
18
|
+
> **How to choose another config file?** Read this [document](../commands/example_run.md#3-choosing-config-file).
|
19
|
+
|
20
|
+
By default, `start.rb` it's our main execution file. Example:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
group "Reading params from config file" do
|
24
|
+
|
25
|
+
target "Create user #{get(:username)}"
|
26
|
+
run "id #{get(:username)}"
|
27
|
+
expect get(:username)
|
28
|
+
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
* [get](../dsl/get.md) keyword read params from configuration file. It's posible personalize tests with diferent values for every case.
|
33
|
+
|
34
|
+
## Example
|
35
|
+
|
36
|
+
```console
|
37
|
+
> teuton run examples/04-config
|
38
|
+
|
39
|
+
CASE RESULTS
|
40
|
+
+------+----------------+-------+-------+
|
41
|
+
| CASE | MEMBERS | GRADE | STATE |
|
42
|
+
| 01 | name_student_1 | 100.0 | ✔ |
|
43
|
+
| 02 | name_student_2 | 0.0 | ? |
|
44
|
+
+------+----------------+-------+-------+
|
45
|
+
```
|
46
|
+
|
47
|
+
Reports:
|
48
|
+
|
49
|
+
```
|
50
|
+
var/04-config
|
51
|
+
├── case-01.txt
|
52
|
+
├── case-02.txt
|
53
|
+
├── moodle.csv
|
54
|
+
└── resume.txt
|
55
|
+
```
|
56
|
+
|
57
|
+
Let's see case 01 report.
|
58
|
+
|
59
|
+
```
|
60
|
+
> more var/04-config/case-01.txt
|
61
|
+
|
62
|
+
CONFIGURATION
|
63
|
+
+-------------+----------------+
|
64
|
+
| tt_members | name_student_1 |
|
65
|
+
| tt_sequence | false |
|
66
|
+
| tt_skip | false |
|
67
|
+
| tt_testname | 04-config |
|
68
|
+
| username | david |
|
69
|
+
+-------------+----------------+
|
70
|
+
|
71
|
+
GROUPS
|
72
|
+
- Reading params from config file
|
73
|
+
01 (1.0/1.0)
|
74
|
+
Description : Create user david
|
75
|
+
Command : id david
|
76
|
+
Duration : 0.002 (local)
|
77
|
+
Alterations : find(david) & count
|
78
|
+
Expected : Greater than 0 (String)
|
79
|
+
Result : 1 (Integer)
|
80
|
+
|
81
|
+
RESULTS
|
82
|
+
+--------------+---------------------------+
|
83
|
+
| case_id | 01 |
|
84
|
+
| start_time | 2023-01-25 20:46:13 +0000 |
|
85
|
+
| finish_time | 2023-01-25 20:46:13 +0000 |
|
86
|
+
| duration | 0.001778546 |
|
87
|
+
| unique_fault | 0 |
|
88
|
+
| max_weight | 1.0 |
|
89
|
+
| good_weight | 1.0 |
|
90
|
+
| fail_weight | 0.0 |
|
91
|
+
| fail_counter | 0 |
|
92
|
+
| grade | 100 |
|
93
|
+
+--------------+---------------------------+```
|
94
|
+
```
|
95
|
+
|
96
|
+
## Using differents configuration files
|
97
|
+
|
98
|
+
Example with 3 config files (yaml files):
|
99
|
+
|
100
|
+
```
|
101
|
+
❯ tree examples/04-config
|
102
|
+
|
103
|
+
examples/04-config
|
104
|
+
├── config.yaml
|
105
|
+
├── rock.yaml
|
106
|
+
├── start.rb
|
107
|
+
└── starwars.yaml
|
108
|
+
```
|
109
|
+
|
110
|
+
Usign default config file (`config.yaml`):
|
111
|
+
|
112
|
+
```
|
113
|
+
❯ teuton run examples/04-config
|
114
|
+
|
115
|
+
CASE RESULTS
|
116
|
+
+------+----------------+-------+-------+
|
117
|
+
| CASE | MEMBERS | GRADE | STATE |
|
118
|
+
| 01 | name_student_1 | 100.0 | ✔ |
|
119
|
+
| 02 | name_student_2 | 0.0 | ? |
|
120
|
+
+------+----------------+-------+-------+
|
121
|
+
```
|
122
|
+
|
123
|
+
Using `example/04-config/starwars.yaml`:
|
124
|
+
|
125
|
+
```
|
126
|
+
❯ teuton run --cname=starwars examples/04-config
|
127
|
+
|
128
|
+
CASE RESULTS
|
129
|
+
+------+------------+-------+-------+
|
130
|
+
| CASE | MEMBERS | GRADE | STATE |
|
131
|
+
| 01 | Yoda | 0.0 | ? |
|
132
|
+
| 02 | Darth Maul | 0.0 | ? |
|
133
|
+
+------+------------+-------+-------+
|
134
|
+
```
|
135
|
+
|
136
|
+
Using `example/04-config/rock.yaml`:
|
137
|
+
|
138
|
+
```
|
139
|
+
❯ teuton run --cpath=examples/04-config/rock.yaml examples/04-config
|
140
|
+
|
141
|
+
CASE RESULTS
|
142
|
+
+------+------------+-------+-------+
|
143
|
+
| CASE | MEMBERS | GRADE | STATE |
|
144
|
+
| 01 | AC/DC band | 0.0 | ? |
|
145
|
+
| 02 | Muse band | 0.0 | ? |
|
146
|
+
+------+------------+-------+-------+
|
147
|
+
```
|