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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +65 -18
  3. data/docs/commands/README.md +18 -81
  4. data/docs/commands/check.md +66 -0
  5. data/docs/commands/config.md +120 -0
  6. data/docs/commands/help.md +37 -0
  7. data/docs/commands/new.md +34 -0
  8. data/docs/commands/readme.md +52 -0
  9. data/docs/commands/{run-tests.md → run.md} +1 -1
  10. data/docs/config_file.md +125 -0
  11. data/docs/devel/README.md +12 -0
  12. data/docs/dsl/expect.md +2 -2
  13. data/docs/dsl/run.md +30 -67
  14. data/docs/install/s-node.md +9 -7
  15. data/docs/install/t-node.md +18 -19
  16. data/docs/learn/11-export.md +1 -1
  17. data/docs/learn/13-feedback.md +1 -1
  18. data/docs/learn/14-moodle_id.md +4 -4
  19. data/docs/learn/15-readme.md +14 -8
  20. data/docs/learn/16-include.md +21 -16
  21. data/docs/learn/17-alias.md +2 -2
  22. data/docs/learn/18-log.md +5 -3
  23. data/docs/learn/19-read_vars.md +7 -3
  24. data/docs/learn/20-macros.md +6 -4
  25. data/docs/learn/21-exit_codes.md +3 -3
  26. data/docs/learn/22-result.md +7 -3
  27. data/docs/learn/23-test-code.md +17 -7
  28. data/docs/learn/24-test-sql.md +19 -18
  29. data/docs/learn/25-expect-result.md +1 -0
  30. data/docs/learn/26-expect_sequence.md +12 -7
  31. data/docs/learn/27-run_script.md +11 -5
  32. data/docs/tutorial/es/nginx/README.md +546 -0
  33. data/lib/teuton/case/case.rb +0 -2
  34. data/lib/teuton/case/dsl/expect.rb +2 -2
  35. data/lib/teuton/case/dsl/log.rb +1 -1
  36. data/lib/teuton/case/dsl/run.rb +2 -3
  37. data/lib/teuton/case/dsl/upload.rb +1 -1
  38. data/lib/teuton/case/execute/execute_base.rb +3 -6
  39. data/lib/teuton/case/execute/execute_local.rb +5 -2
  40. data/lib/teuton/case/execute/execute_ssh.rb +0 -1
  41. data/lib/teuton/case/execute/execute_telnet.rb +0 -2
  42. data/lib/teuton/case/play.rb +2 -2
  43. data/lib/teuton/case/result/result.rb +1 -3
  44. data/lib/teuton/case_manager/case_manager.rb +14 -17
  45. data/lib/teuton/case_manager/dsl.rb +4 -4
  46. data/lib/teuton/case_manager/export_manager.rb +22 -17
  47. data/lib/teuton/case_manager/{check_cases.rb → ext/check_cases.rb} +7 -6
  48. data/lib/teuton/case_manager/ext/hall_of_fame.rb +28 -0
  49. data/lib/teuton/case_manager/{report.rb → ext/report.rb} +6 -8
  50. data/lib/teuton/case_manager/send_manager.rb +1 -0
  51. data/lib/teuton/case_manager/{show_report.rb → show_resume_report.rb} +12 -26
  52. data/lib/teuton/case_manager/stats_manager.rb +26 -0
  53. data/lib/teuton/check/checker.rb +16 -8
  54. data/lib/teuton/check/main.rb +2 -2
  55. data/lib/teuton/check/show.rb +3 -3
  56. data/lib/teuton/cli.rb +3 -2
  57. data/lib/teuton/readme/dsl/getset.rb +1 -0
  58. data/lib/teuton/readme/main.rb +2 -2
  59. data/lib/teuton/readme/readme.rb +2 -2
  60. data/lib/teuton/report/formatter/default/array.rb +1 -3
  61. data/lib/teuton/report/formatter/default/markdown.rb +1 -1
  62. data/lib/teuton/report/formatter/default/txt.rb +1 -1
  63. data/lib/teuton/report/formatter/default/xml.rb +93 -29
  64. data/lib/teuton/report/formatter/formatter.rb +2 -1
  65. data/lib/teuton/report/formatter/resume/array.rb +1 -3
  66. data/lib/teuton/report/formatter/resume/txt.rb +6 -2
  67. data/lib/teuton/report/formatter/resume/xml.rb +92 -0
  68. data/lib/teuton/report/report.rb +1 -1
  69. data/lib/teuton/utils/config_file_reader.rb +141 -0
  70. data/lib/teuton/utils/name_file_finder.rb +12 -15
  71. data/lib/teuton/utils/project.rb +19 -21
  72. data/lib/teuton/utils/settings.rb +3 -1
  73. data/lib/teuton/version.rb +1 -1
  74. data/lib/teuton.rb +11 -10
  75. metadata +35 -30
  76. data/docs/commands/check-example.md +0 -53
  77. data/docs/es/aprender/01-cmd_new.md +0 -27
  78. data/docs/es/aprender/02-target.md +0 -131
  79. data/docs/es/aprender/README.md +0 -36
  80. data/docs/ideas/todo.md +0 -44
  81. data/docs/install/README.md +0 -38
  82. data/lib/teuton/case_manager/hall_of_fame.rb +0 -29
  83. data/lib/teuton/files/README.md +0 -9
  84. data/lib/teuton/utils/configfile_reader.rb +0 -135
  85. /data/docs/{ideas → devel}/contributions.md +0 -0
  86. /data/docs/{ideas → es}/Challenge-Server-Project.md +0 -0
  87. /data/docs/{ideas → es}/servidor-de-retos.md +0 -0
  88. /data/docs/{install/modes_of_use.md → modes_of_use.md} +0 -0
  89. /data/lib/teuton/{case_manager → deprecated}/utils.rb +0 -0
