teuton 3.3.0 → 3.4.0
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.
- checksums.yaml +4 -4
- data/README.md +12 -14
- data/docs/commands/README.md +5 -4
- data/docs/commands/{readme.md → doc.md} +3 -5
- data/docs/commands/help.md +8 -8
- data/docs/devel/todo.md +1 -4
- data/docs/dsl/README.md +9 -8
- data/docs/dsl/event.md +172 -0
- data/docs/learn/01-cmd_new.md +1 -1
- data/docs/learn/02-target.md +18 -18
- data/docs/learn/03-remote_hosts.md +1 -1
- data/docs/learn/04-config.md +15 -13
- data/docs/learn/05-use.md +1 -1
- data/docs/learn/06-cmd_check.md +2 -2
- data/docs/learn/07-target_weight.md +4 -2
- data/docs/learn/08-unique_values.md +1 -1
- data/docs/learn/09-send.md +2 -2
- data/docs/learn/10-debug.md +10 -9
- data/docs/learn/11-export.md +1 -1
- data/docs/learn/12-preserve.md +4 -4
- data/docs/learn/13-feedback.md +3 -3
- data/docs/learn/14-moodle_id.md +3 -3
- data/docs/learn/15-readme.md +10 -10
- data/docs/learn/16-include.md +3 -3
- data/docs/learn/17-alias.md +2 -2
- data/docs/learn/18-log.md +3 -2
- data/docs/learn/19-read_vars.md +1 -1
- data/docs/learn/20-macros.md +1 -1
- data/docs/learn/21-exit_codes.md +1 -1
- data/docs/learn/22-result.md +1 -1
- data/docs/learn/23-test-code.md +1 -1
- data/docs/learn/24-test-sql.md +1 -1
- data/docs/learn/25-expect-result.md +1 -1
- data/docs/learn/26-expect_sequence.md +1 -1
- data/docs/learn/27-run_script.md +1 -1
- data/docs/learn/28-upload.md +3 -1
- data/docs/learn/31-event-stop.md +134 -0
- data/docs/learn/32-event-zero.md +127 -0
- data/docs/more.md +4 -1
- data/lib/teuton/case/action/manager.rb +146 -11
- data/lib/teuton/case/case.rb +2 -0
- data/lib/teuton/case/close.rb +4 -4
- data/lib/teuton/case/dsl/event.rb +1 -20
- data/lib/teuton/case/dsl/expect.rb +1 -1
- data/lib/teuton/case/dsl/log.rb +8 -3
- data/lib/teuton/case/dsl/target.rb +6 -1
- data/lib/teuton/case_manager/show_resume_report.rb +2 -2
- data/lib/teuton/check/checker.rb +2 -0
- data/lib/teuton/check/dsl/all.rb +8 -22
- data/lib/teuton/check/dsl/event.rb +10 -0
- data/lib/teuton/check/dsl/expect.rb +8 -16
- data/lib/teuton/check/dsl/target.rb +17 -0
- data/lib/teuton/check/show.rb +12 -12
- data/lib/teuton/cli/app.rb +15 -7
- data/lib/teuton/readme/dsl/all.rb +6 -1
- data/lib/teuton/report/formatter/default/txt.rb +9 -8
- data/lib/teuton/report/formatter/resume/txt.rb +5 -5
- data/lib/teuton/report/report.rb +2 -35
- data/lib/teuton/version.rb +1 -1
- metadata +11 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c511c3e1920ec1a32a84db7d3eb244c2b3158cc21f45c6f6992b5b6d3d67cd55
|
|
4
|
+
data.tar.gz: b888a70c354935e13779f2a548e11f0a352c3ac8cc90db2670b53b0b01e57535
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e0d923a83e0d8befa87a779e64ca9dfddf46b2e50f36761a51f63563e23983ee8883d92e3df3a29bb6fdfbc4eea9984c113fcb5de97406cd4d5ad168e3c694f
|
|
7
|
+
data.tar.gz: f4624afd770821f062673edb9736e580738e8c2ee7ca5ef686a58a838ea1aee8055f8ee29c0874147ef015b8c8a5d571e9ff5bc32ae8b74f46bcf6e60533bd49
|
data/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
# TEUTON
|
|
3
3
|
|
|
4
|
-
[](https://badge.fury.io/rb/teuton)
|
|
4
|
+
[](https://badge.fury.io/rb/teuton)
|
|
5
5
|

|
|
6
6
|
|
|
7
|
-
_Test your infrastructure as code._
|
|
7
|
+
_Test your infrastructure as code._
|
|
8
8
|
|
|
9
|
-

|
|
9
|
+

|
|
10
10
|
|
|
11
11
|
The infrastructure test is useful for:
|
|
12
12
|
* Sysadmin teachers who want to evaluate students remote machines.
|
|
@@ -27,12 +27,12 @@ gem install teuton
|
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
29
|
# File: examples/02-target/start.rb
|
|
30
|
-
group "
|
|
31
|
-
target "Create user obiwan"
|
|
30
|
+
group "Practicing targets" do
|
|
31
|
+
target "Create user obiwan"
|
|
32
32
|
run "id obiwan"
|
|
33
33
|
expect ["uid=", "(obiwan)", "gid="]
|
|
34
34
|
|
|
35
|
-
target "Delete user vader"
|
|
35
|
+
target "Delete user vader", weight: 2
|
|
36
36
|
run "id vader"
|
|
37
37
|
expect_fail
|
|
38
38
|
end
|
|
@@ -47,11 +47,6 @@ end
|
|
|
47
47
|
|
|
48
48
|
```console
|
|
49
49
|
$ teutonx examples/02-target
|
|
50
|
-
------------------------------------
|
|
51
|
-
Started at 2026-10-21 17:05:49 +0100
|
|
52
|
-
F.
|
|
53
|
-
Finished in 0.005 seconds
|
|
54
|
-
------------------------------------
|
|
55
50
|
|
|
56
51
|
CASE RESULTS
|
|
57
52
|
┌──────┬───────────┬───────┬───────┐
|
|
@@ -89,11 +84,11 @@ Consult the generated [output files](examples/02-target/output.d/)
|
|
|
89
84
|
2. Teuton commands
|
|
90
85
|
* [teuton config](docs/commands/config.md): suggest config file.
|
|
91
86
|
* [teuton check](docs/commands/check.md): check test syntax.
|
|
87
|
+
* [teuton doc](docs/commands/doc.md): generate test documentation.
|
|
92
88
|
* [teuton help](docs/commands/help.md): show command help.
|
|
93
89
|
* [teuton new](docs/commands/new.md): create new test.
|
|
94
|
-
* [teuton readme](docs/commands/readme.md): generate test documentation.
|
|
95
90
|
* [teuton run](docs/commands/run.md): run test.
|
|
96
|
-
3.
|
|
91
|
+
3. Learning guide: Learn writing tests. [Examples](examples).
|
|
97
92
|
* [Create NEW test](docs/learn/01-cmd_new.md)
|
|
98
93
|
* [Evaluate TARGET](docs/learn/02-target.md)
|
|
99
94
|
* [Check REMOTE HOSTS](docs/learn/03-remote_hosts.md)
|
|
@@ -108,7 +103,7 @@ Consult the generated [output files](examples/02-target/output.d/)
|
|
|
108
103
|
* [PRESERVE old reports](docs/learn/12-preserve.md)
|
|
109
104
|
* [Hide FEEDBACK from reports](docs/learn/13-feedback.md)
|
|
110
105
|
* [MOODLE](docs/learn/14-moodle_id.md)
|
|
111
|
-
* [Build
|
|
106
|
+
* [Build DOC from test](docs/learn/15-doc.md)
|
|
112
107
|
* [INCLUDE more configuration files](docs/learn/16-include.md)
|
|
113
108
|
* [ALIAS](docs/learn/17-alias.md)
|
|
114
109
|
* [LOG messages](docs/learn/18-log.md)
|
|
@@ -122,10 +117,13 @@ Consult the generated [output files](examples/02-target/output.d/)
|
|
|
122
117
|
* [EXPECT_SEQUENCE](docs/learn/26-expect_sequence.md)
|
|
123
118
|
* [RUN_SCRIPT](docs/learn/27-run_script.md)
|
|
124
119
|
* [UPLOAD](docs/learn/28-upload.md)
|
|
120
|
+
* [EVENT stop](docs/learn/31-event-stop.md)
|
|
121
|
+
* [EVENT scores to zero](docs/learn/32-event-zero.md)
|
|
125
122
|
4. [Configuration file](docs/config_file.md): Reserved params, configure hosts, etc.
|
|
126
123
|
5. [Language reference](docs/dsl/README.md). DSL used to define tests.
|
|
127
124
|
* [expect](docs/dsl/expect.md): check run output with expectations.
|
|
128
125
|
* [export](docs/dsl/export.md): save evaluation reports.
|
|
126
|
+
* [event](docs/dsl/event.md): execute action when conditions are met.
|
|
129
127
|
* [get](docs/dsl/get.md): read config params.
|
|
130
128
|
* [group](docs/dsl/group.md): group targets.
|
|
131
129
|
* [play](docs/dsl/play.md): starts main execution.
|
data/docs/commands/README.md
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
$ teuton
|
|
7
|
+
|
|
7
8
|
Commands:
|
|
8
9
|
teuton [run] [OPTIONS] DIRECTORY # Run test from directory
|
|
9
10
|
teuton check [OPTIONS] DIRECTORY # Check test and config file content
|
|
10
11
|
teuton config DIRECTORY # Suggest configuration.
|
|
12
|
+
teuton doc DIRECTORY # Display practice exercise statement
|
|
11
13
|
teuton help [COMMAND] # Describe available commands or one specific command
|
|
12
14
|
teuton new DIRECTORY # Create skeleton for a new project
|
|
13
|
-
teuton readme DIRECTORY # Show README extracted from test contents
|
|
14
15
|
teuton tree # Print a tree of all available commands
|
|
15
16
|
teuton version # Show the program version
|
|
16
17
|
```
|
|
@@ -19,7 +20,7 @@ Available command functions:
|
|
|
19
20
|
1. [run](run.md)
|
|
20
21
|
2. [check](check.md)
|
|
21
22
|
3. [config](config.md)
|
|
22
|
-
4. [
|
|
23
|
-
5. [
|
|
24
|
-
6. [
|
|
23
|
+
4. [doc](doc.md)
|
|
24
|
+
5. [help](help.md)
|
|
25
|
+
6. [new](new.md)
|
|
25
26
|
7. **version**: _Show current version_. Usage: `teuton version`.
|
|
@@ -5,13 +5,11 @@
|
|
|
5
5
|
_Show test info as README file. Useful for create a readme file for the exercise._
|
|
6
6
|
|
|
7
7
|
Usage:
|
|
8
|
-
* `teuton
|
|
9
|
-
* `teuton
|
|
8
|
+
* `teuton doc DIRPATH`
|
|
9
|
+
* `teuton doc DIRPATH > README.md`
|
|
10
10
|
|
|
11
11
|
This function reads test and config files, and generate Markdown output with guidelines and target descriptions about the exercise.
|
|
12
12
|
|
|
13
|
-
Alias: `teuton r DIRPATH`, `teuton -r DIRPATH`, `teuton --readme DIRPATH`
|
|
14
|
-
|
|
15
13
|
## Example
|
|
16
14
|
|
|
17
15
|
Test content:
|
|
@@ -34,7 +32,7 @@ play do
|
|
|
34
32
|
end
|
|
35
33
|
```
|
|
36
34
|
|
|
37
|
-
Generate test documentation: `teuton
|
|
35
|
+
Generate test documentation: `teuton doc examples/02-target`
|
|
38
36
|
|
|
39
37
|
---
|
|
40
38
|
```
|
data/docs/commands/help.md
CHANGED
|
@@ -13,14 +13,14 @@ Alias: `teuton h`,`teuton -h`, `teuton --help`
|
|
|
13
13
|
**Example**: `teuton help`
|
|
14
14
|
```
|
|
15
15
|
Commands:
|
|
16
|
-
teuton [run] [OPTIONS] DIRECTORY
|
|
17
|
-
teuton check [OPTIONS] DIRECTORY
|
|
18
|
-
teuton config
|
|
19
|
-
teuton
|
|
20
|
-
teuton
|
|
21
|
-
teuton
|
|
22
|
-
teuton tree
|
|
23
|
-
teuton version
|
|
16
|
+
teuton [run] [OPTIONS] DIRECTORY # Run test from directory
|
|
17
|
+
teuton check [OPTIONS] DIRECTORY # Check test and config file content
|
|
18
|
+
teuton config DIRECTORY # Suggest configuration.
|
|
19
|
+
teuton doc DIRECTORY # Display practice exercise statement
|
|
20
|
+
teuton help [COMMAND] # Describe available commands or one specific command
|
|
21
|
+
teuton new DIRECTORY # Create skeleton for a new project
|
|
22
|
+
teuton tree # Print a tree of all available commands
|
|
23
|
+
teuton version # Show the program version
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
**Example**: `teuton help check`
|
data/docs/devel/todo.md
CHANGED
|
@@ -20,11 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
# 3. Features
|
|
22
22
|
|
|
23
|
-
## 3.1. teuton
|
|
23
|
+
## 3.1. teuton doc
|
|
24
24
|
|
|
25
|
-
* Renombrar "teuton readme" por "teuton doc".
|
|
26
|
-
* Modificar código, documentación y los ejemplos
|
|
27
|
-
* Modificar los ejemplos de dvarrui/teuton-tests
|
|
28
25
|
* Añadir opciones de lenguaje a `teuton doc`.
|
|
29
26
|
* Por defecto se usará `--lang=en`.
|
|
30
27
|
* Pero poder especificar el idioma usando el paráemetro `lang`. Por ejemplo :`teuton doc --lang=es`
|
data/docs/dsl/README.md
CHANGED
|
@@ -12,19 +12,20 @@ Types:
|
|
|
12
12
|
|
|
13
13
|
## Keyword table
|
|
14
14
|
|
|
15
|
-
| DSL | Type | Descripción
|
|
16
|
-
| :------------------ | :--------: |
|
|
15
|
+
| DSL | Type | Descripción |
|
|
16
|
+
| :------------------ | :--------: | :------------------------------------------ |
|
|
17
17
|
| [expect](expect.md) | Definition | Check the obtained result with the expected value. |
|
|
18
18
|
| [export](export.md) | Execution | Make reports with the results of every evaluation. |
|
|
19
|
-
| [
|
|
20
|
-
| [
|
|
21
|
-
| [
|
|
19
|
+
| [event](./event.md) | Definition | Execute action when conditions are met |
|
|
20
|
+
| [get](get.md) | Settings | Read param value from configuration file. |
|
|
21
|
+
| [group](group.md) | Definition | Define a group of items to check. |
|
|
22
|
+
| [play](play.md) | Execution | Run the challenge. |
|
|
22
23
|
| [result](result.md) | Definition | Contain the output of previous `run` order. |
|
|
23
|
-
| [run](run.md)| Definition | Execute command into remote host or localhost.
|
|
24
|
+
| [run](run.md)| Definition | Execute command into remote host or localhost. |
|
|
24
25
|
| [target](target.md) | Definition | Define a target. This is the item to be checked. |
|
|
25
|
-
| [send](send.md) | Execution | Send copy of report file to remote host.
|
|
26
|
+
| [send](send.md) | Execution | Send copy of report file to remote host. |
|
|
26
27
|
| [set](set.md) | Settings | Set new param value for running configuration. |
|
|
27
|
-
| [show](show.md) | Execution | Show the results on screen.
|
|
28
|
+
| [show](show.md) | Execution | Show the results on screen. |
|
|
28
29
|
|
|
29
30
|
### Programming language
|
|
30
31
|
|
data/docs/dsl/event.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
[<< back](../README.md)
|
|
2
|
+
|
|
3
|
+
# event
|
|
4
|
+
|
|
5
|
+
Sometimes it may be necessary to trigger an action when a specific condition occurs; for this, we can use events.
|
|
6
|
+
|
|
7
|
+
Events are defined using the following structure:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
event on: OBJECT, when: CONDITION do
|
|
11
|
+
ACTION
|
|
12
|
+
end
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Where
|
|
16
|
+
* OBJECT can be `:last_target`
|
|
17
|
+
* CONDITION can be `:failed`
|
|
18
|
+
* And ACTION can be `stop`, `scores_to_zero`, or both.
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
event on: :last_target, when: :failed do
|
|
24
|
+
stop
|
|
25
|
+
end
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
An event is defined to trigger the `stop` action when the last target fails.
|
|
29
|
+
|
|
30
|
+
The "stop" action halts the test, setting the number of targets yet to be evaluated to zero, while the rest retain their current assessment.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# Events
|
|
34
|
+
|
|
35
|
+
Events are used to define actions that are triggered only when specific conditions are met.
|
|
36
|
+
|
|
37
|
+
Syntax:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
event on: OBJECT, when: CONDITION do ACTIONS end
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Events consist of three parts:
|
|
44
|
+
|
|
45
|
+
* `on: OBJECT` - defines the object for which the event is being set.
|
|
46
|
+
* `when: CONDITION` - defines the condition that must be met by the OBJECT to trigger the action(s).
|
|
47
|
+
* `do ACTIONS end` – defines the action(s) to be executed when the event is triggered.
|
|
48
|
+
|
|
49
|
+
In the initial version, the following are available:
|
|
50
|
+
|
|
51
|
+
| Type | Element | Description | Status |
|
|
52
|
+
| --------- | -------------- | --------------------------------------- | ------ |
|
|
53
|
+
| OBJECT | last_target | Applies to the last evaluated target | |
|
|
54
|
+
| OBJECT | every_target | Applies to each individual target | TODO |
|
|
55
|
+
| OBJECT | all_targets | Applies to all targets collectively | TODO |
|
|
56
|
+
| CONDITION | failed | The object's state is "failed" | |
|
|
57
|
+
| CONDITION | passed | The object's state is "correct" | |
|
|
58
|
+
| ACTION | scores_to_zero | Resets all points earned so far to zero | |
|
|
59
|
+
| ACTION | stop | Stops the test for this case | |
|
|
60
|
+
|
|
61
|
+
## Example 1: "stop" action
|
|
62
|
+
|
|
63
|
+
Example:
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
group "Target with an exit condition" do
|
|
67
|
+
target "User 'root' exists"
|
|
68
|
+
run "id root"
|
|
69
|
+
expect_ok
|
|
70
|
+
|
|
71
|
+
target "User 'vader' exists", when_fails: :stop
|
|
72
|
+
run "id vader"
|
|
73
|
+
expect_ok
|
|
74
|
+
|
|
75
|
+
event on: :last_target, when: :failed, do
|
|
76
|
+
stop
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
target "User 'mail' exists"
|
|
80
|
+
run "id mail"
|
|
81
|
+
expect_ok
|
|
82
|
+
end
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The test is executed as follows:
|
|
86
|
+
|
|
87
|
+
* target 1: Evaluated and scored.
|
|
88
|
+
* target 2: Evaluated and scored.
|
|
89
|
+
* event:
|
|
90
|
+
* on: :last_target – based on the result of the last target:
|
|
91
|
+
* when: :failed
|
|
92
|
+
* If the result is a failure, the test ends here (for this case).
|
|
93
|
+
* If the result is successful, the process continues normally with target 3.
|
|
94
|
+
* Upon completion:
|
|
95
|
+
* The remaining "targets" are left unevaluated.
|
|
96
|
+
* The final score is derived from both the evaluated and unevaluated targets.
|
|
97
|
+
|
|
98
|
+
## Example 2: "grades_to_zero" action
|
|
99
|
+
|
|
100
|
+
Example:
|
|
101
|
+
|
|
102
|
+
```ruby
|
|
103
|
+
group "Target with an exit condition" do
|
|
104
|
+
target "User 'root' exists"
|
|
105
|
+
run "id root"
|
|
106
|
+
expect_ok
|
|
107
|
+
|
|
108
|
+
target "User 'vader' exists"
|
|
109
|
+
run "id vader"
|
|
110
|
+
expect_ok
|
|
111
|
+
|
|
112
|
+
event on: :last_target, when: :failed, do
|
|
113
|
+
scores_to_zero
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
target "User 'mail' exists"
|
|
117
|
+
run "id mail"
|
|
118
|
+
expect_ok
|
|
119
|
+
end
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
This test is executed as follows:
|
|
123
|
+
|
|
124
|
+
* target 1: Executed and evaluated.
|
|
125
|
+
* target 2: Executed and evaluated.
|
|
126
|
+
* event:
|
|
127
|
+
* on: :last_target — based on the result of the last target:
|
|
128
|
+
* when: :failed
|
|
129
|
+
* If the result is a failure, all "targets" evaluated up to that point are set to zero.
|
|
130
|
+
* If the result is successful, the process continues normally.
|
|
131
|
+
* Upon completion:
|
|
132
|
+
* The remaining unevaluated "targets" are processed.
|
|
133
|
+
* The final score is derived from both the evaluated and unevaluated targets.
|
|
134
|
+
|
|
135
|
+
## Example 3: Combining two actions
|
|
136
|
+
|
|
137
|
+
Example:
|
|
138
|
+
|
|
139
|
+
```ruby
|
|
140
|
+
group "Target with an exit condition" do
|
|
141
|
+
target "User 'root' exists"
|
|
142
|
+
run "id root"
|
|
143
|
+
expect_ok
|
|
144
|
+
|
|
145
|
+
target "User 'vader' exists"
|
|
146
|
+
run "id vader"
|
|
147
|
+
expect_ok
|
|
148
|
+
|
|
149
|
+
event on: :last_target, when: :failed, do
|
|
150
|
+
log "Test stopped due to failure of target 2"
|
|
151
|
+
scores_to_zero
|
|
152
|
+
stop
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
target "User 'mail' exists"
|
|
156
|
+
run "id mail"
|
|
157
|
+
expect_ok
|
|
158
|
+
end
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This test is executed as follows:
|
|
162
|
+
|
|
163
|
+
* target 1: Executed and evaluated. Target 2: Executed and evaluated.
|
|
164
|
+
* event
|
|
165
|
+
* on: :last_target — based on the outcome of the last target, the following actions are taken:
|
|
166
|
+
* when: :failed
|
|
167
|
+
* If the result is a failure:
|
|
168
|
+
* A message is recorded in the report log.
|
|
169
|
+
* All targets evaluated up to this point are reset to zero,
|
|
170
|
+
* and the test is terminated.
|
|
171
|
+
* In this case, the final score will be zero.
|
|
172
|
+
* If the result is successful, the process continues as normal.
|
data/docs/learn/01-cmd_new.md
CHANGED
data/docs/learn/02-target.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[<<
|
|
1
|
+
[<<back](../../README.md)
|
|
2
2
|
|
|
3
3
|
# Target
|
|
4
4
|
|
|
@@ -62,12 +62,12 @@ end
|
|
|
62
62
|
Execute this command to run the test:
|
|
63
63
|
|
|
64
64
|
```
|
|
65
|
-
$ teuton examples/02-target
|
|
65
|
+
$ teuton examples/02-target
|
|
66
66
|
|
|
67
|
-
CASE RESULTS
|
|
67
|
+
☰ CASE RESULTS
|
|
68
68
|
┌──────┬───────────┬───────┬───────┐
|
|
69
69
|
│ CASE │ MEMBERS │ GRADE │ STATE │
|
|
70
|
-
│ 01 │ anonymous │
|
|
70
|
+
│ 01 │ anonymous │ 67.0 │ │
|
|
71
71
|
└──────┴───────────┴───────┴───────┘
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -84,9 +84,9 @@ var
|
|
|
84
84
|
Let's see one report:
|
|
85
85
|
|
|
86
86
|
```
|
|
87
|
-
$ cat var/02-target/case-01.txt
|
|
87
|
+
$ cat var/02-target/case-01.txt
|
|
88
88
|
|
|
89
|
-
CONFIGURATION
|
|
89
|
+
⚒ CONFIGURATION
|
|
90
90
|
┌────────────────┬────────────────────────────────┐
|
|
91
91
|
│ tt_config_path │ examples/02-target/config.yaml │
|
|
92
92
|
│ tt_members │ anonymous │
|
|
@@ -95,9 +95,9 @@ $ cat var/02-target/case-01.txt
|
|
|
95
95
|
│ tt_skip │ false │
|
|
96
96
|
└────────────────┴────────────────────────────────┘
|
|
97
97
|
|
|
98
|
-
GROUPS
|
|
99
|
-
▶
|
|
100
|
-
✖ 01 (0.0/
|
|
98
|
+
☰ GROUPS
|
|
99
|
+
▶ Practicing targets
|
|
100
|
+
✖ 01 (0.0/1.0) ┌──
|
|
101
101
|
Description │ Create user obiwan
|
|
102
102
|
Command │ id obiwan
|
|
103
103
|
Output │ id: «obiwan»: no existe ese usuario
|
|
@@ -105,7 +105,7 @@ $ cat var/02-target/case-01.txt
|
|
|
105
105
|
Alterations │ find(uid=) & find((obiwan)) & find(gid=) & count
|
|
106
106
|
Expected │ Greater than 0
|
|
107
107
|
Result │ 0
|
|
108
|
-
✔ 02 (
|
|
108
|
+
✔ 02 (2.0/2.0) ├──
|
|
109
109
|
Description │ Delete user vader
|
|
110
110
|
Command │ id vader
|
|
111
111
|
Output │ id: «vader»: no existe ese usuario
|
|
@@ -114,17 +114,17 @@ $ cat var/02-target/case-01.txt
|
|
|
114
114
|
Expected │ Greater than 0
|
|
115
115
|
Result │ 1
|
|
116
116
|
└──
|
|
117
|
-
RESULTS
|
|
117
|
+
🗹 RESULTS
|
|
118
118
|
┌──────────────┬───────────────────────────┐
|
|
119
119
|
│ unique_fault │ 0 │
|
|
120
120
|
│ case_id │ 01 │
|
|
121
|
-
│ start_time │ 2026-10-
|
|
122
|
-
│ finish_time │ 2026-10-
|
|
123
|
-
│ duration │ 0.
|
|
121
|
+
│ start_time │ 2026-10-26 12:20:01 +0000 │
|
|
122
|
+
│ finish_time │ 2026-10-26 12:20:01 +0000 │
|
|
123
|
+
│ duration │ 0.003806668 │
|
|
124
124
|
│ max_weight │ 3.0 │
|
|
125
|
-
│ good_weight │
|
|
126
|
-
│ fail_weight │
|
|
125
|
+
│ good_weight │ 2.0 │
|
|
126
|
+
│ fail_weight │ 1.0 │
|
|
127
127
|
│ fail_counter │ 1 │
|
|
128
|
-
│ grade │
|
|
128
|
+
│ grade │ 67 │
|
|
129
129
|
└──────────────┴───────────────────────────┘
|
|
130
|
-
```
|
|
130
|
+
```
|
data/docs/learn/04-config.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[<<
|
|
1
|
+
[<<back](../../README.md)
|
|
2
2
|
|
|
3
3
|
# config
|
|
4
4
|
|
|
@@ -7,6 +7,8 @@ Our tests use config file to write dinamic data into separated file.
|
|
|
7
7
|
By default, `config.yaml` is our config file. Example:
|
|
8
8
|
|
|
9
9
|
```yaml
|
|
10
|
+
# File: config.yaml
|
|
11
|
+
# Desc: configuration file
|
|
10
12
|
global:
|
|
11
13
|
tt_output_dir: var/04-config/default
|
|
12
14
|
cases:
|
|
@@ -36,8 +38,8 @@ end
|
|
|
36
38
|
|
|
37
39
|
```
|
|
38
40
|
$ teuton examples/04-config
|
|
39
|
-
|
|
40
|
-
CASE RESULTS
|
|
41
|
+
|
|
42
|
+
☰ CASE RESULTS
|
|
41
43
|
┌──────┬───────────┬───────┬───────┐
|
|
42
44
|
│ CASE │ MEMBERS │ GRADE │ STATE │
|
|
43
45
|
│ 01 │ student_1 │ 100.0 │ ✔ │
|
|
@@ -60,7 +62,7 @@ Let's see case 01 report.
|
|
|
60
62
|
```
|
|
61
63
|
$ cat var/04-config/default/case-01.txt
|
|
62
64
|
|
|
63
|
-
CONFIGURATION
|
|
65
|
+
⚒ CONFIGURATION
|
|
64
66
|
┌────────────────┬────────────────────────────────┐
|
|
65
67
|
│ tt_config_path │ examples/04-config/config.yaml │
|
|
66
68
|
│ tt_members │ student_1 │
|
|
@@ -71,24 +73,24 @@ $ cat var/04-config/default/case-01.txt
|
|
|
71
73
|
│ username │ david │
|
|
72
74
|
└────────────────┴────────────────────────────────┘
|
|
73
75
|
|
|
74
|
-
GROUPS
|
|
76
|
+
☰ GROUPS
|
|
75
77
|
▶ Reading params from config file
|
|
76
78
|
✔ 01 (1.0/1.0) ┌──
|
|
77
79
|
Description │ Create user david
|
|
78
80
|
Command │ id david
|
|
79
81
|
Output │ uid=1000(david) gid=1000(david) grupos=1000(david),478(wheel),464(vboxusers),108(libvirt),107(qemu),462(vagrant),460(docker),452(ollama)
|
|
80
|
-
Duration │ 0.
|
|
82
|
+
Duration │ 0.012 (local)
|
|
81
83
|
Alterations │ find(uid=) & find((david)) & find(gid=) & count
|
|
82
84
|
Expected │ Greater than 0
|
|
83
85
|
Result │ 1
|
|
84
86
|
└──
|
|
85
|
-
RESULTS
|
|
87
|
+
🗹 RESULTS
|
|
86
88
|
┌──────────────┬───────────────────────────┐
|
|
87
89
|
│ unique_fault │ 0 │
|
|
88
90
|
│ case_id │ 01 │
|
|
89
|
-
│ start_time │ 2026-10-
|
|
90
|
-
│ finish_time │ 2026-10-
|
|
91
|
-
│ duration │ 0.
|
|
91
|
+
│ start_time │ 2026-10-26 12:22:36 +0000 │
|
|
92
|
+
│ finish_time │ 2026-10-26 12:22:36 +0000 │
|
|
93
|
+
│ duration │ 0.012505538 │
|
|
92
94
|
│ max_weight │ 1.0 │
|
|
93
95
|
│ good_weight │ 1.0 │
|
|
94
96
|
│ fail_weight │ 0 │
|
|
@@ -110,7 +112,7 @@ Execute the same test but using diferents config files. Config files available:
|
|
|
110
112
|
```
|
|
111
113
|
$ teuton examples/04-config
|
|
112
114
|
|
|
113
|
-
CASE RESULTS
|
|
115
|
+
☰ CASE RESULTS
|
|
114
116
|
┌──────┬───────────┬───────┬───────┐
|
|
115
117
|
│ CASE │ MEMBERS │ GRADE │ STATE │
|
|
116
118
|
│ 01 │ student_1 │ 100.0 │ ✔ │
|
|
@@ -123,7 +125,7 @@ $ teuton examples/04-config
|
|
|
123
125
|
```
|
|
124
126
|
$ teuton run --cname=starwars examples/04-config
|
|
125
127
|
|
|
126
|
-
CASE RESULTS
|
|
128
|
+
☰ CASE RESULTS
|
|
127
129
|
┌──────┬────────────┬───────┬───────┐
|
|
128
130
|
│ CASE │ MEMBERS │ GRADE │ STATE │
|
|
129
131
|
│ 01 │ Yoda │ 0.0 │ ? │
|
|
@@ -136,7 +138,7 @@ $ teuton run --cname=starwars examples/04-config
|
|
|
136
138
|
```
|
|
137
139
|
$ teuton run --cpath=examples/04-config/rock.yaml examples/04-config
|
|
138
140
|
|
|
139
|
-
CASE RESULTS
|
|
141
|
+
☰ CASE RESULTS
|
|
140
142
|
┌──────┬────────────┬───────┬───────┐
|
|
141
143
|
│ CASE │ MEMBERS │ GRADE │ STATE │
|
|
142
144
|
│ 01 │ AC/DC band │ 0.0 │ ? │
|
data/docs/learn/05-use.md
CHANGED
data/docs/learn/06-cmd_check.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
[<<
|
|
2
|
+
[<<back](../../README.md)
|
|
3
3
|
|
|
4
4
|
# check test
|
|
5
5
|
|
|
6
|
-
`teuton check DIRPATH` is a command function that checks syntax and show statistics.
|
|
6
|
+
`teuton check DIRPATH` is a command function that checks syntax and show statistics. It is very useful for locating syntax errors in test files.
|
|
7
7
|
|
|
8
8
|
## Example
|
|
9
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[<<
|
|
1
|
+
[<<back](../../README.md)
|
|
2
2
|
|
|
3
3
|
# Target weight
|
|
4
4
|
|
|
@@ -24,8 +24,9 @@ group "Using file: network" do
|
|
|
24
24
|
end
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Output:
|
|
28
27
|
```
|
|
28
|
+
$ teuton check example/07-target-weight
|
|
29
|
+
...
|
|
29
30
|
┌────────────────────────────┐
|
|
30
31
|
│ GROUP: Using file: network │
|
|
31
32
|
└────────────────────────────┘
|
|
@@ -38,4 +39,5 @@ Output:
|
|
|
38
39
|
weight 2.0
|
|
39
40
|
run 'host www.google.es' on host1
|
|
40
41
|
expect www.google.es has address (String)
|
|
42
|
+
...
|
|
41
43
|
```
|
data/docs/learn/09-send.md
CHANGED