teuton 2.10.6 → 2.10.8
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 +18 -10
- data/docs/commands/README.md +2 -2
- data/docs/commands/check-example.md +16 -19
- 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/readme/dsl/getset.rb +5 -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 +6 -4
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
|
@@ -14,13 +14,14 @@ module ReadmeDSL
|
|
|
14
14
|
def gett(value)
|
|
15
15
|
a = get(value)
|
|
16
16
|
if @cases_params.include? value
|
|
17
|
-
"[
|
|
17
|
+
"[#{value}](#required-params)"
|
|
18
18
|
elsif @setted_params[value]
|
|
19
|
-
"[
|
|
19
|
+
"[#{value}](#created-params)"
|
|
20
20
|
elsif @global_params.include? value
|
|
21
|
-
"[
|
|
21
|
+
"[#{a}](#global-params)"
|
|
22
|
+
else
|
|
23
|
+
a
|
|
22
24
|
end
|
|
23
|
-
a
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
def set(key, value)
|
|
@@ -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,7 +1,7 @@
|
|
|
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.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Vargas Ruiz
|
|
@@ -125,7 +125,7 @@ extra_rdoc_files:
|
|
|
125
125
|
- README.md
|
|
126
126
|
- docs/commands/README.md
|
|
127
127
|
- docs/commands/check-example.md
|
|
128
|
-
- docs/commands/
|
|
128
|
+
- docs/commands/run-tests.md
|
|
129
129
|
- docs/devel/diagram.md
|
|
130
130
|
- docs/dsl/README.md
|
|
131
131
|
- docs/dsl/expect.md
|
|
@@ -189,7 +189,7 @@ files:
|
|
|
189
189
|
- bin/teuton
|
|
190
190
|
- docs/commands/README.md
|
|
191
191
|
- docs/commands/check-example.md
|
|
192
|
-
- docs/commands/
|
|
192
|
+
- docs/commands/run-tests.md
|
|
193
193
|
- docs/devel/diagram.md
|
|
194
194
|
- docs/dsl/README.md
|
|
195
195
|
- docs/dsl/expect.md
|
|
@@ -320,6 +320,7 @@ files:
|
|
|
320
320
|
- lib/teuton/report/formatter/default/colored_text.rb
|
|
321
321
|
- lib/teuton/report/formatter/default/html.rb
|
|
322
322
|
- lib/teuton/report/formatter/default/json.rb
|
|
323
|
+
- lib/teuton/report/formatter/default/markdown.rb
|
|
323
324
|
- lib/teuton/report/formatter/default/txt.rb
|
|
324
325
|
- lib/teuton/report/formatter/default/xml.rb
|
|
325
326
|
- lib/teuton/report/formatter/default/yaml.rb
|
|
@@ -329,6 +330,7 @@ files:
|
|
|
329
330
|
- lib/teuton/report/formatter/resume/colored_text.rb
|
|
330
331
|
- lib/teuton/report/formatter/resume/html.rb
|
|
331
332
|
- lib/teuton/report/formatter/resume/json.rb
|
|
333
|
+
- lib/teuton/report/formatter/resume/markdown.rb
|
|
332
334
|
- lib/teuton/report/formatter/resume/txt.rb
|
|
333
335
|
- lib/teuton/report/formatter/resume/yaml.rb
|
|
334
336
|
- lib/teuton/report/report.rb
|
|
@@ -351,7 +353,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
351
353
|
requirements:
|
|
352
354
|
- - ">="
|
|
353
355
|
- !ruby/object:Gem::Version
|
|
354
|
-
version: 2.
|
|
356
|
+
version: 3.2.8
|
|
355
357
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
356
358
|
requirements:
|
|
357
359
|
- - ">="
|