teuton 2.4.0 → 2.4.2

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -6
  3. data/docs/changelog/todo.md +10 -1
  4. data/docs/changelog/v2.4.md +5 -1
  5. data/docs/commands/README.md +8 -17
  6. data/docs/commands/example_check.md +4 -4
  7. data/docs/commands/example_run.md +10 -32
  8. data/docs/dsl/README.md +27 -39
  9. data/docs/dsl/{definition/expect.md → expect.md} +2 -18
  10. data/docs/dsl/{execution/export.md → export.md} +4 -8
  11. data/docs/dsl/{setting/get.md → get.md} +4 -10
  12. data/docs/dsl/{definition/group.md → group.md} +2 -7
  13. data/docs/dsl/{execution/play.md → play.md} +1 -6
  14. data/docs/dsl/{definition/result.md → result.md} +1 -6
  15. data/docs/dsl/{definition/run_remote.md → run.md} +57 -23
  16. data/docs/dsl/{execution/send.md → send.md} +1 -8
  17. data/docs/dsl/{setting/set.md → set.md} +1 -7
  18. data/docs/dsl/{execution/show.md → show.md} +7 -16
  19. data/docs/dsl/target.md +33 -0
  20. data/docs/ideas/todo.md +35 -115
  21. data/docs/install/README.md +26 -42
  22. data/docs/install/s-node.md +35 -0
  23. data/docs/install/t-node.md +76 -0
  24. data/docs/learn/01-cmd_new.md +28 -0
  25. data/docs/learn/{01-target.md → 02-target.md} +21 -28
  26. data/docs/learn/03-remote_hosts.md +59 -87
  27. data/docs/learn/04-config.md +147 -0
  28. data/docs/learn/05-use.md +25 -45
  29. data/docs/learn/06-cmd_check.md +50 -0
  30. data/docs/learn/07-target_weight.md +44 -0
  31. data/docs/learn/08-unique_values.md +70 -0
  32. data/docs/learn/09-send.md +20 -0
  33. data/docs/learn/10-debug.md +45 -0
  34. data/docs/learn/11-export.md +35 -0
  35. data/docs/learn/{09-preserve.md → 12-preserve.md} +1 -1
  36. data/docs/learn/13-feedback.md +49 -0
  37. data/docs/learn/14-moodle_id.md +24 -0
  38. data/docs/learn/{08-readme.md → 15-readme.md} +5 -9
  39. data/docs/learn/{13-include.md → 16-include.md} +1 -3
  40. data/docs/learn/{14-alias.md → 17-alias.md} +0 -0
  41. data/docs/learn/{07-log.md → 18-log.md} +19 -23
  42. data/docs/learn/{12-get_vars.md → 19-read_vars.md} +3 -3
  43. data/docs/learn/20-macros.md +49 -0
  44. data/docs/learn/{16-exit_codes.md → 21-exit_codes.md} +0 -0
  45. data/docs/learn/{10-result.md → 22-result.md} +3 -3
  46. data/docs/learn/23-test-code.md +54 -0
  47. data/docs/learn/24-test-sql.md +69 -0
  48. data/docs/learn/README.md +31 -32
  49. data/lib/teuton/application.rb +2 -5
  50. data/lib/teuton/case_manager/case/case.rb +2 -1
  51. data/lib/teuton/case_manager/case/dsl/expect.rb +3 -1
  52. data/lib/teuton/case_manager/case/dsl/goto.rb +1 -1
  53. data/lib/teuton/case_manager/case/dsl/log.rb +5 -3
  54. data/lib/teuton/case_manager/case/dsl/send.rb +2 -2
  55. data/lib/teuton/case_manager/case/dsl/target.rb +1 -1
  56. data/lib/teuton/case_manager/case/result/ext_compare.rb +20 -21
  57. data/lib/teuton/case_manager/case/result/ext_filter.rb +15 -8
  58. data/lib/teuton/case_manager/case_manager.rb +10 -8
  59. data/lib/teuton/check/show.rb +1 -1
  60. data/lib/teuton/files/config.yaml +1 -2
  61. data/lib/teuton/files/start.rb +4 -4
  62. data/lib/teuton/readme/dsl.rb +9 -1
  63. data/lib/teuton/readme/readme.rb +8 -1
  64. data/lib/teuton/report/formatter/base_formatter.rb +2 -0
  65. data/lib/teuton/report/formatter/formatter.rb +1 -0
  66. data/lib/teuton/report/show.rb +8 -0
  67. data/lib/teuton/version.rb +1 -1
  68. data/lib/teuton.rb +2 -1
  69. metadata +72 -54
  70. data/docs/dsl/definition/run_local.md +0 -33
  71. data/docs/dsl/definition/target.md +0 -40
  72. data/docs/install/scripts.md +0 -96
  73. data/docs/learn/02-config.md +0 -121
  74. data/docs/learn/04-new_test.md +0 -87
  75. data/docs/learn/06-debug.md +0 -110
  76. data/docs/learn/11-moodle_id.md +0 -19
