teuton 2.10.8 → 2.11.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 +65 -18
- data/docs/commands/README.md +18 -81
- data/docs/commands/check.md +66 -0
- data/docs/commands/config.md +120 -0
- data/docs/commands/help.md +37 -0
- data/docs/commands/new.md +34 -0
- data/docs/commands/readme.md +52 -0
- data/docs/commands/{run-tests.md → run.md} +1 -1
- data/docs/config_file.md +125 -0
- data/docs/devel/README.md +12 -0
- data/docs/dsl/expect.md +2 -2
- data/docs/dsl/run.md +30 -67
- data/docs/install/s-node.md +9 -7
- data/docs/install/t-node.md +18 -19
- data/docs/learn/11-export.md +1 -1
- data/docs/learn/13-feedback.md +1 -1
- data/docs/learn/14-moodle_id.md +4 -4
- data/docs/learn/15-readme.md +14 -8
- data/docs/learn/16-include.md +21 -16
- data/docs/learn/17-alias.md +2 -2
- data/docs/learn/18-log.md +5 -3
- data/docs/learn/19-read_vars.md +7 -3
- data/docs/learn/20-macros.md +6 -4
- data/docs/learn/21-exit_codes.md +3 -3
- data/docs/learn/22-result.md +7 -3
- data/docs/learn/23-test-code.md +17 -7
- data/docs/learn/24-test-sql.md +19 -18
- data/docs/learn/25-expect-result.md +1 -0
- data/docs/learn/26-expect_sequence.md +12 -7
- data/docs/learn/27-run_script.md +11 -5
- data/docs/tutorial/es/nginx/README.md +546 -0
- data/lib/teuton/case/case.rb +0 -2
- data/lib/teuton/case/dsl/expect.rb +2 -2
- data/lib/teuton/case/dsl/log.rb +1 -1
- data/lib/teuton/case/dsl/run.rb +2 -3
- data/lib/teuton/case/dsl/upload.rb +1 -1
- data/lib/teuton/case/execute/execute_base.rb +3 -6
- data/lib/teuton/case/execute/execute_local.rb +5 -2
- data/lib/teuton/case/execute/execute_ssh.rb +0 -1
- data/lib/teuton/case/execute/execute_telnet.rb +0 -2
- data/lib/teuton/case/play.rb +2 -2
- data/lib/teuton/case/result/result.rb +1 -3
- data/lib/teuton/case_manager/case_manager.rb +14 -17
- data/lib/teuton/case_manager/dsl.rb +4 -4
- data/lib/teuton/case_manager/export_manager.rb +22 -17
- data/lib/teuton/case_manager/{check_cases.rb → ext/check_cases.rb} +7 -6
- data/lib/teuton/case_manager/ext/hall_of_fame.rb +28 -0
- data/lib/teuton/case_manager/{report.rb → ext/report.rb} +6 -8
- data/lib/teuton/case_manager/send_manager.rb +1 -0
- data/lib/teuton/case_manager/{show_report.rb → show_resume_report.rb} +12 -26
- data/lib/teuton/case_manager/stats_manager.rb +26 -0
- data/lib/teuton/check/checker.rb +16 -8
- data/lib/teuton/check/main.rb +2 -2
- data/lib/teuton/check/show.rb +3 -3
- data/lib/teuton/cli.rb +3 -2
- data/lib/teuton/readme/dsl/getset.rb +1 -0
- data/lib/teuton/readme/main.rb +2 -2
- data/lib/teuton/readme/readme.rb +2 -2
- data/lib/teuton/report/formatter/default/array.rb +1 -3
- data/lib/teuton/report/formatter/default/markdown.rb +1 -1
- data/lib/teuton/report/formatter/default/txt.rb +1 -1
- data/lib/teuton/report/formatter/default/xml.rb +93 -29
- data/lib/teuton/report/formatter/formatter.rb +2 -1
- data/lib/teuton/report/formatter/resume/array.rb +1 -3
- data/lib/teuton/report/formatter/resume/txt.rb +6 -2
- data/lib/teuton/report/formatter/resume/xml.rb +92 -0
- data/lib/teuton/report/report.rb +1 -1
- data/lib/teuton/utils/config_file_reader.rb +141 -0
- data/lib/teuton/utils/name_file_finder.rb +12 -15
- data/lib/teuton/utils/project.rb +19 -21
- data/lib/teuton/utils/settings.rb +3 -1
- data/lib/teuton/version.rb +1 -1
- data/lib/teuton.rb +11 -10
- metadata +35 -30
- data/docs/commands/check-example.md +0 -53
- data/docs/es/aprender/01-cmd_new.md +0 -27
- data/docs/es/aprender/02-target.md +0 -131
- data/docs/es/aprender/README.md +0 -36
- data/docs/ideas/todo.md +0 -44
- data/docs/install/README.md +0 -38
- data/lib/teuton/case_manager/hall_of_fame.rb +0 -29
- data/lib/teuton/files/README.md +0 -9
- data/lib/teuton/utils/configfile_reader.rb +0 -135
- /data/docs/{ideas → devel}/contributions.md +0 -0
- /data/docs/{ideas → es}/Challenge-Server-Project.md +0 -0
- /data/docs/{ideas → es}/servidor-de-retos.md +0 -0
- /data/docs/{install/modes_of_use.md → modes_of_use.md} +0 -0
- /data/lib/teuton/{case_manager → deprecated}/utils.rb +0 -0
data/docs/learn/23-test-code.md
CHANGED
|
@@ -4,10 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
Let's test code using teuton.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Exercise
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
Ask students to make a program that performs addition and multiplication.
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
```
|
|
13
|
+
$ examples/23-test-code/code/math_1.py 3 4
|
|
14
|
+
Sum = 7
|
|
15
|
+
Mul = 12
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
Define targets `sum` and `mul`:
|
|
11
21
|
|
|
12
22
|
```ruby
|
|
13
23
|
# File: start.rb
|
|
@@ -25,7 +35,7 @@ group "Test code example" do
|
|
|
25
35
|
end
|
|
26
36
|
```
|
|
27
37
|
|
|
28
|
-
|
|
38
|
+
Define config params:
|
|
29
39
|
|
|
30
40
|
```yaml
|
|
31
41
|
# File: config.yaml
|
|
@@ -36,14 +46,14 @@ cases:
|
|
|
36
46
|
- tt_members: student_1
|
|
37
47
|
filename: math_1.py
|
|
38
48
|
- tt_members: student_2
|
|
39
|
-
filename:
|
|
49
|
+
filename: math_2.py
|
|
40
50
|
```
|
|
41
51
|
|
|
42
|
-
*
|
|
52
|
+
* Copy students files into `code` subfolder.
|
|
43
53
|
* Now run Teuton test:
|
|
44
54
|
|
|
45
55
|
```
|
|
46
|
-
|
|
56
|
+
$ teuton examples/23-test-code
|
|
47
57
|
|
|
48
58
|
CASE RESULTS
|
|
49
59
|
+------+-----------+-------+-------+
|
data/docs/learn/24-test-sql.md
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
[<<back](README.md)
|
|
2
2
|
|
|
3
|
-
# Test SQL and database
|
|
3
|
+
# Test SQL and database content
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Exercise
|
|
6
6
|
|
|
7
|
-
* Ask students to make a Sqlite Database.
|
|
8
|
-
*
|
|
7
|
+
* Ask students to make a Sqlite Database.
|
|
8
|
+
* Create a table called `characters` with `name` varchar, and `rol` varchar.
|
|
9
9
|
|
|
10
|
+
Database example:
|
|
10
11
|
```
|
|
11
|
-
|
|
12
|
+
$ sqlite3 examples/24-test-sql/database_01.db
|
|
12
13
|
|
|
13
14
|
sqlite> .schema characters
|
|
14
15
|
CREATE TABLE characters ( name varchar(255), rol varchar(255));
|
|
@@ -17,20 +18,20 @@ sqlite> select * from characters;
|
|
|
17
18
|
Obiwan|Jedi
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
*
|
|
21
|
+
* Ask students to create SQL queries inside a file. For example: select all Jedi characters.
|
|
21
22
|
|
|
22
23
|
```
|
|
23
|
-
|
|
24
|
+
$ cat examples/24-test-sql/query_01.sql
|
|
24
25
|
|
|
25
26
|
select * from characters where rol='Jedi';
|
|
26
27
|
```
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
## Teuton test
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
Define targets (start.rb file):
|
|
31
32
|
|
|
32
33
|
```ruby
|
|
33
|
-
group "Test SQL and database" do
|
|
34
|
+
group "Test SQL and database content" do
|
|
34
35
|
database = "#{get(:folder)}/#{get(:database)}"
|
|
35
36
|
query = "#{get(:folder)}/#{get(:query)}"
|
|
36
37
|
|
|
@@ -44,26 +45,26 @@ group "Test SQL and database" do
|
|
|
44
45
|
end
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
Configure params (config.yaml file):
|
|
48
49
|
|
|
49
50
|
```yaml
|
|
50
51
|
---
|
|
51
52
|
global:
|
|
52
53
|
folder: examples/24-test-sql
|
|
53
54
|
cases:
|
|
54
|
-
- tt_members:
|
|
55
|
+
- tt_members: student_1
|
|
55
56
|
database: database_01.db
|
|
56
57
|
query: query_01.sql
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
## Run test
|
|
60
61
|
|
|
61
62
|
```
|
|
62
|
-
|
|
63
|
+
$ teuton examples/24-test-sql
|
|
63
64
|
|
|
64
65
|
CASE RESULTS
|
|
65
|
-
|
|
66
|
-
| CASE | MEMBERS
|
|
67
|
-
| 01 |
|
|
68
|
-
|
|
66
|
+
+------+-----------+-------+-------+
|
|
67
|
+
| CASE | MEMBERS | GRADE | STATE |
|
|
68
|
+
| 01 | student_1 | 100.0 | ✔ |
|
|
69
|
+
+------+-----------+-------+-------+
|
|
69
70
|
```
|
|
@@ -23,8 +23,7 @@ expect /a.*?b.*?c/
|
|
|
23
23
|
|
|
24
24
|
> Regular expressions are very powerful but they are also complex to use.
|
|
25
25
|
|
|
26
|
-
To evaluate the occurrence of a certain sequence that takes place in different lines of the output we
|
|
27
|
-
|
|
26
|
+
To evaluate the occurrence of a certain sequence that takes place in different lines of the output we use the "expect_sequence" instruction.
|
|
28
27
|
|
|
29
28
|
```ruby
|
|
30
29
|
# Example:
|
|
@@ -37,11 +36,13 @@ expect_sequence do
|
|
|
37
36
|
end
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
> NOTE: expect_sequence can be useful for evaluating iptables firewall configurations where permission assignment order is relevant.
|
|
39
|
+
> NOTE: `expect_sequence` can be useful for evaluating iptables firewall configurations where permission assignment order is relevant.
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
### Simple sequence
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
Validate sequences where the elements are in order. Use `find` statement to find each element of the sequence.
|
|
45
46
|
|
|
46
47
|
```ruby
|
|
47
48
|
# Examples: [A,B,C], [A,s,B,s,C], [x,A,B,s,C,x], etc.
|
|
@@ -53,7 +54,9 @@ expect_sequence do
|
|
|
53
54
|
end
|
|
54
55
|
```
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
### Strict sequence
|
|
58
|
+
|
|
59
|
+
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
60
|
|
|
58
61
|
```ruby
|
|
59
62
|
# Examples: [A,B,C], [x,A,B,C,x], etc.
|
|
@@ -65,7 +68,9 @@ expect_sequence do
|
|
|
65
68
|
end
|
|
66
69
|
```
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
### Strict sequence with jumps
|
|
72
|
+
|
|
73
|
+
Use `ignore N` to indicate that there are N lines between 2 elements of the sequence.
|
|
69
74
|
|
|
70
75
|
```ruby
|
|
71
76
|
# Examples: [A,B,s,s,C], [x,A,B,s,s,C,x], etc.
|
data/docs/learn/27-run_script.md
CHANGED
|
@@ -11,7 +11,7 @@ You know the classic sequence `target/run/expect`, but sometimes you need to run
|
|
|
11
11
|
|
|
12
12
|
> Example files at [examples/27-run_file](../../examples/27-run_script)
|
|
13
13
|
|
|
14
|
-
## Example
|
|
14
|
+
## Example files
|
|
15
15
|
|
|
16
16
|
Suppose we have the following files:
|
|
17
17
|
```
|
|
@@ -29,11 +29,13 @@ echo $MESSAGE
|
|
|
29
29
|
exit 0
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
## Usage
|
|
32
|
+
## Usage
|
|
33
33
|
|
|
34
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
35
|
|
|
36
|
-
|
|
36
|
+
### Compact invocation
|
|
37
|
+
|
|
38
|
+
The "command" string executed contains the interpreter, the script, and the arguments. Example: `"bash show.sh Hello"`.
|
|
37
39
|
|
|
38
40
|
```ruby
|
|
39
41
|
target "Mode 1: Upload script and execute on remote host"
|
|
@@ -41,7 +43,9 @@ run_script "bash show.sh Hello", on: :host1
|
|
|
41
43
|
expect "Hello"
|
|
42
44
|
```
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
### Separate components
|
|
47
|
+
|
|
48
|
+
Pass the script name, interpreter, and its arguments using separate parameters.
|
|
45
49
|
|
|
46
50
|
```ruby
|
|
47
51
|
target "Mode 2: Upload script and execute on remote host"
|
|
@@ -49,12 +53,14 @@ run_script "show.sh", shell: "bash", args: "Hello", on: :host1
|
|
|
49
53
|
expect "Hello"
|
|
50
54
|
```
|
|
51
55
|
|
|
56
|
+
### Separate components and defaut shell
|
|
57
|
+
|
|
52
58
|
Or setting shell default value:
|
|
53
59
|
|
|
54
60
|
```ruby
|
|
55
61
|
set(:shell, "bash")
|
|
56
62
|
|
|
57
|
-
target "Mode
|
|
63
|
+
target "Mode 3: Upload script and execute on remote host"
|
|
58
64
|
run_script "show.sh", args: "Hello", on: :host1
|
|
59
65
|
expect "Hello"
|
|
60
66
|
```
|