teuton 2.10.6 → 2.10.7
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/docs/commands/README.md +2 -2
- data/docs/commands/check-example.md +1 -1
- data/docs/commands/{howto-run-tests.md → run-tests.md} +17 -15
- data/docs/dsl/export.md +6 -10
- data/docs/dsl/get.md +13 -13
- data/docs/dsl/group.md +3 -1
- data/docs/dsl/send.md +6 -7
- data/docs/learn/01-cmd_new.md +8 -7
- data/docs/learn/02-target.md +10 -12
- data/docs/learn/03-remote_hosts.md +7 -5
- data/docs/learn/04-config.md +33 -36
- data/docs/learn/05-use.md +5 -4
- data/docs/learn/06-cmd_check.md +4 -2
- data/docs/learn/07-target_weight.md +8 -9
- data/docs/learn/08-unique_values.md +4 -2
- data/docs/learn/09-send.md +4 -4
- data/docs/learn/10-debug.md +8 -6
- data/docs/learn/11-export.md +7 -4
- data/docs/learn/12-preserve.md +13 -10
- data/lib/teuton/case/dsl/expect_sequence.rb +2 -2
- data/lib/teuton/case_manager/case_manager.rb +5 -5
- data/lib/teuton/case_manager/dsl.rb +3 -3
- data/lib/teuton/case_manager/export_manager.rb +1 -1
- data/lib/teuton/case_manager/report.rb +0 -3
- data/lib/teuton/check/show.rb +5 -4
- data/lib/teuton/files/config.yaml +1 -1
- data/lib/teuton/files/start.rb +4 -4
- data/lib/teuton/report/formatter/default/markdown.rb +90 -0
- data/lib/teuton/report/formatter/formatter.rb +5 -1
- data/lib/teuton/report/formatter/resume/markdown.rb +84 -0
- data/lib/teuton/report/report.rb +5 -10
- data/lib/teuton/version.rb +1 -1
- metadata +12 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 631f4c00542468fa42a36a38c017dc0a5e122fa4d0b1445dd0872ada4e5becdc
|
|
4
|
+
data.tar.gz: a01194deda208794fafcc3337f762584c36fd492fa9a5fd295240e5f5c9773c8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f8ec0d2672650d1b2d422f667dde1eed7e81f65133406d58d2ccc607c9ee8db7451e426a61e792f897f138815ecf37c4e6e0baf416e44fd677baa58003940376
|
|
7
|
+
data.tar.gz: 76052c9435bad56f8de1822d48491854bf597c3823a0ce056a1f6c0eeafdbf7b16b37ec12737a600eaf9f051e684f0878cbcfd94b2c00cd8e0d67ab9d6e0c76c
|
data/docs/commands/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Example:
|
|
|
39
39
|
```console
|
|
40
40
|
$ teuton new foo
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
Creating foo project
|
|
43
43
|
* Create dir => foo
|
|
44
44
|
* Create file => foo/config.yaml
|
|
45
45
|
* Create file => foo/start.rb
|
|
@@ -74,7 +74,7 @@ Alias: `teuton c foo`, `teuton -c foo`, `teuton --check foo`
|
|
|
74
74
|
|
|
75
75
|
# 5. Run test
|
|
76
76
|
|
|
77
|
-
Read about [how to run tests](
|
|
77
|
+
Read about [how to run tests](run-tests.md)
|
|
78
78
|
|
|
79
79
|
# 6. Show test info as README file
|
|
80
80
|
|
|
@@ -17,7 +17,7 @@ Alias: `teuton foo`
|
|
|
17
17
|
|
|
18
18
|
Running Teuton test located into `example/01-target` folder.
|
|
19
19
|
|
|
20
|
-
```
|
|
20
|
+
```
|
|
21
21
|
$ teuton run example/01-target
|
|
22
22
|
|
|
23
23
|
------------------------------------
|
|
@@ -56,37 +56,39 @@ Options:
|
|
|
56
56
|
| -- | -------------------- | ------------ |
|
|
57
57
|
| 01 | teuton foo | Run foo/start.rb, with config file foo/config.yaml |
|
|
58
58
|
| 02 | teuton run foo | Run foo/start.rb, with config file foo/config.yaml |
|
|
59
|
-
| 03 |
|
|
60
|
-
| 04 |
|
|
61
|
-
| 05 | teuton
|
|
62
|
-
| 06 | teuton
|
|
63
|
-
| 07 | teuton run --
|
|
64
|
-
| 08 | teuton foo
|
|
65
|
-
| 08 | teuton run --cpath=starwars/jedi.yaml foo | Run foo/start.rb with starwars/jedi.yaml config file |
|
|
66
|
-
| 09 | teuton run --case=6,16 foo | Run foo/start.rb with foo/config.yaml config file but only for case id '06' and '16' |
|
|
59
|
+
| 03 | teuton . | Run ./start.rb with ./config.yaml file |
|
|
60
|
+
| 04 | teuton run --export=json foo | Run foo/start.rb and force json format during exporting |
|
|
61
|
+
| 05 | teuton run --cname=rock foo | Run foo/start.rb with foo/rock.yaml config file |
|
|
62
|
+
| 06 | teuton foo/demo42.rb | Run foo/demo42.rb with foo/demo42.yaml config file |
|
|
63
|
+
| 07 | teuton run --cpath=starwars/jedi.yaml foo | Run foo/start.rb with starwars/jedi.yaml config file |
|
|
64
|
+
| 08 | teuton run --case=6,16 foo | Run foo/start.rb with foo/config.yaml config file but only for case id '06' and '16' |
|
|
67
65
|
|
|
68
66
|
# 3. Choosing config file
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
## 3.1 Default file names
|
|
69
|
+
|
|
71
70
|
By default, when you run `teuton run foo`, this will search for:
|
|
72
71
|
* `foo/start.rb` test file and
|
|
73
72
|
* `foo/config.yaml` config file.
|
|
74
73
|
|
|
75
|
-
|
|
74
|
+
## 3.2 Using `cname` option
|
|
75
|
+
|
|
76
76
|
It's posible execute `teuton run --cname=rock foo`, and choose diferent config file into projet folder:
|
|
77
77
|
* `foo/start.rb` test file and
|
|
78
78
|
* `foo/rock.yaml` config file.
|
|
79
79
|
|
|
80
80
|
> `cname` param searchs YAML config file into the same project folder.
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
## 3.3 Using `cpath` option
|
|
83
|
+
|
|
84
|
+
An also, it's posible execute `teuton run --cpath=/home/obiwan/startwars.yaml foo`, and choose config file using its absolute path:
|
|
84
85
|
* `foo/start.rb` test file and
|
|
85
|
-
* `/home/
|
|
86
|
+
* `/home/obiwan/starwars.yaml` config file.
|
|
86
87
|
|
|
87
88
|
> `cpath` param selects YAML config file, from the specified path.
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
## 3.4 Using diferent main rb name
|
|
91
|
+
|
|
90
92
|
When you execute `teuton run foo/mazingerz.rb`, this will search for:
|
|
91
93
|
* `foo/mazingerz.rb` test file and
|
|
92
94
|
* `foo/mazingerz.yaml` config file.
|
data/docs/dsl/export.md
CHANGED
|
@@ -2,20 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
# export
|
|
4
4
|
|
|
5
|
-
Create reports
|
|
6
|
-
|
|
7
|
-
## Example
|
|
8
|
-
|
|
9
|
-
Run export and build reports using txt output format by default:
|
|
5
|
+
Create output reports into `var/TESTNAME` folder.
|
|
10
6
|
|
|
7
|
+
**Example 1**: Run export and build reports using default format (`txt`).
|
|
11
8
|
```ruby
|
|
12
9
|
play do
|
|
13
10
|
export
|
|
14
11
|
end
|
|
15
12
|
```
|
|
16
13
|
|
|
17
|
-
Run test and build reports using `html`
|
|
18
|
-
|
|
14
|
+
**Example 2**: Run test and build reports using `html` format.
|
|
19
15
|
```ruby
|
|
20
16
|
play do
|
|
21
17
|
export format: 'html'
|
|
@@ -26,9 +22,9 @@ end
|
|
|
26
22
|
|
|
27
23
|
| Option | Values | Description |
|
|
28
24
|
| ------ | ------ | ----------- |
|
|
29
|
-
| format | **txt** (default), html, yaml, json, colored_text (txt with colors) |Output file format |
|
|
30
|
-
| preserve | **false** (default), true | Keep report
|
|
31
|
-
| feedback | **true** (default), false | Hide
|
|
25
|
+
| format | **txt** (default), html, yaml, json, markdown, colored_text (txt with colors) |Output file format |
|
|
26
|
+
| preserve | **false** (default), true | Keep old report copies |
|
|
27
|
+
| feedback | **true** (default), false | Hide feedback information from reports |
|
|
32
28
|
|
|
33
29
|
## Usage
|
|
34
30
|
|
data/docs/dsl/get.md
CHANGED
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
# get
|
|
4
4
|
|
|
5
|
-
`get` reads param value from configuration file.
|
|
5
|
+
`get(PARAM)` keyword reads param value from configuration file.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
get(PARAM)
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Example
|
|
7
|
+
## Example 1: reading params
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
Suppose we have this `config.yaml` content:
|
|
14
10
|
|
|
15
11
|
```yaml
|
|
16
12
|
---
|
|
@@ -28,19 +24,23 @@ Supossing we are **case 01**, then:
|
|
|
28
24
|
* `get(:username)` returns `obiwan`.
|
|
29
25
|
* `get(:host1_username)`, returns `root`.
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
## Example 2: writting and reading params
|
|
28
|
+
|
|
29
|
+
We also can create new temporal params:
|
|
32
30
|
|
|
33
31
|
```ruby
|
|
34
32
|
set(:name, "Obiwan")
|
|
35
|
-
|
|
33
|
+
jediname = get(:name)
|
|
36
34
|
```
|
|
37
35
|
|
|
38
|
-
So `
|
|
36
|
+
So `jediname` value is "Obiwan".
|
|
37
|
+
|
|
38
|
+
## Example 3: reading alias
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Other ways or reading param values:
|
|
41
41
|
|
|
42
42
|
```ruby
|
|
43
|
-
|
|
43
|
+
jediname = _name
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
So `
|
|
46
|
+
So `jediname` value is "Obiwan" too. `_name` is an alias of `get(:name)`.
|
data/docs/dsl/group.md
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
Groups targets.
|
|
6
6
|
|
|
7
|
+
## Example
|
|
8
|
+
|
|
7
9
|
```ruby
|
|
8
10
|
group "Group name" do
|
|
9
11
|
...
|
|
10
12
|
end
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
* Define a group of targets
|
|
15
|
+
* Define a group of targets. These are groups of objectives to be evaluated.
|
|
14
16
|
* At least you must define one `group`, where you can define all your targets.
|
|
15
17
|
* We can use `group`, as many times as we need. Usefull to group related objectives.
|
data/docs/dsl/send.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
`send` is used to copy Teuton reports into remote machines.
|
|
6
6
|
|
|
7
|
+
Usage:
|
|
7
8
|
```ruby
|
|
8
9
|
start do
|
|
9
10
|
export
|
|
@@ -11,9 +12,9 @@ start do
|
|
|
11
12
|
end
|
|
12
13
|
```
|
|
13
14
|
|
|
14
|
-
* `send` instruction must be execute after `export
|
|
15
|
+
* `send` instruction must be execute after `export`, because report files must be generated before send them.
|
|
15
16
|
* `host1`, label that identify remote host. This information must be configured into config file.
|
|
16
|
-
* `send copy_to: :host1`,
|
|
17
|
+
* `send copy_to: :host1`, by default, the home folder of the user `host1_username` is used to copy report on the remote host (`host1_ip`).
|
|
17
18
|
|
|
18
19
|
## Options
|
|
19
20
|
|
|
@@ -50,9 +51,9 @@ start do
|
|
|
50
51
|
end
|
|
51
52
|
```
|
|
52
53
|
|
|
53
|
-
## Example:
|
|
54
|
+
## Example: Change remote dir using "dir" options
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
This example sends `case-01-txt` file to default folder of remote host.
|
|
56
57
|
|
|
57
58
|
```ruby
|
|
58
59
|
play do
|
|
@@ -62,11 +63,9 @@ play do
|
|
|
62
63
|
end
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
Result:
|
|
66
|
-
|
|
67
66
|

|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
Using `dir: "./Desktop"`, report files will be sent to remote host "./Desktop" folder.
|
|
70
69
|
|
|
71
70
|
```ruby
|
|
72
71
|
play do
|
data/docs/learn/01-cmd_new.md
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
[<< back](README.md)
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
# New test
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
`teuton create foo` is a command function that creates skeleton for a new project.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
7
9
|
|
|
8
10
|
```
|
|
9
|
-
|
|
11
|
+
$ teuton new foo
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Creating foo project
|
|
12
14
|
* Create dir => foo
|
|
13
15
|
* Create file => foo/config.yaml
|
|
14
16
|
* Create file => foo/start.rb
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
Read about [teuton create](../commands/README.md)
|
|
18
20
|
|
|
19
21
|
This command will create:
|
|
20
22
|
|
|
@@ -24,5 +26,4 @@ This command will create:
|
|
|
24
26
|
| foo/start.rb | Main Script |
|
|
25
27
|
| foo/config.yaml | YAML configuration file |
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
Now it is time to customize your targets.
|
|
29
|
+
The next step is to personalize your targets.
|
data/docs/learn/02-target.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[<< back](README.md)
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Target
|
|
4
4
|
|
|
5
5
|
A [target](../dsl/target.md) is a feature you want to check. Targets are defined into `group` sections.
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ A [target](../dsl/target.md) is a feature you want to check. Targets are defined
|
|
|
8
8
|
|
|
9
9
|
Every evaluation has 3 parts:
|
|
10
10
|
* [target](dsl/target.md): Description of the element to be tested.
|
|
11
|
-
* [run](../dsl/run.md): Execute a command
|
|
11
|
+
* [run](../dsl/run.md): Execute a command on local or remote host.
|
|
12
12
|
* [expect](../dsl/expect.md): Verify that the result contains expected value.
|
|
13
13
|
|
|
14
14
|
```ruby
|
|
@@ -24,24 +24,23 @@ group "Learn about targets" do
|
|
|
24
24
|
end
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
> In this example, our localhost's OS is GNU/Linux (or any other compatible OS)
|
|
27
|
+
> In this example, our localhost's OS is GNU/Linux (or any other compatible OS), so the command executed is `id obiwan`.
|
|
28
28
|
|
|
29
29
|
When the user exists, we expect this words: `uid=, (obiwan), gid=`.
|
|
30
30
|
|
|
31
31
|
```
|
|
32
|
-
|
|
32
|
+
$ id obiwan
|
|
33
33
|
uid=1000(obiwan) gid=1000(obiwan) grupos=1000(obiwan)
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
But when user does not exist, we expect command fail.
|
|
37
37
|
|
|
38
38
|
```
|
|
39
|
-
|
|
39
|
+
$ id vader
|
|
40
40
|
id: «vader»: no such user
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
>$ echo $?
|
|
43
43
|
1
|
|
44
|
-
|
|
45
44
|
```
|
|
46
45
|
|
|
47
46
|
## Execution section
|
|
@@ -62,8 +61,8 @@ end
|
|
|
62
61
|
|
|
63
62
|
Execute this command to run the test:
|
|
64
63
|
|
|
65
|
-
```
|
|
66
|
-
|
|
64
|
+
```
|
|
65
|
+
$ teuton run examples/02-target
|
|
67
66
|
|
|
68
67
|
CASE RESULTS
|
|
69
68
|
+------+-----------+-------+-------+
|
|
@@ -74,7 +73,7 @@ CASE RESULTS
|
|
|
74
73
|
|
|
75
74
|
Report files are created into `var/02-target/` folder:
|
|
76
75
|
|
|
77
|
-
```
|
|
76
|
+
```
|
|
78
77
|
var
|
|
79
78
|
└── 02-target
|
|
80
79
|
├── case-01.txt
|
|
@@ -85,7 +84,7 @@ var
|
|
|
85
84
|
Let's see one report:
|
|
86
85
|
|
|
87
86
|
```
|
|
88
|
-
|
|
87
|
+
$ cat var/02-target/case-01.txt
|
|
89
88
|
CONFIGURATION
|
|
90
89
|
+-------------+-----------+
|
|
91
90
|
| tt_members | anonymous |
|
|
@@ -94,7 +93,6 @@ CONFIGURATION
|
|
|
94
93
|
| tt_testname | 02-target |
|
|
95
94
|
+-------------+-----------+
|
|
96
95
|
|
|
97
|
-
|
|
98
96
|
GROUPS
|
|
99
97
|
- Learn about targets
|
|
100
98
|
01 (0.0/1.0)
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
To run test on remote host we have to define them into config file.
|
|
6
6
|
|
|
7
|
+
## Example
|
|
8
|
+
|
|
7
9
|
Let's see an example with:
|
|
8
10
|
* 1 global param.
|
|
9
11
|
* 3 cases with 3 params.
|
|
@@ -52,7 +54,7 @@ end
|
|
|
52
54
|
Execution:
|
|
53
55
|
|
|
54
56
|
```
|
|
55
|
-
|
|
57
|
+
$ teuton run examples/03-remote_hosts
|
|
56
58
|
|
|
57
59
|
CASE RESULTS
|
|
58
60
|
+------+-----------+-------+-------+
|
|
@@ -70,12 +72,12 @@ CONN ERRORS
|
|
|
70
72
|
+------+-----------+-------+------------------+
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
Notice that case-03 is 100% and conection works. It is running on localhost because has localhost IP (127.0.0.1)
|
|
75
|
+
Notice that case-03 is 100% and conection works. It is running on localhost because has localhost IP (127.0.0.1).
|
|
74
76
|
|
|
75
77
|
Results:
|
|
76
78
|
|
|
77
79
|
```
|
|
78
|
-
|
|
80
|
+
$ tree var/03-remote_hosts
|
|
79
81
|
|
|
80
82
|
var/03-remote_hosts
|
|
81
83
|
├── case-01.txt
|
|
@@ -87,7 +89,7 @@ var/03-remote_hosts
|
|
|
87
89
|
|
|
88
90
|
## tt_skip param
|
|
89
91
|
|
|
90
|
-
To disable a case, add skip param `tt_skip: true`.
|
|
91
|
-
* `tt_skip` it is
|
|
92
|
+
To disable a case, add skip param to config file. Example: `tt_skip: true`.
|
|
93
|
+
* `tt_skip` it is false by default.
|
|
92
94
|
* `tt_skip: false` ignore this case.
|
|
93
95
|
* `tt_skip: true`, evaluate this case.
|
data/docs/learn/04-config.md
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
# config
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Our tests use config file to write dinamic data into separated file.
|
|
6
6
|
|
|
7
7
|
By default, `config.yaml` is our config file. Example:
|
|
8
8
|
|
|
9
9
|
```yaml
|
|
10
10
|
global:
|
|
11
11
|
cases:
|
|
12
|
-
- tt_members:
|
|
12
|
+
- tt_members: student_1
|
|
13
13
|
username: david
|
|
14
|
-
- tt_members:
|
|
14
|
+
- tt_members: student_2
|
|
15
15
|
username: fran
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
> **How to choose another config file?** Read this [document](../commands/
|
|
18
|
+
> **How to choose another config file?** Read this [document](../commands/run-test.md#3-choosing-config-file).
|
|
19
19
|
|
|
20
20
|
By default, `start.rb` it's our main execution file. Example:
|
|
21
21
|
|
|
@@ -29,19 +29,19 @@ group "Reading params from config file" do
|
|
|
29
29
|
end
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
* [get](../dsl/get.md) keyword read params from configuration file. It's posible personalize tests with diferent values for every case.
|
|
32
|
+
* [get](../dsl/get.md) keyword read params values from configuration file. It's posible personalize tests with diferent values for every case.
|
|
33
33
|
|
|
34
34
|
## Example
|
|
35
35
|
|
|
36
|
-
```
|
|
37
|
-
|
|
36
|
+
```
|
|
37
|
+
$ teuton run examples/04-config
|
|
38
38
|
|
|
39
39
|
CASE RESULTS
|
|
40
|
-
|
|
41
|
-
| CASE | MEMBERS
|
|
42
|
-
| 01 |
|
|
43
|
-
| 02 |
|
|
44
|
-
|
|
40
|
+
+------+-----------+-------+-------+
|
|
41
|
+
| CASE | MEMBERS | GRADE | STATE |
|
|
42
|
+
| 01 | student_1 | 100.0 | ✔ |
|
|
43
|
+
| 02 | student_2 | 0.0 | ? |
|
|
44
|
+
+------+-----------+-------+-------+
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
Reports:
|
|
@@ -57,16 +57,16 @@ var/04-config
|
|
|
57
57
|
Let's see case 01 report.
|
|
58
58
|
|
|
59
59
|
```
|
|
60
|
-
|
|
60
|
+
$ more var/04-config/case-01.txt
|
|
61
61
|
|
|
62
62
|
CONFIGURATION
|
|
63
|
-
|
|
64
|
-
| tt_members |
|
|
65
|
-
| tt_sequence | false
|
|
66
|
-
| tt_skip | false
|
|
67
|
-
| tt_testname | 04-config
|
|
68
|
-
| username | david
|
|
69
|
-
|
|
63
|
+
+-------------+------------+
|
|
64
|
+
| tt_members | student_1 |
|
|
65
|
+
| tt_sequence | false |
|
|
66
|
+
| tt_skip | false |
|
|
67
|
+
| tt_testname | 04-config |
|
|
68
|
+
| username | david |
|
|
69
|
+
+-------------+------------+
|
|
70
70
|
|
|
71
71
|
GROUPS
|
|
72
72
|
- Reading params from config file
|
|
@@ -95,10 +95,10 @@ RESULTS
|
|
|
95
95
|
|
|
96
96
|
## Using differents configuration files
|
|
97
97
|
|
|
98
|
-
Example with 3 config files (yaml files):
|
|
98
|
+
Example with 3 differents config files (yaml files):
|
|
99
99
|
|
|
100
100
|
```
|
|
101
|
-
|
|
101
|
+
$ tree examples/04-config
|
|
102
102
|
|
|
103
103
|
examples/04-config
|
|
104
104
|
├── config.yaml
|
|
@@ -107,23 +107,21 @@ examples/04-config
|
|
|
107
107
|
└── starwars.yaml
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
**Example 1**: Run test usign default config file (`config.yaml`).
|
|
112
111
|
```
|
|
113
|
-
|
|
112
|
+
$ teuton run examples/04-config
|
|
114
113
|
|
|
115
114
|
CASE RESULTS
|
|
116
|
-
|
|
117
|
-
| CASE | MEMBERS
|
|
118
|
-
| 01 |
|
|
119
|
-
| 02 |
|
|
120
|
-
|
|
115
|
+
+------+-----------+-------+-------+
|
|
116
|
+
| CASE | MEMBERS | GRADE | STATE |
|
|
117
|
+
| 01 | student_1 | 100.0 | ✔ |
|
|
118
|
+
| 02 | student_2 | 0.0 | ? |
|
|
119
|
+
+------+-----------+-------+-------+
|
|
121
120
|
```
|
|
122
121
|
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
**Example 2**: Run test using `example/04-config/starwars.yaml` config file.
|
|
125
123
|
```
|
|
126
|
-
|
|
124
|
+
$ teuton run --cname=starwars examples/04-config
|
|
127
125
|
|
|
128
126
|
CASE RESULTS
|
|
129
127
|
+------+------------+-------+-------+
|
|
@@ -133,10 +131,9 @@ CASE RESULTS
|
|
|
133
131
|
+------+------------+-------+-------+
|
|
134
132
|
```
|
|
135
133
|
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
**Example 3**: Run test using `example/04-config/rock.yaml` config file.
|
|
138
135
|
```
|
|
139
|
-
|
|
136
|
+
$ teuton run --cpath=examples/04-config/rock.yaml examples/04-config
|
|
140
137
|
|
|
141
138
|
CASE RESULTS
|
|
142
139
|
+------+------------+-------+-------+
|
data/docs/learn/05-use.md
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
# use
|
|
4
4
|
|
|
5
|
-
`use` keyword allow us organize huge amount of groups/targets into
|
|
5
|
+
`use` keyword allow us organize huge amount of groups/targets into differents files.
|
|
6
6
|
|
|
7
7
|
## Example
|
|
8
8
|
|
|
9
9
|
> This example requires Windows OS on remote machine.
|
|
10
10
|
|
|
11
|
-
```
|
|
12
|
-
|
|
11
|
+
```
|
|
12
|
+
$ tree examples/05-use
|
|
13
|
+
|
|
13
14
|
examples/05-use
|
|
14
15
|
├── lib
|
|
15
16
|
│ ├── network.rb
|
|
@@ -18,7 +19,7 @@ examples/05-use
|
|
|
18
19
|
└── start.rb
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
*
|
|
22
|
+
* The content is now splited into: `start.rb`, `users.rb` and `network.rb`.
|
|
22
23
|
|
|
23
24
|
```ruby
|
|
24
25
|
# File: start.rb
|
data/docs/learn/06-cmd_check.md
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
# check test
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
`teuton check DIRPATH` is a command function that checks syntax and show statistics.
|
|
7
|
+
|
|
8
|
+
## Example
|
|
7
9
|
|
|
8
10
|
```
|
|
9
|
-
|
|
11
|
+
$ teuton check examples/05-use
|
|
10
12
|
|
|
11
13
|
+--------------------------+
|
|
12
14
|
| GROUP: Using file: users |
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# Target weight
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`weight` is param used by `target` keyword to define weight target value.
|
|
6
|
+
|
|
7
|
+
## Example
|
|
8
|
+
|
|
9
|
+
Changing default target weight:
|
|
10
|
+
* The first target has the default weight (1.0).
|
|
11
|
+
* The second target has a weight of 2.0.
|
|
6
12
|
|
|
7
13
|
```ruby
|
|
8
14
|
# File: network.rb
|
|
@@ -18,15 +24,8 @@ group "Using file: network" do
|
|
|
18
24
|
end
|
|
19
25
|
```
|
|
20
26
|
|
|
27
|
+
Output:
|
|
21
28
|
```
|
|
22
|
-
+--------------------------+
|
|
23
|
-
| GROUP: Using file: users |
|
|
24
|
-
+--------------------------+
|
|
25
|
-
(001) target Create user get(username)
|
|
26
|
-
weight 1.0
|
|
27
|
-
run 'id get(username)' on host1
|
|
28
|
-
expect ["uid=", "(get(username))", "gid="] (Array)
|
|
29
|
-
|
|
30
29
|
+----------------------------+
|
|
31
30
|
| GROUP: Using file: network |
|
|
32
31
|
+----------------------------+
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# Unique value
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`unique` keyword defines a value that must be unique in all cases.
|
|
6
|
+
|
|
7
|
+
* Usage: `unique NAME, VALUE`. NAME is the param name, and VALUE is the value that must be unique.
|
|
6
8
|
* All cases that do not comply with this requirement will obtain a score of 0 and it will be reflected in the reports.
|
|
7
9
|
|
|
8
10
|
Example:
|
|
@@ -20,7 +22,7 @@ end
|
|
|
20
22
|
Cheking test:
|
|
21
23
|
|
|
22
24
|
```
|
|
23
|
-
|
|
25
|
+
$ teuton check examples/08-unique_values
|
|
24
26
|
|
|
25
27
|
+--------------------------+
|
|
26
28
|
| GROUP: Using file: users |
|
data/docs/learn/09-send.md
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Send
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
* [send](../dsl/send.md) keyword send report copies to every remote host.
|
|
5
|
+
`send` is a keyword used to copy the output report into remote host.
|
|
7
6
|
|
|
8
7
|
## Example
|
|
9
8
|
|
|
@@ -16,5 +15,6 @@ end
|
|
|
16
15
|
```
|
|
17
16
|
|
|
18
17
|
* `show`, show process log on screen.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* [export](../dsl/export.md), create reports with `txt` format.
|
|
19
|
+
* [send copy_to: :host1](../dsl/send.md), copy output report into remote machine (host1).
|
|
20
|
+
* `host1`, is a set params defined into config file (host1_ip, host1_username, host1_password, etc.)
|
data/docs/learn/10-debug.md
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# debug
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`result.debug` is an instrucction used to debug your tests.
|
|
6
|
+
|
|
7
|
+
## Introduction
|
|
8
|
+
|
|
9
|
+
Tests grows and becames huge, with a lot of targets (That isn't a problem). Then, we organize them spliting into several files and invoke `use` keywork from our main rb file to load other files (That's good idea).
|
|
6
10
|
|
|
7
11
|
```
|
|
8
|
-
|
|
12
|
+
$ tree examples/10-debug
|
|
9
13
|
|
|
10
14
|
examples/10-debug
|
|
11
15
|
├── config.yaml
|
|
@@ -14,11 +18,9 @@ examples/10-debug
|
|
|
14
18
|
└── start.rb
|
|
15
19
|
```
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Sometimes we need to verify or check rb file consistency and syntax, and we will do it with `teuton check PATH/TO/PROJECT/FOLDER`.
|
|
21
|
+
Sometimes we need to verify or check rb file consistency and syntax, and we will do it with `teuton check DIRPATH`.
|
|
20
22
|
|
|
21
|
-
##
|
|
23
|
+
## Explication
|
|
22
24
|
|
|
23
25
|
Every time we invoke `run` keywork, an OS command is executed. The output is showed on screen and saved into **result** internal object.
|
|
24
26
|
|
data/docs/learn/11-export.md
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# Export
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[export](../dsl/export.md) keyword generates output reports into diferents formats.
|
|
6
|
+
|
|
7
|
+
Available formats: colored_text, html, json, markdown, txt, xml, yaml.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
6
10
|
|
|
7
|
-
Example
|
|
8
11
|
```ruby
|
|
9
12
|
play do
|
|
10
13
|
show
|
|
@@ -19,10 +22,10 @@ end
|
|
|
19
22
|
* `export format: :html`, create reports with `html` format.
|
|
20
23
|
* `export format: :json`, create reports with `json` format.
|
|
21
24
|
|
|
22
|
-
Firs run `teuton examples/11-export`, then we have:
|
|
25
|
+
Firs run `teuton examples/11-export`, then we have this files:
|
|
23
26
|
|
|
24
27
|
```
|
|
25
|
-
|
|
28
|
+
$ tree var/11-export
|
|
26
29
|
|
|
27
30
|
var/11-export
|
|
28
31
|
├── case-01.html
|
data/docs/learn/12-preserve.md
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
[<< back](README.md)
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# preserve
|
|
4
|
+
|
|
5
|
+
`preserve` is an option of `export` keyword used to keep older report copies.
|
|
4
6
|
|
|
5
7
|
Every time we run teuton test, older output report files are overwritten with new reports. if you want to preserve old versions then use `preserve`.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Usage: `export preserve: true`
|
|
10
|
+
|
|
11
|
+
## Example
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
2. [Result](#result)
|
|
13
|
+
Example files in the `examples/12-preserve` folder.
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
**Execution section**
|
|
13
16
|
|
|
14
17
|
Take a look at our test execution section (Play):
|
|
15
18
|
```ruby
|
|
@@ -19,15 +22,15 @@ play do
|
|
|
19
22
|
end
|
|
20
23
|
```
|
|
21
24
|
|
|
22
|
-
> More information about [export](../dsl/
|
|
25
|
+
> More information about [export](../dsl/export.md) keyword.
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
**Result**
|
|
25
28
|
|
|
26
|
-
Example, executing `teuton run example/
|
|
29
|
+
Example, executing `teuton run example/12-preserve` twice:
|
|
27
30
|
|
|
28
31
|
```
|
|
29
32
|
var
|
|
30
|
-
└──
|
|
33
|
+
└── 12-preserve
|
|
31
34
|
├── 20200519-113035
|
|
32
35
|
│ ├── case-01.txt
|
|
33
36
|
│ ├── moodle.csv
|
|
@@ -41,4 +44,4 @@ var
|
|
|
41
44
|
└── resume.txt
|
|
42
45
|
```
|
|
43
46
|
|
|
44
|
-
|
|
47
|
+
The first time test was launched at 11:30, and second at 12:30 the same day.
|
|
@@ -37,8 +37,8 @@ class ExpectSequence
|
|
|
37
37
|
|
|
38
38
|
def find_best_state
|
|
39
39
|
@states.each do |state|
|
|
40
|
-
state[:score] = state[:steps].count {
|
|
41
|
-
state[:fails] = state[:steps].count { !
|
|
40
|
+
state[:score] = state[:steps].count { |value| value }
|
|
41
|
+
state[:fails] = state[:steps].count { |value| !value }
|
|
42
42
|
state[:ok] = state[:fails].zero?
|
|
43
43
|
end
|
|
44
44
|
best = @states[0]
|
|
@@ -3,20 +3,20 @@ require_relative "../report/report"
|
|
|
3
3
|
require_relative "../utils/project"
|
|
4
4
|
require_relative "../utils/verbose"
|
|
5
5
|
require_relative "../utils/configfile_reader"
|
|
6
|
+
require_relative "check_cases"
|
|
6
7
|
require_relative "export_manager"
|
|
7
8
|
require_relative "send_manager"
|
|
8
9
|
require_relative "show_report"
|
|
9
|
-
require_relative "check_cases"
|
|
10
10
|
require_relative "report"
|
|
11
11
|
require_relative "utils"
|
|
12
12
|
|
|
13
13
|
# * initialize
|
|
14
14
|
# * play
|
|
15
15
|
# Split into several files:
|
|
16
|
-
# *
|
|
17
|
-
# *
|
|
18
|
-
# *
|
|
19
|
-
# *
|
|
16
|
+
# * check_cases
|
|
17
|
+
# * export_manager
|
|
18
|
+
# * send_manager
|
|
19
|
+
# * show_report
|
|
20
20
|
class CaseManager
|
|
21
21
|
include Utils
|
|
22
22
|
include Verbose
|
|
@@ -37,9 +37,9 @@ def use(filename)
|
|
|
37
37
|
begin
|
|
38
38
|
require_relative findfiles.first
|
|
39
39
|
Project.value[:uses] << File.basename(findfiles.first)
|
|
40
|
-
rescue
|
|
41
|
-
puts "[ERROR]
|
|
42
|
-
puts "
|
|
40
|
+
rescue => e
|
|
41
|
+
puts "[ERROR] #{e}:"
|
|
42
|
+
puts " File not found! Fix line <use '#{filename}'>"
|
|
43
43
|
exit 1
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -30,7 +30,7 @@ class ExportManager
|
|
|
30
30
|
unless Formatter.available_formats.include? options[:format]
|
|
31
31
|
puts Rainbow("[WARN] ExportManager:").yellow.bright
|
|
32
32
|
puts Rainbow(" Unkown format <#{options[:format]}>. Fix line <export format: FORMAT>.").yellow.bright
|
|
33
|
-
puts Rainbow(" Available formats: #{Formatter.available_formats.join(",")}.").yellow.bright
|
|
33
|
+
puts Rainbow(" Available formats: #{Formatter.available_formats.join(", ")}.").yellow.bright
|
|
34
34
|
puts Rainbow("[INFO] Using default format <txt>.").yellow.bright
|
|
35
35
|
options[:format] = :txt
|
|
36
36
|
end
|
|
@@ -9,8 +9,6 @@ class CaseManager
|
|
|
9
9
|
# Open main report (resume report)
|
|
10
10
|
# @param config_filepath (String)
|
|
11
11
|
def open_main_report(config_filepath)
|
|
12
|
-
# app = Application.instance
|
|
13
|
-
|
|
14
12
|
@report.head[:tt_title] = "Teuton (#{Teuton::VERSION})"
|
|
15
13
|
@report.head[:tt_scriptname] = trim(Project.value[:script_path])
|
|
16
14
|
@report.head[:tt_configfile] = trim(config_filepath)
|
|
@@ -31,7 +29,6 @@ class CaseManager
|
|
|
31
29
|
verboseln Rainbow("-" * 36).green
|
|
32
30
|
verboseln " "
|
|
33
31
|
|
|
34
|
-
# app = Application.instance
|
|
35
32
|
@cases.each do |c|
|
|
36
33
|
line = {}
|
|
37
34
|
if c.skip?
|
data/lib/teuton/check/show.rb
CHANGED
|
@@ -61,7 +61,7 @@ class ShowCheck
|
|
|
61
61
|
end
|
|
62
62
|
if Project.value[:macros].size.positive?
|
|
63
63
|
st.add_row ["Macros", Project.value[:macros].size]
|
|
64
|
-
Project.value[:macros].each_key { st.add_row ["",
|
|
64
|
+
Project.value[:macros].each_key { |value| st.add_row ["", value] }
|
|
65
65
|
end
|
|
66
66
|
st.add_row ["Groups", @stats[:groups]]
|
|
67
67
|
st.add_row ["Targets", @stats[:targets]]
|
|
@@ -87,11 +87,12 @@ class ShowCheck
|
|
|
87
87
|
|
|
88
88
|
if @stats[:sets].size.positive?
|
|
89
89
|
st.add_row ["Sets", @stats[:sets].size]
|
|
90
|
-
@stats[:sets].each { st.add_row ["",
|
|
90
|
+
@stats[:sets].each { |value| st.add_row ["", value] }
|
|
91
91
|
end
|
|
92
92
|
if @stats[:uploads].size.positive?
|
|
93
93
|
st.add_row ["Uploads", @stats[:uploads].size]
|
|
94
|
-
@stats[:uploads].
|
|
94
|
+
uploads = @stats[:uploads].select { _1 }
|
|
95
|
+
uploads.each { |value| st.add_row ["", value] }
|
|
95
96
|
end
|
|
96
97
|
end
|
|
97
98
|
Logger.info my_screen_table.to_s + "\n"
|
|
@@ -114,7 +115,7 @@ class ShowCheck
|
|
|
114
115
|
script_vars << k.to_s + "_password"
|
|
115
116
|
end
|
|
116
117
|
end
|
|
117
|
-
@stats[:gets].keys.each { script_vars <<
|
|
118
|
+
@stats[:gets].keys.each { |value| script_vars << value }
|
|
118
119
|
script_vars
|
|
119
120
|
end
|
|
120
121
|
end
|
data/lib/teuton/files/start.rb
CHANGED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require_relative "array"
|
|
2
|
+
|
|
3
|
+
class MarkdownFormatter < ArrayFormatter
|
|
4
|
+
def initialize(report)
|
|
5
|
+
super
|
|
6
|
+
@ext = "md"
|
|
7
|
+
@data = {}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def process(options = {})
|
|
11
|
+
build_data(options)
|
|
12
|
+
process_config
|
|
13
|
+
process_logs
|
|
14
|
+
process_groups
|
|
15
|
+
process_results
|
|
16
|
+
process_hof
|
|
17
|
+
deinit
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def process_config
|
|
23
|
+
w "# CONFIGURATION\n\n"
|
|
24
|
+
w "| Param | Value |\n"
|
|
25
|
+
w "| ----- | ----- |\n"
|
|
26
|
+
@data[:config].sort.each { |key, value| w "| #{key} | #{value} |\n" }
|
|
27
|
+
w "\n"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def process_logs
|
|
31
|
+
return if @data[:logs].empty?
|
|
32
|
+
|
|
33
|
+
w "# LOGS\n\n"
|
|
34
|
+
@data[:logs].each { |line| w "* #{line}\n" }
|
|
35
|
+
w "\n"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def process_groups
|
|
39
|
+
return if @data[:groups].empty?
|
|
40
|
+
|
|
41
|
+
w "# GROUPS\n\n"
|
|
42
|
+
@data[:groups].each { |g| process_group g }
|
|
43
|
+
w "\n"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def process_results
|
|
47
|
+
w "# RESULTS\n\n"
|
|
48
|
+
w "| Param | Value |\n"
|
|
49
|
+
w "| ----- | ----- |\n"
|
|
50
|
+
@data[:results].sort.each { |key, value| w "| #{key} | #{value} |\n" }
|
|
51
|
+
w "\n"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def process_hof
|
|
55
|
+
return if @data[:hall_of_fame].size < 3
|
|
56
|
+
|
|
57
|
+
w "# HALL OF FAME\n\n"
|
|
58
|
+
w "| Grade | Amount |\n"
|
|
59
|
+
w "| ----- | ------ |\n"
|
|
60
|
+
@data[:hall_of_fame].each do |grade, amount|
|
|
61
|
+
if grade == @data[:results][:grade]
|
|
62
|
+
w "| **#{grade}** | **#{amount}** |\n"
|
|
63
|
+
else
|
|
64
|
+
w "| #{grade} | #{amount} |\n"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
w "\n"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
def process_group(group)
|
|
73
|
+
tab = " "
|
|
74
|
+
w "* **#{group[:title]}**\n"
|
|
75
|
+
group[:targets].each do |i|
|
|
76
|
+
style = "**"
|
|
77
|
+
style = "" if i[:check]
|
|
78
|
+
w "#{tab * 1}* #{format("%02d", i[:target_id].to_i)}"
|
|
79
|
+
text = "#{i[:score]}/#{i[:weight]}"
|
|
80
|
+
w " #{style}(#{text})#{style}\n"
|
|
81
|
+
w "#{tab * 2} * Description : #{i[:description]}\n"
|
|
82
|
+
w "#{tab * 2} * Command : #{i[:command]}\n"
|
|
83
|
+
w "#{tab * 2} * Output : #{i[:output]}\n"
|
|
84
|
+
w "#{tab * 2} * Duration : #{i[:duration]} (#{i[:conn_type]})\n"
|
|
85
|
+
w "#{tab * 2} * Alterations : #{i[:alterations]}\n"
|
|
86
|
+
w "#{tab * 2} * Expected : #{i[:expected]}\n"
|
|
87
|
+
w "#{tab * 2} * Result : #{i[:result]}\n"
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -2,12 +2,14 @@ require "rainbow"
|
|
|
2
2
|
require_relative "default/colored_text"
|
|
3
3
|
require_relative "default/html"
|
|
4
4
|
require_relative "default/json"
|
|
5
|
+
require_relative "default/markdown"
|
|
5
6
|
require_relative "default/txt"
|
|
6
7
|
require_relative "default/xml"
|
|
7
8
|
require_relative "default/yaml"
|
|
8
9
|
require_relative "resume/colored_text"
|
|
9
10
|
require_relative "resume/html"
|
|
10
11
|
require_relative "resume/json"
|
|
12
|
+
require_relative "resume/markdown"
|
|
11
13
|
require_relative "resume/txt"
|
|
12
14
|
require_relative "resume/yaml"
|
|
13
15
|
require_relative "moodle_csv_formatter"
|
|
@@ -17,6 +19,7 @@ module Formatter
|
|
|
17
19
|
colored_text: ColoredTextFormatter,
|
|
18
20
|
html: HTMLFormatter,
|
|
19
21
|
json: JSONFormatter,
|
|
22
|
+
markdown: MarkdownFormatter,
|
|
20
23
|
txt: TXTFormatter,
|
|
21
24
|
xml: XMLFormatter,
|
|
22
25
|
yaml: YAMLFormatter,
|
|
@@ -24,13 +27,14 @@ module Formatter
|
|
|
24
27
|
resume_colored_text: ResumeColoredTextFormatter,
|
|
25
28
|
resume_html: ResumeHTMLFormatter,
|
|
26
29
|
resume_json: ResumeJSONFormatter,
|
|
30
|
+
resume_markdown: ResumeMarkdownFormatter,
|
|
27
31
|
resume_txt: ResumeTXTFormatter,
|
|
28
32
|
resume_xml: ResumeTXTFormatter, # TODO
|
|
29
33
|
resume_yaml: ResumeYAMLFormatter
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
def self.available_formats
|
|
33
|
-
LIST.keys.take(
|
|
37
|
+
LIST.keys.take(7)
|
|
34
38
|
end
|
|
35
39
|
|
|
36
40
|
def self.call(report, options, filename)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require_relative "array"
|
|
2
|
+
|
|
3
|
+
class ResumeMarkdownFormatter < ResumeArrayFormatter
|
|
4
|
+
MIN_HALL_OF_FAME = 3
|
|
5
|
+
|
|
6
|
+
def initialize(report)
|
|
7
|
+
super
|
|
8
|
+
@ext = "md"
|
|
9
|
+
@data = {}
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def process(options = {})
|
|
13
|
+
build_data(options)
|
|
14
|
+
process_config
|
|
15
|
+
process_cases
|
|
16
|
+
process_conn_errors
|
|
17
|
+
process_results
|
|
18
|
+
process_hof
|
|
19
|
+
deinit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def process_config
|
|
25
|
+
w "# CONFIGURATION\n\n"
|
|
26
|
+
w "| Param | Value |\n"
|
|
27
|
+
w "| ----- | ----- |\n"
|
|
28
|
+
@data[:config].each { |key, value| w("| #{key} | #{trim(value)} |\n") }
|
|
29
|
+
w "\n"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def process_cases
|
|
33
|
+
w "# CASES\n\n"
|
|
34
|
+
w "| CASE | MEMBERS | GRADE | STATE |\n"
|
|
35
|
+
w "| ---- | ------- | ----- | ----- |\n"
|
|
36
|
+
@data[:cases].each do |line|
|
|
37
|
+
grade = format(" %<grade>3d", {grade: line[:grade]})
|
|
38
|
+
w "| #{line[:id]} | #{line[:members]} | #{grade} | #{line[:letter]} |\n"
|
|
39
|
+
end
|
|
40
|
+
w "\n"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def process_conn_errors
|
|
44
|
+
lines = []
|
|
45
|
+
lines << "# CONN ERRORS"
|
|
46
|
+
lines << ""
|
|
47
|
+
lines << "| CASE | MEMBERS | HOST | ERROR |"
|
|
48
|
+
lines << "| ---- | ------- | ---- | ----- |"
|
|
49
|
+
@data[:cases].each do |line|
|
|
50
|
+
line[:conn_status].each_pair do |h, e|
|
|
51
|
+
lines << "| #{line[:id]} | #{line[:members]} | #{h} | **#{e}** |\n"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if lines.size > 4
|
|
56
|
+
w lines.join("\n")
|
|
57
|
+
w "\n\n"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def process_results
|
|
62
|
+
w "# RESULTS\n\n"
|
|
63
|
+
w "| Param | Value |\n"
|
|
64
|
+
w "| ----- | ----- |\n"
|
|
65
|
+
@data[:results].each { |key, value| w("| #{key} | #{value} |\n") }
|
|
66
|
+
w "\n"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def process_hof
|
|
70
|
+
return if @data[:hall_of_fame].size < MIN_HALL_OF_FAME
|
|
71
|
+
|
|
72
|
+
w "# HALL OF FAME\n\n"
|
|
73
|
+
w "| Grade | Amount |\n"
|
|
74
|
+
w "| ----- | ------ |\n"
|
|
75
|
+
@data[:hall_of_fame].each do |grade, amount|
|
|
76
|
+
if line[0] == @data[:results][:grade]
|
|
77
|
+
w " | **#{grade}** | **#{amount}** |\n"
|
|
78
|
+
else
|
|
79
|
+
w " | #{grade} | #{amount} |\n"
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
w "\n"
|
|
83
|
+
end
|
|
84
|
+
end
|
data/lib/teuton/report/report.rb
CHANGED
|
@@ -9,14 +9,12 @@ class Report
|
|
|
9
9
|
def initialize(id = "00")
|
|
10
10
|
@id = id
|
|
11
11
|
@filename = "case-#{@id}"
|
|
12
|
-
# @output_dir = Application.instance.output_basedir
|
|
13
12
|
@output_dir = Project.value[:output_basedir]
|
|
14
13
|
@head = {}
|
|
15
14
|
@lines = []
|
|
16
|
-
@tail = {}
|
|
17
|
-
#
|
|
15
|
+
@tail = {unique_fault: 0}
|
|
16
|
+
# [String] with 1 char for every target in @lines
|
|
18
17
|
# For example: "..F." means: good, good, fail and good
|
|
19
|
-
# I will use this in the future stats manager.
|
|
20
18
|
@history = ""
|
|
21
19
|
end
|
|
22
20
|
|
|
@@ -55,10 +53,7 @@ class Report
|
|
|
55
53
|
# * fail_weight
|
|
56
54
|
# * fail_counter
|
|
57
55
|
def close
|
|
58
|
-
max = 0
|
|
59
|
-
good = 0.0
|
|
60
|
-
fail = 0.0
|
|
61
|
-
fail_counter = 0
|
|
56
|
+
max = good = fails = fail_counter = 0
|
|
62
57
|
@lines.each do |i|
|
|
63
58
|
next unless i.instance_of? Hash
|
|
64
59
|
|
|
@@ -67,14 +62,14 @@ class Report
|
|
|
67
62
|
good += i[:weight]
|
|
68
63
|
@history += Settings.letter[:good]
|
|
69
64
|
else
|
|
70
|
-
|
|
65
|
+
fails += i[:weight]
|
|
71
66
|
fail_counter += 1
|
|
72
67
|
@history += Settings.letter[:bad]
|
|
73
68
|
end
|
|
74
69
|
end
|
|
75
70
|
@tail[:max_weight] = max
|
|
76
71
|
@tail[:good_weight] = good
|
|
77
|
-
@tail[:fail_weight] =
|
|
72
|
+
@tail[:fail_weight] = fails
|
|
78
73
|
@tail[:fail_counter] = fail_counter
|
|
79
74
|
|
|
80
75
|
i = good.to_f / max
|
data/lib/teuton/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: teuton
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.10.
|
|
4
|
+
version: 2.10.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Vargas Ruiz
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2025-11-12 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: json_pure
|
|
@@ -121,11 +122,11 @@ executables:
|
|
|
121
122
|
- teuton
|
|
122
123
|
extensions: []
|
|
123
124
|
extra_rdoc_files:
|
|
124
|
-
- LICENSE
|
|
125
125
|
- README.md
|
|
126
|
+
- LICENSE
|
|
126
127
|
- docs/commands/README.md
|
|
127
128
|
- docs/commands/check-example.md
|
|
128
|
-
- docs/commands/
|
|
129
|
+
- docs/commands/run-tests.md
|
|
129
130
|
- docs/devel/diagram.md
|
|
130
131
|
- docs/dsl/README.md
|
|
131
132
|
- docs/dsl/expect.md
|
|
@@ -189,7 +190,7 @@ files:
|
|
|
189
190
|
- bin/teuton
|
|
190
191
|
- docs/commands/README.md
|
|
191
192
|
- docs/commands/check-example.md
|
|
192
|
-
- docs/commands/
|
|
193
|
+
- docs/commands/run-tests.md
|
|
193
194
|
- docs/devel/diagram.md
|
|
194
195
|
- docs/dsl/README.md
|
|
195
196
|
- docs/dsl/expect.md
|
|
@@ -320,6 +321,7 @@ files:
|
|
|
320
321
|
- lib/teuton/report/formatter/default/colored_text.rb
|
|
321
322
|
- lib/teuton/report/formatter/default/html.rb
|
|
322
323
|
- lib/teuton/report/formatter/default/json.rb
|
|
324
|
+
- lib/teuton/report/formatter/default/markdown.rb
|
|
323
325
|
- lib/teuton/report/formatter/default/txt.rb
|
|
324
326
|
- lib/teuton/report/formatter/default/xml.rb
|
|
325
327
|
- lib/teuton/report/formatter/default/yaml.rb
|
|
@@ -329,6 +331,7 @@ files:
|
|
|
329
331
|
- lib/teuton/report/formatter/resume/colored_text.rb
|
|
330
332
|
- lib/teuton/report/formatter/resume/html.rb
|
|
331
333
|
- lib/teuton/report/formatter/resume/json.rb
|
|
334
|
+
- lib/teuton/report/formatter/resume/markdown.rb
|
|
332
335
|
- lib/teuton/report/formatter/resume/txt.rb
|
|
333
336
|
- lib/teuton/report/formatter/resume/yaml.rb
|
|
334
337
|
- lib/teuton/report/report.rb
|
|
@@ -344,6 +347,7 @@ homepage: https://github.com/teuton-software/teuton
|
|
|
344
347
|
licenses:
|
|
345
348
|
- GPL-3.0
|
|
346
349
|
metadata: {}
|
|
350
|
+
post_install_message:
|
|
347
351
|
rdoc_options: []
|
|
348
352
|
require_paths:
|
|
349
353
|
- lib
|
|
@@ -351,14 +355,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
351
355
|
requirements:
|
|
352
356
|
- - ">="
|
|
353
357
|
- !ruby/object:Gem::Version
|
|
354
|
-
version: 2.
|
|
358
|
+
version: 3.2.8
|
|
355
359
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
356
360
|
requirements:
|
|
357
361
|
- - ">="
|
|
358
362
|
- !ruby/object:Gem::Version
|
|
359
363
|
version: '0'
|
|
360
364
|
requirements: []
|
|
361
|
-
rubygems_version: 3.
|
|
365
|
+
rubygems_version: 3.4.19
|
|
366
|
+
signing_key:
|
|
362
367
|
specification_version: 4
|
|
363
368
|
summary: Teuton (Infrastructure test)
|
|
364
369
|
test_files: []
|