@@ -0,0 +1,35 @@
1
+ [<< back](README.md)
2
+
3
+ # Export
4
+
5
+ * [export](../dsl/export.md) keyword generate reports into diferents formats:
6
+
7
+ Example
8
+ ```ruby
9
+ play do
10
+ show
11
+ export format: :txt
12
+ export format: :html
13
+ export format: :json
14
+ end
15
+ ```
16
+
17
+ * `show`, show process on screen.
18
+ * `export format: :txt`, create reports with `txt` format.
19
+ * `export format: :html`, create reports with `html` format.
20
+ * `export format: :json`, create reports with `json` format.
21
+
22
+ Firs run `teuton examples/11-export`, then we have:
23
+
24
+ ```
25
+ ❯ tree var/11-export
26
+
27
+ var/11-export
28
+ ├── case-01.html
29
+ ├── case-01.json
30
+ ├── case-01.txt
31
+ ├── moodle.csv
32
+ ├── resume.html
33
+ ├── resume.json
34
+ └── resume.txt
35
+ ```
@@ -23,7 +23,7 @@ end
23
23
 
24
24
  ## Result
25
25
 
26
- Example, executing `teuton run example/learn-09-preserve` twice:
26
+ Example, executing `teuton run example/09-preserve` twice:
27
27
 
28
28
  ```
29
29
  var
@@ -0,0 +1,49 @@
1
+ [<< back](README.md)
2
+
3
+ # Feedback
4
+
5
+ Exporting with false feedback option `export feedback: false`, hide some items from output reports. Hiden items: command, alterations, expected and result.
6
+
7
+ > More information about [export](../dsl/execution/export.md) keyword.
8
+
9
+ Example
10
+
11
+ ```ruby
12
+ play do
13
+ show
14
+ export feedback: false
15
+ export format: "html", feedback: false
16
+ end
17
+ ```
18
+
19
+ ## Description
20
+
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
+
23
+ Each "target" contains the following fields:
24
+
25
+ * Identification: id, description
26
+ * Evaluation result: check(true/false)
27
+ * Punctuation: score, weight
28
+ * Check process: conn_type, command, duration, alterations, expected, result
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 "feedback: false" parameter.
31
+
32
+ With "feedback: false" the fields are hidden: command, alterations, expected and result.
33
+
34
+
35
+ ## Results
36
+
37
+ Executing `teuton run examples/13-feedback`, we get this output:
38
+
39
+ ```
40
+ GROUPS
41
+ - Preserve output reports
42
+ 01 (1.0/1.0)
43
+ Description : Exits user david
44
+ Command : ********
45
+ Duration : 0.002 (local)
46
+ Alterations : *******************
47
+ Expected : ************** (String)
48
+ Result : ******** (String)
49
+ ```
@@ -0,0 +1,24 @@
1
+ [<< back](README.md)
2
+
3
+ # Moodle
4
+
5
+ As a teacher, probably you are using Moodle platform. So, you want to upload the results of the evaluation carried out by Teuton into Moodle.
6
+
7
+ Teuton generates a file called `moodle.csv` with the grades of each student into CSV format. This file is suitable to import into Moodle platform.
8
+
9
+ ## tt_moodle_id
10
+
11
+ Add a new field called `tt_moodle_id` to each case in "config.yaml". Fill it with the student's identification (For example, the email registered on the Moodle, or ID number, etc.).
12
+
13
+ Example:
14
+
15
+ ```
16
+ global:
17
+ cases:
18
+ - tt_members: Darth Vader
19
+ tt_moodle_id: vader@starwars.com
20
+ - tt_members: Obiwan Kenobi
21
+ tt_moodle_id: obiwan@starwars.com
22
+ ```
23
+
24
+ Now, when running test "moodle.csv" will be generated with all student grades.
@@ -4,10 +4,6 @@
4
4
 
5
5
  Create README files (with test instructions) from our test definition.
6
6
 
7
- 1. [Definition section](#definition-section)
8
- 2. [Execute command](#execute-command)
9
- 3. [Result](#result)
10
-
11
7
  ## Definition section
12
8
 
13
9
  Take a look at our test definition section (Group):
@@ -35,23 +31,23 @@ There exists some `readme` instructions after `group` and `target` lines.
35
31
  To generate automatically a README file from previous test, execute this:
36
32
 
37
33
  ```
