teuton 2.7.3 → 2.9.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 +4 -4
- data/docs/changelog/changelog.1.md +119 -0
- data/docs/changelog/changelog.2.md +105 -0
- data/docs/diagram.md +10 -10
- data/docs/dsl/expect.md +76 -23
- data/docs/dsl/export.md +6 -3
- data/docs/dsl/result.md +24 -30
- data/docs/dsl/send.md +34 -23
- data/docs/learn/02-target.md +32 -27
- data/docs/learn/13-feedback.md +8 -9
- data/docs/learn/25-expect-result.md +39 -0
- data/docs/learn/26-expect_sequence.md +79 -0
- data/docs/learn/27-run_script.md +91 -0
- data/docs/learn/28-upload.md +55 -0
- data/docs/learn/README.md +4 -15
- data/docs/videos.md +14 -8
- data/lib/teuton/case/case.rb +3 -3
- data/lib/teuton/case/config.rb +0 -5
- data/lib/teuton/case/dsl/all.rb +5 -1
- data/lib/teuton/case/dsl/expect.rb +20 -33
- data/lib/teuton/case/dsl/expect_exitcode.rb +31 -0
- data/lib/teuton/case/dsl/expect_sequence.rb +173 -0
- data/lib/teuton/case/dsl/getset.rb +0 -1
- data/lib/teuton/case/dsl/host.rb +5 -0
- data/lib/teuton/case/dsl/macro.rb +7 -4
- data/lib/teuton/case/dsl/run_script.rb +35 -0
- data/lib/teuton/case/dsl/send.rb +3 -3
- data/lib/teuton/case/dsl/upload.rb +42 -0
- data/lib/teuton/case/dsl/weight.rb +12 -0
- data/lib/teuton/case/execute/execute_ssh.rb +11 -7
- data/lib/teuton/case/host.rb +68 -0
- data/lib/teuton/case/play.rb +2 -6
- data/lib/teuton/{utils → case}/result/ext_array.rb +0 -1
- data/lib/teuton/{utils → case}/result/ext_compare.rb +0 -1
- data/lib/teuton/{utils → case}/result/ext_filter.rb +0 -2
- data/lib/teuton/{utils → case}/result/result.rb +13 -21
- data/lib/teuton/check/checker.rb +82 -0
- data/lib/teuton/check/dsl/all.rb +37 -0
- data/lib/teuton/check/{builtin.rb → dsl/builtin.rb} +1 -3
- data/lib/teuton/check/dsl/expect.rb +90 -0
- data/lib/teuton/check/dsl/expect_sequence.rb +29 -0
- data/lib/teuton/check/dsl/getset.rb +23 -0
- data/lib/teuton/check/dsl/run.rb +35 -0
- data/lib/teuton/check/main.rb +29 -0
- data/lib/teuton/check/show.rb +75 -100
- data/lib/teuton/{utils → deprecated}/application.rb +0 -6
- data/lib/teuton/deprecated/application_test.rb +32 -0
- data/lib/teuton/readme/dsl/all.rb +32 -0
- data/lib/teuton/readme/dsl/expect.rb +29 -0
- data/lib/teuton/readme/dsl/getset.rb +33 -0
- data/lib/teuton/readme/dsl/run.rb +51 -0
- data/lib/teuton/readme/lang.rb +8 -10
- data/lib/teuton/readme/main.rb +27 -0
- data/lib/teuton/readme/readme.rb +31 -58
- data/lib/teuton/readme/result.rb +7 -0
- data/lib/teuton/report/formatter/default/txt.rb +2 -2
- data/lib/teuton/utils/configfile_reader.rb +8 -4
- data/lib/teuton/utils/logger.rb +32 -0
- data/lib/teuton/utils/verbose.rb +1 -1
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +6 -5
- metadata +45 -37
- data/docs/CHANGELOG.md +0 -10
- data/docs/changelog/v2.0.md +0 -18
- data/docs/changelog/v2.1.md +0 -54
- data/docs/changelog/v2.2.md +0 -42
- data/docs/changelog/v2.3.md +0 -10
- data/docs/changelog/v2.4.md +0 -41
- data/docs/changelog/v2.5.md +0 -6
- data/docs/changelog/v2.6.md +0 -4
- data/docs/changelog/v2.7.md +0 -23
- data/docs/changelog/version2.1.md +0 -4
- data/docs/learn/videos.md +0 -13
- data/lib/teuton/case/execute/copy_ssh.rb +0 -70
- data/lib/teuton/check/dsl.rb +0 -112
- data/lib/teuton/check/laboratory.rb +0 -59
- data/lib/teuton/readme/dsl.rb +0 -126
- /data/lib/teuton/case/dsl/{goto.rb → run.rb} +0 -0
- /data/lib/teuton/{case/deprecated → deprecated}/runner.rb +0 -0
- /data/lib/teuton/{case/deprecated → deprecated}/utils.rb +0 -0
data/docs/learn/02-target.md
CHANGED
@@ -7,37 +7,40 @@ A [target](../dsl/target.md) is a feature you want to check. Targets are defined
|
|
7
7
|
## Target definition
|
8
8
|
|
9
9
|
* [target](dsl/target.md): Description of the element to be tested.
|
10
|
-
* [run](../dsl/run.md): Execute a command `id
|
10
|
+
* [run](../dsl/run.md): Execute a command `id obiwan` on localhost.
|
11
11
|
* [expect](../&dsl/expect.md): Verify that the result contains expected value.
|
12
12
|
|
13
13
|
```ruby
|
14
14
|
group "Learn about targets" do
|
15
15
|
|
16
|
-
target "
|
17
|
-
run "id
|
18
|
-
expect ["uid=", "(
|
16
|
+
target "Exist user obiwan"
|
17
|
+
run "id obiwan"
|
18
|
+
expect ["uid=", "(obiwan)", "gid="]
|
19
19
|
|
20
20
|
target "Delete user vader"
|
21
21
|
run "id vader"
|
22
|
-
|
23
|
-
|
22
|
+
expect_fail
|
24
23
|
end
|
25
24
|
```
|
26
25
|
|
27
|
-
> In this example, our localhost's OS is GNU/Linux (or any other compatible OS) because the command executed is `id
|
26
|
+
> In this example, our localhost's OS is GNU/Linux (or any other compatible OS) because the command executed is `id obiwan`.
|
28
27
|
|
29
|
-
When the user exists, we expect this words: `uid=, (
|
28
|
+
When the user exists, we expect this words: `uid=, (obiwan), gid=`.
|
30
29
|
|
31
30
|
```
|
32
|
-
❯ id
|
33
|
-
uid=1000(
|
31
|
+
❯ id obiwan
|
32
|
+
uid=1000(obiwan) gid=1000(obiwan) grupos=1000(obiwan)
|
34
33
|
```
|
35
34
|
|
36
35
|
But when user does not exist, we expect different words: `id:, vader, no exist`.
|
37
36
|
|
38
37
|
```
|
39
38
|
❯ id vader
|
40
|
-
id: «vader»: no
|
39
|
+
id: «vader»: no such user
|
40
|
+
|
41
|
+
❯ echo $?
|
42
|
+
1
|
43
|
+
|
41
44
|
```
|
42
45
|
|
43
46
|
## Execution section
|
@@ -93,32 +96,34 @@ CONFIGURATION
|
|
93
96
|
|
94
97
|
GROUPS
|
95
98
|
- Learn about targets
|
96
|
-
01 (
|
97
|
-
Description : Create user
|
98
|
-
Command : id
|
99
|
+
01 (0.0/1.0)
|
100
|
+
Description : Create user obiwan
|
101
|
+
Command : id obiwan
|
102
|
+
Output : id: «obiwan»: no existe ese usuario
|
99
103
|
Duration : 0.002 (local)
|
100
|
-
Alterations : find(uid=) & find((
|
101
|
-
Expected : Greater than 0
|
102
|
-
Result :
|
104
|
+
Alterations : find(uid=) & find((obiwan)) & find(gid=) & count
|
105
|
+
Expected : Greater than 0
|
106
|
+
Result : 0
|
103
107
|
02 (1.0/1.0)
|
104
108
|
Description : Delete user vader
|
105
109
|
Command : id vader
|
110
|
+
Output : id: «vader»: no existe ese usuario
|
106
111
|
Duration : 0.002 (local)
|
107
|
-
Alterations :
|
108
|
-
Expected : Greater than 0
|
109
|
-
Result : 1
|
112
|
+
Alterations : Read exit code
|
113
|
+
Expected : Greater than 0
|
114
|
+
Result : 1
|
110
115
|
|
111
116
|
RESULTS
|
112
117
|
+--------------+---------------------------+
|
113
118
|
| case_id | 01 |
|
114
|
-
| start_time | 2023-
|
115
|
-
| finish_time | 2023-
|
116
|
-
| duration | 0.
|
119
|
+
| start_time | 2023-06-16 08:42:13 +0100 |
|
120
|
+
| finish_time | 2023-06-16 08:42:13 +0100 |
|
121
|
+
| duration | 0.004527443 |
|
117
122
|
| unique_fault | 0 |
|
118
123
|
| max_weight | 2.0 |
|
119
|
-
| good_weight |
|
120
|
-
| fail_weight |
|
121
|
-
| fail_counter |
|
122
|
-
| grade |
|
124
|
+
| good_weight | 1.0 |
|
125
|
+
| fail_weight | 1.0 |
|
126
|
+
| fail_counter | 1 |
|
127
|
+
| grade | 50 |
|
123
128
|
+--------------+---------------------------+
|
124
129
|
```
|
data/docs/learn/13-feedback.md
CHANGED
@@ -20,17 +20,16 @@ end
|
|
20
20
|
|
21
21
|
Every time teuton is run, all cases are evaluated and when exporting the results, by default, all the information collected during the evaluation process is logged.
|
22
22
|
|
23
|
-
Each
|
23
|
+
Each `target` contains following fields:
|
24
24
|
|
25
|
-
* Identification: id
|
26
|
-
* Evaluation result: check(true/false)
|
27
|
-
* Punctuation: score
|
28
|
-
* Check process: conn_type
|
25
|
+
* Identification: `id`, `description`
|
26
|
+
* Evaluation result: `check`(true/false)
|
27
|
+
* Punctuation: `score`, `weight`
|
28
|
+
* Check process: `conn_type`, `command`, `duration`, `alterations`, `expected` and `result`
|
29
29
|
|
30
|
-
Some of these fields should always be visible, such as: id, description, check, score, and weight. And others, more related to the process that perform teuton for verification can be hidden using the
|
31
|
-
|
32
|
-
With "feedback: false" the fields are hidden: command, alterations, expected and result.
|
30
|
+
Some of these fields should always be visible, such as: id, description, check, score, and weight. And others, more related to the process that perform teuton for verification can be hidden using the `feedback: false` parameter.
|
33
31
|
|
32
|
+
With `feedback: false` the fields are hidden: command, alterations, expected and result.
|
34
33
|
|
35
34
|
## Results
|
36
35
|
|
@@ -40,7 +39,7 @@ Executing `teuton run examples/13-feedback`, we get this output:
|
|
40
39
|
GROUPS
|
41
40
|
- Preserve output reports
|
42
41
|
01 (1.0/1.0)
|
43
|
-
Description : Exits user
|
42
|
+
Description : Exits user Obiwan
|
44
43
|
Command : ********
|
45
44
|
Duration : 0.002 (local)
|
46
45
|
Alterations : *******************
|
@@ -0,0 +1,39 @@
|
|
1
|
+
[<<back](README.md)
|
2
|
+
|
3
|
+
# expect vs result
|
4
|
+
|
5
|
+
* `expect` is the statement we use to evaluate the result generated by a previous `run` statement.
|
6
|
+
* `result` allows you to manipulate the output of the run command in more detail.
|
7
|
+
|
8
|
+
`expect` is easier to use but less powerful than `result`.
|
9
|
+
|
10
|
+
> Example files at [examples/25-expect-result](../../examples/25-expect-result)
|
11
|
+
|
12
|
+
## Expect
|
13
|
+
|
14
|
+
`expect` has different ways to evaluate result.
|
15
|
+
|
16
|
+
| DSL | Description |
|
17
|
+
| ------------------ | ----------- |
|
18
|
+
| expect FILTER | it finds lines in the output with the content FILTER |
|
19
|
+
| expect_none FILTER | it finds lines in the output without the FILTER content |
|
20
|
+
| expect_nothing | is true when the result is empty |
|
21
|
+
| expect_exit NUMBER | Exit code is NUMBER |
|
22
|
+
| expect_ok | Exit code 0 |
|
23
|
+
| expect_fail | Exit code > 0 |
|
24
|
+
|
25
|
+
> Learn more about [expect](../dsl/expect.md)
|
26
|
+
|
27
|
+
## Result
|
28
|
+
|
29
|
+
`result` is an object that encapsulates the output of the run command and allows manipulation of its contents before being evaluated by `expect`.
|
30
|
+
|
31
|
+
| Result command | Description |
|
32
|
+
| -------------- | ----------- |
|
33
|
+
| expect result.count.eq NUMBER | Is true when output has NUMBER lines |
|
34
|
+
| expect result.count.gt NUMBER | Is true when output has more than NUMBER lines |
|
35
|
+
| expect result.count.lt NUMBER | is true when output has less than NUMBER lines |
|
36
|
+
| expect result.grep(FILTER).count.eq NUMBER | output has NUMBER lines with FILTER |
|
37
|
+
| expect result.grep_v(FILTER).count.eq NUMBER | output has NUMBER lines without FILTER |
|
38
|
+
|
39
|
+
> Learn more about [result](../dsl/result.md)
|
@@ -0,0 +1,79 @@
|
|
1
|
+
[<<back](README.md)
|
2
|
+
|
3
|
+
# DSL: expect_sequence
|
4
|
+
|
5
|
+
Evaluate the occurrence of a certain sequence that takes place in different lines of the output.
|
6
|
+
|
7
|
+
> Example files at [examples/26-expect_sequence](../../examples/26-expect_sequence)
|
8
|
+
|
9
|
+
## Description
|
10
|
+
|
11
|
+
In the classic target/run/expect, the expect statement works by locating lines from the output of the previous command that meet certain criteria.
|
12
|
+
|
13
|
+
We can even (using regular expressions) detect if there is any line in the output where a certain sequence appears.
|
14
|
+
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
# Example:
|
18
|
+
# expect with regular expression to detect [a, b, c] sequence
|
19
|
+
# within a line
|
20
|
+
|
21
|
+
expect /a.*?b.*?c/
|
22
|
+
```
|
23
|
+
|
24
|
+
> Regular expressions are very powerful but they are also complex to use.
|
25
|
+
|
26
|
+
To evaluate the occurrence of a certain sequence that takes place in different lines of the output we will use the new "expect_sequence" instruction.
|
27
|
+
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# Example:
|
31
|
+
# expect_sequence to detect [a, b, c] sequence
|
32
|
+
|
33
|
+
expect_sequence do
|
34
|
+
find "a"
|
35
|
+
find "b"
|
36
|
+
find "c"
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
> NOTE: expect_sequence can be useful for evaluating iptables firewall configurations where permission assignment order is relevant.
|
41
|
+
|
42
|
+
## Evaluating different sequences
|
43
|
+
|
44
|
+
* **Simple sequence**. Validate sequences where the elements are in order. Use `find` statement to find each element of the sequence.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# Examples: [A,B,C], [A,s,B,s,C], [x,A,B,s,C,x], etc.
|
48
|
+
|
49
|
+
expect_sequence do
|
50
|
+
find "A"
|
51
|
+
find "B"
|
52
|
+
find "C"
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
* **Strict sequence**. validate sequences where the elements are in strict consecutive order. First use `find` to find an element in the sequence and then `next_to` for the next element in strict order.
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
# Examples: [A,B,C], [x,A,B,C,x], etc.
|
60
|
+
|
61
|
+
expect_sequence do
|
62
|
+
find "A"
|
63
|
+
next_to "B"
|
64
|
+
next_to "C"
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
* **Strict sequence with jumps**. Use `ignore N` to indicate that there are N lines between 2 elements of the sequence.
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
# Examples: [A,B,s,s,C], [x,A,B,s,s,C,x], etc.
|
72
|
+
|
73
|
+
expect_sequence do
|
74
|
+
find "A"
|
75
|
+
next_to "B"
|
76
|
+
ignore 2
|
77
|
+
next_to "C"
|
78
|
+
end
|
79
|
+
```
|
@@ -0,0 +1,91 @@
|
|
1
|
+
[<<back](README.md)
|
2
|
+
|
3
|
+
# DSL: run_script
|
4
|
+
|
5
|
+
You know the classic sequence `target/run/expect`, but sometimes you need to run our own script files on the remote computer. So you have to:
|
6
|
+
|
7
|
+
1. Upload a copy of the script file to the remote host
|
8
|
+
2. and then run it on remote host
|
9
|
+
|
10
|
+
**run_script** upload and execute your own local script on remote host.
|
11
|
+
|
12
|
+
> Example files at [examples/27-run_file](../../examples/27-run_script)
|
13
|
+
|
14
|
+
## Example scripts
|
15
|
+
|
16
|
+
Suppose we have the following files:
|
17
|
+
```
|
18
|
+
example
|
19
|
+
├── config.yaml
|
20
|
+
├── show.sh
|
21
|
+
└── start.rb
|
22
|
+
```
|
23
|
+
|
24
|
+
Contents of the `show.sh` script:
|
25
|
+
```bash
|
26
|
+
#!/usr/bin/env bash
|
27
|
+
MESSAGE=$1
|
28
|
+
echo $MESSAGE
|
29
|
+
exit 0
|
30
|
+
```
|
31
|
+
|
32
|
+
## Usage examples
|
33
|
+
|
34
|
+
`run_script` is the DSL keyword in charge of uploading the script to the remote computer and executing it. When invoking run_script we have two styles: compact or separate components. Let's see
|
35
|
+
|
36
|
+
**Compact invocation**: The "command" to execute contains the interpreter, the script, and the arguments.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
target "Mode 1: Upload script and execute on remote host"
|
40
|
+
run_script "bash show.sh Hello", on: :host1
|
41
|
+
expect "Hello"
|
42
|
+
```
|
43
|
+
|
44
|
+
**Separate components**: pass the name of the script, the interpreter in charge of processing it and its arguments through separate parameters.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
target "Mode 2: Upload script and execute on remote host"
|
48
|
+
run_script "show.sh", shell: "bash", args: "Hello", on: :host1
|
49
|
+
expect "Hello"
|
50
|
+
```
|
51
|
+
|
52
|
+
Or setting shell default value:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
set(:shell, "bash")
|
56
|
+
|
57
|
+
target "Mode 2: Upload script and execute on remote host"
|
58
|
+
run_script "show.sh", args: "Hello", on: :host1
|
59
|
+
expect "Hello"
|
60
|
+
```
|
61
|
+
|
62
|
+
## Running example
|
63
|
+
|
64
|
+
```
|
65
|
+
------------------------------------
|
66
|
+
Started at 2023-07-23 13:46:11 +0100
|
67
|
+
....uu..u.u.u.uu..u.!F!F!F!F
|
68
|
+
Finished in 30.457 seconds
|
69
|
+
------------------------------------
|
70
|
+
|
71
|
+
CASE RESULTS
|
72
|
+
+------+-----------+-------+-------+
|
73
|
+
| CASE | MEMBERS | GRADE | STATE |
|
74
|
+
| 01 | Localhost | 100.0 | ✔ |
|
75
|
+
| 02 | Remote1 | 100.0 | ✔ |
|
76
|
+
| 03 | Remote2 | 100.0 | ✔ |
|
77
|
+
| 04 | Remote3 | 0.0 | ? |
|
78
|
+
+------+-----------+-------+-------+
|
79
|
+
|
80
|
+
CONN ERRORS
|
81
|
+
+------+---------+-------+------------------+
|
82
|
+
| CASE | MEMBERS | HOST | ERROR |
|
83
|
+
| 04 | Remote3 | host1 | host_unreachable |
|
84
|
+
+------+---------+-------+------------------+
|
85
|
+
```
|
86
|
+
|
87
|
+
Meaning of progress symbols:
|
88
|
+
* `.`: check ok
|
89
|
+
* `F`: check fail
|
90
|
+
* `!`: connection fail
|
91
|
+
* `u`: upload ok
|
@@ -0,0 +1,55 @@
|
|
1
|
+
[<<back](README.md)
|
2
|
+
|
3
|
+
# DSL: upload
|
4
|
+
|
5
|
+
`upload` is a dsl instruction, whose purpose is to upload files to the remote host.
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
upload "FILENAME", to: :host1
|
9
|
+
```
|
10
|
+
|
11
|
+
* `upload "FILENAME"`, upload local file to remote.
|
12
|
+
* `to: :host1`, specifies remote host.
|
13
|
+
|
14
|
+
> Example files at [examples/28-upload](../../examples/28-upload)
|
15
|
+
|
16
|
+
## Other options
|
17
|
+
|
18
|
+
* Upload "LOCALDIR/FILENAME" to default remote dir into remote host:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
upload "LOCALDIR/FILENAME", to: :host1
|
22
|
+
```
|
23
|
+
|
24
|
+
* Upload "LOCALDIR/FILENAME" to remote dir into remote host:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
upload "LOCALDIR/FILENAME", remotedir: "REMOTEDIR", to: :host1
|
28
|
+
```
|
29
|
+
|
30
|
+
* Upload several local files from "LOCALDIR" to default remote dir into host:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
upload "LOCALDIR/*", to: :host1
|
34
|
+
```
|
35
|
+
|
36
|
+
* Upload several local files from "LOCALDIR" to remote host:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
upload "LOCALDIR/*", remotedir: "REMOTEDIR", to: :host1
|
40
|
+
```
|
41
|
+
|
42
|
+
## Example
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
target "Upload file and then run it"
|
46
|
+
upload "script/show.sh", remotedir: "sh", to: :host1
|
47
|
+
run "bash sh/show.sh HelloWorld", on: :host1
|
48
|
+
expect "HelloWorld"
|
49
|
+
```
|
50
|
+
|
51
|
+
Example steps:
|
52
|
+
1. Describe target.
|
53
|
+
2. Upload local file to remote host.
|
54
|
+
3. Run script using Bash on remote host.
|
55
|
+
4. Evaluate script output.
|
data/docs/learn/README.md
CHANGED
@@ -28,20 +28,9 @@ Learn how write your own Teuton tests:
|
|
28
28
|
1. [RESULT object](22-result.md)
|
29
29
|
1. [Test code](23-test-code.md)
|
30
30
|
1. [Test SQL and database](24-test-sql.md)
|
31
|
+
1. [expect vs result](25-expect-result.md) TODO
|
32
|
+
1. [EXPECT_SEQUENCE](26-expect_sequence.md)
|
33
|
+
1. [RUN_SCRIPT](27-run_script.md)
|
34
|
+
1. [UPLOAD](28-upload.md)
|
31
35
|
|
32
36
|
Mores examples at [teuton-tests](https://github.com/dvarrui/teuton-tests) GitHub repository.
|
33
|
-
|
34
|
-
# Videos
|
35
|
-
|
36
|
-
By now there are no English videos. We are sorry!
|
37
|
-
But if you want to see Spanish videos, here you are:
|
38
|
-
|
39
|
-
Teuton (v2.0):
|
40
|
-
* [ES - CHAPI19: Charla Teuton](https://youtu.be/KFWQDfNAFxI?t=12221)
|
41
|
-
* [ES - CHAPI19: Teuton demo](https://github.com/dvarrui/proyectos-de-ejemplo/tree/master/charlas/teuton)
|
42
|
-
|
43
|
-
Sysadmingame (Teuton v1.0)
|
44
|
-
* [Sysadmingame (1 de 3): Instalación del programa](https://youtu.be/dnyMq9_KDco)
|
45
|
-
* [Sysadmingame (2 de 3): Crear un caso simple](https://youtu.be/0e2g5Izvc6c)
|
46
|
-
* [Sysadmingame (3 de 3): Crear un caso complejo](https://youtu.be/ebEK6OXH8kQ)
|
47
|
-
* [CHAPI16 - Charla sysadmingame](https://youtu.be/cNJaB5xzHHQ)
|
data/docs/videos.md
CHANGED
@@ -7,14 +7,20 @@
|
|
7
7
|
|
8
8
|
# Videos
|
9
9
|
|
10
|
-
|
10
|
+
> By now there are no English videos. We are sorry!
|
11
|
+
|
12
|
+
Teuton v2.1:
|
11
13
|
* [Apuntes FP Informática - I Congreso Virtual - Mayo 2020](https://youtu.be/RxIV26BAoGo)
|
12
|
-
* [Teuton Software 2.1 - Tutorial -
|
14
|
+
* [Teuton Software 2.1 - Tutorial - Abr 2020](https://youtu.be/cyBN-rOYQeY)
|
13
15
|
|
14
|
-
Teuton
|
15
|
-
* ES -
|
16
|
-
*
|
17
|
-
1. [Instalación del programa](https://youtu.be/dnyMq9_KDco)
|
18
|
-
2. [Crear un caso simple](https://youtu.be/0e2g5Izvc6c)
|
19
|
-
3. [Crear un caso complejo](https://youtu.be/ebEK6OXH8kQ)
|
16
|
+
Teuton v2.0:
|
17
|
+
* [ES - CHAPI19: Charla Teuton](https://youtu.be/KFWQDfNAFxI?t=12221)
|
18
|
+
* [ES - CHAPI19: Teuton demo](https://github.com/dvarrui/proyectos-de-ejemplo/tree/master/charlas/teuton)
|
20
19
|
|
20
|
+
Sysadmingame (Teuton v1.0):
|
21
|
+
* [Sysadmingame (1 de 3): Instalación del programa](https://youtu.be/dnyMq9_KDco)
|
22
|
+
* [Sysadmingame (2 de 3): Crear un caso simple](https://youtu.be/0e2g5Izvc6c)
|
23
|
+
* [Sysadmingame (3 de 3): Crear un caso complejo](https://youtu.be/ebEK6OXH8kQ)
|
24
|
+
|
25
|
+
Sysadmingame: En el 2016 el proyecto se llamaba "sysadmingame".
|
26
|
+
* ES -[CHAPI16 - Presentación sysadmingame chapi16 - Abril 2016](https://youtu.be/cNJaB5xzHHQ)
|
data/lib/teuton/case/case.rb
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
require_relative "../utils/project"
|
4
4
|
require_relative "../utils/verbose"
|
5
|
-
require_relative "../utils/result/result"
|
6
5
|
require_relative "../report/report"
|
7
6
|
require_relative "dsl/all"
|
8
7
|
require_relative "config"
|
9
8
|
require_relative "close"
|
9
|
+
# require_relative "builtin/main"
|
10
|
+
require_relative "host"
|
10
11
|
require_relative "play"
|
11
|
-
require_relative "
|
12
|
+
require_relative "result/result"
|
12
13
|
|
13
14
|
class Case
|
14
|
-
# Case: export, filename, grade, members,skip
|
15
15
|
include DSL
|
16
16
|
include Verbose
|
17
17
|
|
data/lib/teuton/case/config.rb
CHANGED
data/lib/teuton/case/dsl/all.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
require_relative "expect"
|
2
2
|
require_relative "getset"
|
3
|
-
require_relative "
|
3
|
+
require_relative "host"
|
4
4
|
require_relative "log"
|
5
5
|
require_relative "macro"
|
6
|
+
require_relative "run"
|
7
|
+
require_relative "run_script"
|
6
8
|
require_relative "send"
|
7
9
|
require_relative "target"
|
8
10
|
require_relative "unique"
|
11
|
+
require_relative "upload"
|
12
|
+
require_relative "weight"
|
@@ -1,26 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
# expect_nothing, expect_none, expect_one
|
3
|
+
require_relative "expect_exitcode"
|
4
|
+
require_relative "expect_sequence"
|
6
5
|
|
7
|
-
|
6
|
+
module DSL
|
7
|
+
# expect <condition>,
|
8
|
+
# value: RealValue,
|
9
|
+
# expected: ExpectedValue,
|
10
|
+
# weight: float
|
11
|
+
#
|
8
12
|
def expect(input, args = {})
|
9
13
|
if input.instance_of?(TrueClass) || input.instance_of?(FalseClass)
|
10
14
|
expect2(input, args)
|
11
15
|
elsif input.instance_of?(String) || input.instance_of?(Regexp) || input.instance_of?(Array)
|
12
16
|
expect_any input
|
13
17
|
else
|
14
|
-
puts Rainbow("[
|
18
|
+
puts Rainbow("[ERROR] Case expect TypeError: expect #{input} (#{input.class})").red
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
18
22
|
def expect2(cond, args = {})
|
19
23
|
@action_counter += 1
|
20
24
|
@action[:id] = @action_counter
|
21
|
-
@
|
22
|
-
|
23
|
-
|
25
|
+
if @result.exitcode < 0
|
26
|
+
@action[:check] = false
|
27
|
+
@action[:result] = @action[:output]
|
28
|
+
else
|
29
|
+
@action[:check] = cond
|
30
|
+
@action[:result] = (args[:value] || @result.value)
|
31
|
+
end
|
24
32
|
|
25
33
|
@action[:alterations] = @result.alterations
|
26
34
|
@action[:expected] = (args[:expected] || @result.expected)
|
@@ -41,22 +49,6 @@ module DSL
|
|
41
49
|
expect2 result.count.gt(0), args
|
42
50
|
end
|
43
51
|
|
44
|
-
def expect_exit(value)
|
45
|
-
@result.alterations = "Read exit code"
|
46
|
-
real_value = result.exitcode
|
47
|
-
cond = if value.is_a? Range
|
48
|
-
expect_value = "With range #{value}"
|
49
|
-
value.to_a.include? real_value
|
50
|
-
elsif value.is_a? Array
|
51
|
-
expect_value = "Inside list #{value}"
|
52
|
-
value.include? real_value
|
53
|
-
else
|
54
|
-
expect_value = value
|
55
|
-
(real_value == value.to_i)
|
56
|
-
end
|
57
|
-
expect2 cond, value: real_value, expected: expect_value
|
58
|
-
end
|
59
|
-
|
60
52
|
def expect_first(input, args = {})
|
61
53
|
@result.first
|
62
54
|
output = input
|
@@ -95,14 +87,9 @@ module DSL
|
|
95
87
|
expect2 result.count.eq(1), args
|
96
88
|
end
|
97
89
|
|
98
|
-
def
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
elsif value == :default
|
103
|
-
@action[:weight] = 1.0
|
104
|
-
else
|
105
|
-
@action[:weight] = value.to_f
|
106
|
-
end
|
90
|
+
def expect_sequence(&block)
|
91
|
+
seq = ExpectSequence.new(result.content.dup)
|
92
|
+
cond = seq.is_valid?(&block)
|
93
|
+
expect2 cond, value: seq.real, expected: seq.expected
|
107
94
|
end
|
108
95
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DSL
|
4
|
+
def expect_exit(value)
|
5
|
+
@result.alterations = "Read exit code"
|
6
|
+
real_value = result.exitcode
|
7
|
+
cond = if value.is_a? Range
|
8
|
+
expect_value = "With range #{value}"
|
9
|
+
value.to_a.include? real_value
|
10
|
+
elsif value.is_a? Array
|
11
|
+
expect_value = "Inside list #{value}"
|
12
|
+
value.include? real_value
|
13
|
+
else
|
14
|
+
expect_value = value
|
15
|
+
(real_value == value.to_i)
|
16
|
+
end
|
17
|
+
expect2 cond, value: real_value, expected: expect_value
|
18
|
+
end
|
19
|
+
|
20
|
+
def expect_fail
|
21
|
+
@result.alterations = "Read exit code"
|
22
|
+
real_value = result.exitcode
|
23
|
+
expect_value = "Greater than 0"
|
24
|
+
cond = (real_value > 0)
|
25
|
+
expect2 cond, value: real_value, expected: expect_value
|
26
|
+
end
|
27
|
+
|
28
|
+
def expect_ok
|
29
|
+
expect_exit 0
|
30
|
+
end
|
31
|
+
end
|