moto 0.8.1 → 0.8.3
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/lib/reporting/listeners/junit_xml.rb +4 -3
- data/lib/reporting/listeners/webui.rb +66 -35
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ba797b82d95217eeee0ffd6e9f08cdf8f75b5de
|
4
|
+
data.tar.gz: 7f12124132318e7566953a2a9dfd12ed52cf4a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e020d6ec1a6c96d798f598784678b4a531d981a0b477acd9248ec9073d19bc5ae63ce0e2d01c5b7c6ab5b5975d18108df13a93b774a663d1c5329c05931e024
|
7
|
+
data.tar.gz: 339ac7bfebc0a3a2b872f88fde2e8010e3c7ff6f9b62d3cd9f5c381691dd6b7eae778ab6819e34e964811a0329f980d8525ef19d93879eb1188e52b26c75e168
|
@@ -11,7 +11,8 @@ module Moto
|
|
11
11
|
|
12
12
|
run_status_hash = {
|
13
13
|
errors: run_status.tests_error.length,
|
14
|
-
failures: run_status.
|
14
|
+
failures: run_status.tests_failed.length,
|
15
|
+
skipped: run_status.tests_skipped.length,
|
15
16
|
name: custom_run_name,
|
16
17
|
tests: run_status.tests_all.length,
|
17
18
|
time: run_status.duration,
|
@@ -33,11 +34,11 @@ module Moto
|
|
33
34
|
if test_status.results.last.code == Moto::Test::Result::ERROR
|
34
35
|
xml.error(message: test_status.results.last.message)
|
35
36
|
elsif test_status.results.last.code == Moto::Test::Result::FAILURE
|
36
|
-
|
37
37
|
test_status.results.last.failures.each do |failure_message|
|
38
38
|
xml.failure(message: failure_message)
|
39
39
|
end
|
40
|
-
|
40
|
+
elsif test_status.results.last.code == Moto::Test::Result::SKIPPED
|
41
|
+
xml.skipped
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
@@ -6,69 +6,85 @@ module Moto
|
|
6
6
|
module Listeners
|
7
7
|
class Webui < Base
|
8
8
|
|
9
|
+
REST_MAX_TRIES = 3
|
10
|
+
REST_TIMEOUT = 15
|
11
|
+
|
9
12
|
def start_run
|
10
13
|
|
11
14
|
@url = Moto::Lib::Config.moto[:test_reporter][:listeners][:webui][:url]
|
12
15
|
|
13
16
|
data = {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
name: custom_run_name,
|
18
|
+
result: :running,
|
19
|
+
cnt_all: nil,
|
20
|
+
cnt_passed: nil,
|
21
|
+
cnt_failure: nil,
|
22
|
+
cnt_error: nil,
|
23
|
+
cnt_skipped: nil,
|
24
|
+
user: Sys::Uname.sysname.downcase.include?('windows') ? ENV['USERNAME'] : ENV['LOGNAME'],
|
25
|
+
host: Sys::Uname.nodename,
|
26
|
+
pid: Process.pid
|
27
|
+
}
|
28
|
+
|
29
|
+
result = try {
|
30
|
+
RestClient::Request.execute(method: :post, url: "#{@url}/api/runs", payload: data.to_json, timeout: REST_TIMEOUT, headers: {content_type: :json, accept: :json})
|
24
31
|
}
|
25
32
|
|
26
|
-
@run = JSON.parse(
|
33
|
+
@run = JSON.parse(result)
|
27
34
|
@tests = {}
|
28
35
|
end
|
29
36
|
|
30
37
|
def end_run(run_status)
|
31
38
|
# PUT http://sandbox.dev:3000/api/runs/1
|
32
39
|
data = {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
result: run_status.result,
|
41
|
+
cnt_all: run_status.tests_all.length,
|
42
|
+
cnt_passed: run_status.tests_passed.length,
|
43
|
+
cnt_failure: run_status.tests_failed.length,
|
44
|
+
cnt_error: run_status.tests_error.length,
|
45
|
+
cnt_skipped: run_status.tests_skipped.length,
|
46
|
+
duration: run_status.duration
|
40
47
|
}
|
41
48
|
|
42
|
-
|
49
|
+
result = try {
|
50
|
+
RestClient::Request.execute(method: :put, url: "#{@url}/api/runs/#{@run['id']}", payload: data.to_json, timeout: REST_TIMEOUT, headers: {content_type: :json, accept: :json})
|
51
|
+
}
|
52
|
+
@run = JSON.parse(result)
|
43
53
|
end
|
44
54
|
|
45
55
|
def start_test(test_status)
|
46
56
|
# POST http://sandbox.dev:3000/api/tests/create
|
47
57
|
data = {
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
58
|
+
name: test_status.name,
|
59
|
+
class_name: test_status.test_class_name,
|
60
|
+
log: nil,
|
61
|
+
run_id: @run['id'],
|
62
|
+
env: test_status.env,
|
63
|
+
parameters: test_status.params.to_s,
|
64
|
+
result: :running,
|
65
|
+
error: nil,
|
66
|
+
failures: nil
|
57
67
|
}
|
58
68
|
|
59
|
-
|
69
|
+
result = try {
|
70
|
+
RestClient::Request.execute(method: :post, url: "#{@url}/api/tests", payload: data.to_json, timeout: REST_TIMEOUT, headers: {content_type: :json, accept: :json})
|
71
|
+
}
|
72
|
+
@tests[test_status.name] = JSON.parse(result)
|
60
73
|
end
|
61
74
|
|
62
75
|
def end_test(test_status)
|
63
76
|
data = {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
77
|
+
log: File.read(test_status.log_path),
|
78
|
+
result: test_status.results.last.code,
|
79
|
+
error: test_status.results.last.code == Moto::Test::Result::ERROR ? nil : test_status.results.last.message,
|
80
|
+
failures: test_failures(test_status),
|
81
|
+
duration: test_status.duration
|
69
82
|
}
|
70
83
|
|
71
|
-
|
84
|
+
result = try {
|
85
|
+
RestClient::Request.execute(method: :put, url: "#{@url}/api/tests/#{@tests[test_status.name]['id']}", payload: data.to_json, timeout: REST_TIMEOUT, headers: {content_type: :json, accept: :json})
|
86
|
+
}
|
87
|
+
@tests[test_status.name] = JSON.parse(result)
|
72
88
|
end
|
73
89
|
|
74
90
|
# @return [String] string with messages of all failures in a test
|
@@ -76,6 +92,21 @@ module Moto
|
|
76
92
|
test_status.results.last.failures.join("\n\t")
|
77
93
|
end
|
78
94
|
|
95
|
+
# Tries to execute, without an error, block of code passed to the function.
|
96
|
+
# @param block Block of code to be executed up to MAX_REST_TRIES
|
97
|
+
def try(&block)
|
98
|
+
|
99
|
+
tries = REST_MAX_TRIES
|
100
|
+
|
101
|
+
begin
|
102
|
+
yield
|
103
|
+
rescue
|
104
|
+
tries -= 1
|
105
|
+
tries > 0 ? retry : raise
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
79
110
|
end
|
80
111
|
end
|
81
112
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartek Wilczek
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-09-
|
14
|
+
date: 2016-09-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|