38
- teuton readme example/08-readme > example/08-readme/README.md
34
+ teuton readme example/15-readme > example/15-readme/README.md
39
35
  ```
40
36
 
41
37
  ## Result
42
38
 
43
- **Let's see the output**: Content of `example/08-readme/README.md` file.
39
+ **Let's see the output**: Content of `example/15-readme/README.md` file.
44
40
 
45
41
  ---
46
- # 08-readme
42
+
43
+ # 15-readme
47
44
 
48
45
  ## Customize readme output
49
46
 
50
- This is our README example.
47
+ This is our readme example.
51
48
  And here we'll see how to use readme keyword
52
49
 
53
50
  Go to [LOCALHOST](#required-hosts) host, and do next:
54
51
  * Create user david.
55
52
  * Help: you can use 'useradd' command to create users.
56
53
  * Remember: Only root is permitted to create new users.
57
- ---
@@ -1,11 +1,9 @@
1
1
  [<< back](README.md)
2
2
 
3
- # Example: 13-include
3
+ # include
4
4
 
5
5
  Use `tt-include` to include several config files into your main config file.
6
6
 
7
- ## Explanation
8
-
9
7
  Until now, all the examples we have seen use one configuration file (`config.yaml`) that contain all the parameters required by the test. It is possible to save configuration distributed among several files.
10
8
 
11
9
  Suppose we have the following file structure.
File without changes
@@ -1,33 +1,27 @@
1
1
  [<< back](README.md)
2
2
 
3
- # Example: 07-log
3
+ # 18-log
4
4
 
5
- Let's learn how to create log messages.
5
+ * `log TEXT`, save TEXT into output report.
6
6
 
7
- 1. [Definition section](#definition-section)
8
- 2. [Run test](#execution-section)
9
- 3. [Result](#result)
7
+ Example
10
8
 
11
- ## Definition section
12
-
13
- Test definition section (Group):
14
9
  ```ruby
15
10
  group "Learning about log messages" do
16
- log 'Using log messages...'
11
+ log "Using log messages."
17
12
 
18
13
  target "Create user david"
19
- run "id david"
14
+ run "id david"
15
+ log result.value
20
16
  expect "david"
21
17
 
22
- log 'Problem detected!', :error
18
+ log "Problem detected!", :error
19
+ log "This is a warning", :warn
20
+ log "Hi, there!", :info
23
21
  end
24
22
  ```
25
23
 
26
- > In this example, localhost's OS must be GNU/Linux (any other compatible OS) because the command used is `id david`.
27
-
28
- ## Result
29
-
30
- **Let's see example**: Content of `var/07-log/case-01.txt` file.
24
+ Content of `var/18-log/case-01.txt` file.
31
25
 
32
26
  ```