@@ -4,10 +4,20 @@
4
4
 
5
5
  Let's test code using teuton.
6
6
 
7
- **Example:**
7
+ ## Exercise
8
8
 
9
- * Ask students to make a program that performs addition and multiplication.
10
- * Define targets `sum` and `mul`:
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
- * Define config params:
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: math_2b.py
49
+ filename: math_2.py
40
50
  ```
41
51
 
42
- * Put students files into `code` folder.
52
+ * Copy students files into `code` subfolder.
43
53
  * Now run Teuton test:
44
54
 
45
55
  ```
46
- teuton examples/23-test-code
56
+ $ teuton examples/23-test-code
47
57
 
48
58
  CASE RESULTS
49
59
  +------+-----------+-------+-------+
@@ -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
- **Exercise**
5
+ ## Exercise
6
6
 
7
- * Ask students to make a Sqlite Database. Create a table called `characters` with `name` varchar, and `rol` varchar.
8
- * Database example:
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
- sqlite3 examples/24-test-sql/database_01.db
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
- * Query example:
21
+ * Ask students to create SQL queries inside a file. For example: select all Jedi characters.
21
22
 
22
23
  ```
23
- cat examples/24-test-sql/query_01.sql
24
+ $ cat examples/24-test-sql/query_01.sql
24
25
 
25
26
  select * from characters where rol='Jedi';
26
27
  ```
27
28
 
28
- **Teuton test**
29
+ ## Teuton test
29
30
 
30
- * Define targets:
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
- * Configure params:
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: student_1_name
55
+ - tt_members: student_1
55
56
  database: database_01.db
56
57
  query: query_01.sql
57
58
  ```
58
59
 
59
- **Test output**
60
+ ## Run test
60
61
 
61
62
  ```
62
- teuton examples/24-test-sql
63
+ $ teuton examples/24-test-sql
63
64
 
64
65
  CASE RESULTS
65
- +------+----------------+-------+-------+
66
- | CASE | MEMBERS | GRADE | STATE |
67
- | 01 | student_1_name | 100.0 | ✔ |
68
- +------+----------------+-------+-------+
66
+ +------+-----------+-------+-------+
67
+ | CASE | MEMBERS | GRADE | STATE |
68
+ | 01 | student_1 | 100.0 | ✔ |
69
+ +------+-----------+-------+-------+
69
70
  ```
@@ -21,6 +21,7 @@
21
21
  | expect_exit NUMBER | Exit code is NUMBER |
22
22
  | expect_ok | Exit code 0 |
23
23
  | expect_fail | Exit code > 0 |
24
+ | expect_sequence | Validates sequences |
24
25
 
25
26
  > Learn more about [expect](../dsl/expect.md)
26
27
 
@@ -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 will use the new "expect_sequence" instruction.
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
- ## Evaluating different sequences
43
+ ### Simple sequence
43
44
 
44
- * **Simple sequence**. Validate sequences where the elements are in order. Use `find` statement to find each element of the sequence.
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
- * **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
+ ### 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
- * **Strict sequence with jumps**. Use `ignore N` to indicate that there are N lines between 2 elements of the sequence.
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.
@@ -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 scripts
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 examples
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
- **Compact invocation**: The "command" to execute contains the interpreter, the script, and the arguments.
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
- **Separate components**: pass the name of the script, the interpreter in charge of processing it and its arguments through separate parameters.
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 2: Upload script and execute on remote host"
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
  ```