33
27
  CONFIGURATION
@@ -35,12 +29,15 @@ CONFIGURATION
35
29
  | tt_members | anonymous |
36
30
  | tt_sequence | false |
37
31
  | tt_skip | false |
38
- | tt_testname | 07-log |
32
+ | tt_testname | 18-log |
39
33
  +-------------+-----------+
40
34
 
41
35
  LOGS
42
- [13:45:02] : Using log messages...
43
- [13:45:02] ERROR: Problem detected!
36
+ [09:14:22] INFO: Using log messages.
37
+ [09:14:22] INFO: uid=1000(david) gid=1000(david) grupos=495(cdrom),493(disk),487(video),474(wheel),464(wireshark),459(docker),456(vboxusers),1000(david)
38
+ [09:14:22] ERROR: Problem detected!
39
+ [09:14:22] WARN!: This is a warning
40
+ [09:14:22] INFO: Hi, there!
44
41
 
45
42
  GROUPS
46
43
  - Learning about log messages
@@ -55,9 +52,9 @@ GROUPS
55
52
  RESULTS
56
53
  +--------------+---------------------------+
57
54
  | case_id | 01 |
58
- | start_time | 2022-12-24 13:45:02 +0000 |
59
- | finish_time | 2022-12-24 13:45:02 +0000 |
60
- | duration | 0.001900685 |
55
+ | start_time | 2023-01-26 09:14:22 +0000 |
56
+ | finish_time | 2023-01-26 09:14:22 +0000 |
57
+ | duration | 0.002012326 |
61
58
  | unique_fault | 0 |
62
59
  | max_weight | 1.0 |
63
60
  | good_weight | 1.0 |
@@ -65,4 +62,3 @@ RESULTS
65
62
  | fail_counter | 0 |
66
63
  | grade | 100 |
67
64
  +--------------+---------------------------+
68
- ```
@@ -1,10 +1,10 @@
1
1
  [<< back](README.md)
2
2
 
3
- # Example: 12-get_vars
3
+ # Read vars
4
4
 
5
- To read the variables from the configuration file we already have the `get` statement. Example, to read `dirname` we do `get(:dirname)`.
5
+ To get paramm values from the configuration file we already have the `get` statement. Example, to read `dirname` we do `get(:dirname)`.
6
6
 
7
- **Example 1:** Using `get` to read vars.
7
+ **Example 1:** Using `get` to get values.
8
8
 
9
9
  ```ruby
10
10
  # "get(:dirname)" reads dirname var from config file
@@ -0,0 +1,49 @@
1
+ [<< back](README.md)
2
+
3
+ # Macros
4
+
5
+ Macros is a technique to make it easier to write and reuse code.
6
+
7
+ **Example**
8
+
9
+ * We start from a set of repeated targets.
10
+
11
+ ```ruby
12
+ target "Exist user fran"
13
+ run "id fran"
14
+ expect_one "root"
15
+
16
+ target "Exist user root"
17
+ run "id root"
18
+ expect_one "root"
19
+
20
+ target "Exist user david"
21
+ run "id david"
22
+ expect_one "david"
23
+ ```
24
+
25
+ * Define a macro with the repeated block:
26
+
27
+ ```ruby
28
+ define_macro "user_exists", :name do
29
+ target "Exist user #{get(:name)}"
30
+ run "id #{get(:name)}"
31
+ expect_one get(:name)
32
+ end
33
+ ```
34
+
35
+ * Replace the previous targets with macro calls. There are 3 ways to invoke the macro:
36
+
37
+ ```ruby
38
+ user_exists(name: "fran")
39
+ user_exists(name: "root")
40
+ user_exists(name: "david")
41
+ ```
42
+
43
+ **Notice**: There are 3 ways to invoke the macro:
44
+
45
+ ```ruby
46
+ user_exists(name: "fran")
47
+ macro "user_exists", name: "fran"
48
+ macro_user_exists(name: "fran")
49
+ ```
File without changes
@@ -1,6 +1,6 @@
1
1
  [<< back](README.md)
2
2
 
3
- # Example: 10-result
3
+ # result
4
4
 
5
5
  Sometimes it can be useful to look at the information returned by the "run" command. For this we use the **"result" object**.
6
6
 
@@ -20,11 +20,11 @@ end
20
20
 
21
21
  **Example 2:** When we are debugging our test and we want to see the content of the "result" object on the screen, we will use `result.debug`.
22
22
 
23
- ```
23
+ ```ruby
24
24
  group "Checking users" do
25
25
  users = ["root", "vader"]
26
26
 
27
- users.each do |name|
27
+ for name in users do
28
28
  target "Exists username #{name}"
29
29
  run "id #{name}"
30
30
  result.debug
@@ -0,0 +1,54 @@
1
+ [<<back](README.md)
2
+
3
+ # Test code
4
+
5
+ Let's test code using teuton.
6
+
7
+ **Example:**
8
+
9
+ * Ask students to make a program that performs addition and multiplication.
10
+ * Define targets `sum` and `mul`:
11
+
12
+ ```ruby
13
+ # File: start.rb
14
+ group "Test code example" do
15
+ # Reading filepath from config file
16
+ filepath = "./#{get(:folder)}/#{get(:filename)}"
17
+
18
+ target "Sum"
19
+ run "#{filepath} 3 4"
20
+ expect [ "Sum", "7" ] # Using Array/List of required items
21
+
22
+ target "Mul"
23
+ run "#{filepath} 3 4"
24
+ expect /Mul\s+=\s+12/ # Using a regular expresion
25
+ end
26
+ ```
27
+
28
+ * Define config params:
29
+
30
+ ```yaml
31
+ # File: config.yaml
32
+ ---
33
+ global:
34
+ folder: examples/23-test-code/code
35
+ cases:
36
+ - tt_members: student_1
37
+ filename: math_1.py
38
+ - tt_members: student_2
39
+ filename: math_2b.py
40
+ ```
41
+
42
+ * Put students files into `code` folder.
43
+ * Now run Teuton test:
44
+
45
+ ```
46
+ ❯ teuton examples/23-test-code
47
+
48
+ CASE RESULTS
49
+ +------+-----------+-------+-------+
50
+ | CASE | MEMBERS | GRADE | STATE |
51
+ | 01 | student_1 | 100.0 | ✔ |
52
+ | 02 | student_2 | 100.0 | ✔ |
53
+ +------+-----------+-------+-------+
54
+ ```
@@ -0,0 +1,69 @@
1
+ [<<back](README.md)
2
+
3
+ # Test SQL and database
4
+
5
+ **Exercise**
6
+
7
+ * Ask students to make a Sqlite Database. Create a table called `characters` with `name` varchar, and `rol` varchar.
8
+ * Database example:
9
+
10
+ ```
11
+ ❯ sqlite3 examples/24-test-sql/database_01.db
12
+
13
+ sqlite> .schema characters
14
+ CREATE TABLE characters ( name varchar(255), rol varchar(255));
15
+
16
+ sqlite> select * from characters;
17
+ Obiwan|Jedi
18
+ ```
19
+
20
+ * Query example:
21
+
22
+ ```
23
+ ❯ cat examples/24-test-sql/query_01.sql
24
+
25
+ select * from characters where rol='Jedi';
26
+ ```
27
+
28
+ **Teuton test**
29
+
30
+ * Define targets:
31
+
32
+ ```ruby
33
+ group "Test SQL and database" do
34
+ database = "#{get(:folder)}/#{get(:database)}"
35
+ query = "#{get(:folder)}/#{get(:query)}"
36
+
37
+ target "Database schema"
38
+ run "sqlite3 #{database} '.schema characters'"
39
+ expect "name varchar", "rol varchar"
40
+
41
+ target "Query Jedi"
42
+ run "sqlite3 #{database} '.read #{query}'"
43
+ expect "Obiwan", "Jedi"
44
+ end
45
+ ```
46
+
47
+ * Configure params:
48
+
49
+ ```yaml
50
+ ---
51
+ global:
52
+ folder: examples/24-test-sql
53
+ cases:
54
+ - tt_members: student_1_name
55
+ database: database_01.db
56
+ query: query_01.sql
57
+ ```
58
+
59
+ **Test output**
60
+
61
+ ```
62
+ ❯ teuton examples/24-test-sql
63
+
64
+ CASE RESULTS
65
+ +------+----------------+-------+-------+
66
+ | CASE | MEMBERS | GRADE | STATE |
67
+ | 01 | student_1_name | 100.0 | ✔ |
68
+ +------+----------------+-------+-------+
69
+ ```
data/docs/learn/README.md CHANGED
@@ -1,37 +1,35 @@
1
-
2
1
  [<< back](../../README.md)
3
2
 
4
- * [Learning](#learning)
5
- * [Examples](#examples)
6
- * [Videos](#videos)
7
-
8
- # Learning
9
-
10
- Learn how to use Teuton language to write your own tests:
11
- - [01 - Target](01-target.md)
12
- - [02 - Config file](02-config.md)
13
- - [03 - Remote hosts](03-remote_hosts.md)
14
- - [04 - Create new test](04-new_test.md)
15
- - [05 - Use](05-use.md)
16
- - [06 - Debug](06-debug.md)
17
- - [07 - Log](07-log.md)
18
- - [08 - Readme](08-readme.md)
19
- - [09 - Preserve](09-preserve.md)
20
- - [10 - Result object](10-result.md)
21
- - [11 - Moodle ID](11-moodle_id.md)
22
- - [12 - Get vars](12-get_vars.md)
23
- - [13 - Include](13-include.md)
24
- - [14 - Alias](14-alias.md)
25
- - 15 - Macros
26
- - [16 - Exit codes](16-exit_codes.md)
27
- - [Videos](videos.md)
28
-
29
- # Examples
30
-
31
- More examples
32
- * Let's see examples at [teuton-tests](https://github.com/dvarrui/teuton-tests) GitHub repository.
33
- * Ask us by email at `teuton.software@protonmail.com`.
34
- * [ES - CHAPI19: Teuton demo](https://github.com/dvarrui/proyectos-de-ejemplo/tree/master/charlas/teuton)
3
+ # Learn
4
+
5
+ Learn how write your own Teuton tests:
6
+
7
+ 1. [Creating NEW test](01-cmd_new.md)
8
+ 1. [Evaluating TARGET](02-target.md)
9
+ 1. [Checking REMOTE HOSTS](03-remote_hosts.md)
10
+ 1. [Reading CONFIG file](04-config.md)
11
+ 1. [Using several files](05-use.md)
12
+ 1. [CHECK test syntax](06-cmd_check.md)
13
+ 1. [Target WEIGHT](07-target_weight.md)
14
+ 1. [UNIQUE values](08-unique_values.md)
15
+ 1. [SEND report copies to remote hosts](09-send.md)
16
+ 1. [DEBUG results](10-debug.md)
17
+ 1. [Export other FORMATS](11-export.md)
18
+ 1. [PRESERVE old reports](12-preserve.md)
19
+ 1. [Hide FEEDBACK from reports](13-feedback.md)
20
+ 1. [MOODLE ID](14-moodle_id.md)
21
+ 1. [Build README from test](15-readme.md)
22
+ 1. [INCLUDE more configuration files](16-include.md)
23
+ 1. [ALIAS](17-alias.md)
24
+ 1. [LOG messages](18-log.md)
25
+ 1. [Don't get params, just read vars](19-read_vars.md)
26
+ 1. [MACROS](20-macros.md)
27
+ 1. [Checking exit codes](21-exit_codes.md)
28
+ 1. [RESULT object](22-result.md)
29
+ 1. [Test code](23-test-code.md)
30
+ 1. [Test SQL and database](24-test-sql.md)
31
+
32
+ Mores examples at [teuton-tests](https://github.com/dvarrui/teuton-tests) GitHub repository.
35
33
 
36
34
  # Videos
37
35
 
@@ -40,6 +38,7 @@ But if you want to see Spanish videos, here you are:
40
38
 
41
39
  Teuton (v2.0):
42
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)
43
42
 
44
43
  Sysadmingame (Teuton v1.0)
45
44
  * [Sysadmingame (1 de 3): Instalación del programa](https://youtu.be/dnyMq9_KDco)
@@ -1,13 +1,10 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "singleton"
4
- require_relative "version"
2
+ # require_relative "version"
5
3
  require_relative "utils/name_file_finder"
6
4
 
7
- # This Singleton contains application params
8
5
  class Application
9
6
  include Singleton
10
- include Teuton
7
+ # include Teuton
11
8
 
12
9
  attr_reader :letter
13
10
  attr_reader :running_basedir, :output_basedir
@@ -42,6 +42,7 @@ class Case
42
42
 
43
43
  # Define Case Report
44
44
  @report = Report.new(@id)
45
+ # TODO: Move folder creation from case to parent classes?
45
46
  @report.output_dir = File.join("var", @config.global[:tt_testname])
46
47
  ensure_dir @report.output_dir
47
48
 
@@ -98,7 +99,7 @@ class Case
98
99
  @report.head[:tt_members] || "noname"
99
100
  end
100
101
 
101
- alias skip? skip
102
+ alias_method :skip?, :skip
102
103
 
103
104
  private
104
105
 
@@ -55,7 +55,9 @@ module DSL
55
55
  end
56
56
 
57
57
  def expect_none(input, args = {})
58
- if input.instance_of? Array
58
+ if input.nil?
59
+ # nothing to do
60
+ elsif input.instance_of? Array
59
61
  input.each { |i| result.find(i) }
60
62
  else
61
63
  result.find(input)
@@ -31,5 +31,5 @@ module DSL
31
31
  run_cmd_on(host)
32
32
  @action[:duration] = (Time.now - start_time).round(3)
33
33
  end
34
- alias on goto
34
+ alias_method :on, :goto
35
35
  end
@@ -7,12 +7,14 @@ module DSL
7
7
  # @param text (String)
8
8
  # @param type (Symbol) Values :info, :warn or :error
9
9
  def log(text = "", type = :info)
10
- s = ""
10
+ s = " INFO"
11
11
  s = Rainbow("WARN!").color(:yellow) if type == :warn
12
12
  s = Rainbow("ERROR").bg(:red) if type == :error
13
13
  t = Time.now
14
14
  f = format("%<hour>02d:%<min>02d:%<sec>02d", {hour: t.hour, min: t.min, sec: t.sec})
15
- @report.lines << "[#{f}] #{s}: #{text}"
15
+ msg = "[#{f}] #{s}: #{text}"
16
+ msg = "[#{f}] #{text}" if s == ""
17
+ @report.lines << msg
16
18
  end
17
- alias msg log
19
+ alias_method :msg, :log
18
20
  end
@@ -37,10 +37,10 @@ module DSL
37
37
  Net::SFTP.start(ip, username, password: password, port: port) do |sftp|
38
38
  sftp.upload!(localfilepath, remotefilepath)
39
39
  end
40
- msg = Rainbow("[ OK ] #{(get(:tt_members)[0, 15]).ljust(16)} : #{remotefilepath}").green
40
+ msg = Rainbow("==> File '#{remotefilepath}' of '#{get(:tt_members)}' has been copied").green
41
41
  verboseln(msg)
42
42
  rescue
43
- msg = Rainbow("[ERROR] #{(get(:tt_members)[0, 15]).ljust(16)} : scp #{localfilepath} => #{remotefilepath}").red
43
+ msg = Rainbow("==> [FAIL] #{get(:tt_members)}: 'scp #{localfilepath}' to #{remotefilepath}").red
44
44
  verboseln(msg)
45
45
  end
46
46
  end
@@ -12,5 +12,5 @@ module DSL
12
12
  w = args[:weight] || 1.0
13
13
  weight(w)
14
14
  end
15
- alias goal target
15
+ alias_method :goal, :target
16
16
  end