spectre-core 1.9.0 → 1.12.1
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/exe/spectre +51 -46
- data/lib/spectre/assertion.rb +50 -37
- data/lib/spectre/bag.rb +4 -2
- data/lib/spectre/curl.rb +62 -33
- data/lib/spectre/diagnostic.rb +12 -2
- data/lib/spectre/environment.rb +9 -5
- data/lib/spectre/helpers.rb +81 -22
- data/lib/spectre/http/basic_auth.rb +5 -2
- data/lib/spectre/http/keystone.rb +76 -73
- data/lib/spectre/http.rb +373 -359
- data/lib/spectre/logger/console.rb +7 -6
- data/lib/spectre/logger/file.rb +96 -96
- data/lib/spectre/logger.rb +146 -144
- data/lib/spectre/mixin.rb +35 -18
- data/lib/spectre/reporter/console.rb +3 -5
- data/lib/spectre/reporter/junit.rb +5 -3
- data/lib/spectre/resources.rb +7 -4
- data/lib/spectre.rb +58 -45
- metadata +26 -12
@@ -24,12 +24,14 @@ module Spectre
|
|
24
24
|
|
25
25
|
def start_context context
|
26
26
|
return unless context.__desc
|
27
|
+
|
27
28
|
puts (' ' * indent) + context.__desc.magenta
|
28
29
|
@level += 1
|
29
30
|
end
|
30
31
|
|
31
32
|
def end_context context
|
32
33
|
return unless context.__desc
|
34
|
+
|
33
35
|
@level -= 1
|
34
36
|
puts (' ' * indent) + @fmt_end_context.gsub('<desc>', context.__desc).magenta if @fmt_end_context
|
35
37
|
end
|
@@ -42,7 +44,7 @@ module Spectre
|
|
42
44
|
@level += 1
|
43
45
|
end
|
44
46
|
|
45
|
-
def end_spec
|
47
|
+
def end_spec _spec, _data
|
46
48
|
@level -= 1
|
47
49
|
end
|
48
50
|
|
@@ -76,7 +78,7 @@ module Spectre
|
|
76
78
|
@level += 1
|
77
79
|
end
|
78
80
|
|
79
|
-
def log_status
|
81
|
+
def log_status _desc, status, annotation=nil
|
80
82
|
status = status.green if status == Status::OK
|
81
83
|
status = status.blue if status == Status::INFO
|
82
84
|
status = status.grey if status == Status::DEBUG
|
@@ -106,12 +108,12 @@ module Spectre
|
|
106
108
|
print_line(message, Status::DEBUG.grey)
|
107
109
|
end
|
108
110
|
|
109
|
-
def log_error
|
111
|
+
def log_error _spec, exception
|
110
112
|
txt = (Status::ERROR + ' - ' + exception.class.name).red
|
111
113
|
print_line('', txt)
|
112
114
|
end
|
113
115
|
|
114
|
-
def log_skipped
|
116
|
+
def log_skipped _spec
|
115
117
|
print_line('', Status::SKIPPED.grey)
|
116
118
|
end
|
117
119
|
|
@@ -136,7 +138,6 @@ module Spectre
|
|
136
138
|
@process = nil
|
137
139
|
end
|
138
140
|
end
|
139
|
-
|
140
141
|
end
|
141
142
|
end
|
142
|
-
end
|
143
|
+
end
|
data/lib/spectre/logger/file.rb
CHANGED
@@ -1,96 +1,96 @@
|
|
1
|
-
module Spectre
|
2
|
-
module Logger
|
3
|
-
class File
|
4
|
-
def initialize config
|
5
|
-
raise 'No log format section in config for console logger' unless config.key? 'log_format' and config['log_format'].key? 'file'
|
6
|
-
|
7
|
-
@config = config['log_format']['file']
|
8
|
-
@fmt_start_group = @config['start_group']
|
9
|
-
@fmt_end_group = @config['end_group']
|
10
|
-
@fmt_sep = @config['separator']
|
11
|
-
|
12
|
-
@file_log = ::Logger.new config['log_file'], progname: 'spectre'
|
13
|
-
@file_log.level = config['debug'] ? 'DEBUG' : 'INFO'
|
14
|
-
end
|
15
|
-
|
16
|
-
def start_subject subject
|
17
|
-
@file_log.debug "start running subject '#{subject.desc}'"
|
18
|
-
end
|
19
|
-
|
20
|
-
def end_subject subject
|
21
|
-
@file_log.debug "subject '#{subject.desc}' finished"
|
22
|
-
end
|
23
|
-
|
24
|
-
def start_context context
|
25
|
-
if context and context.__desc
|
26
|
-
@file_log.debug "start running context '#{context.__desc}'"
|
27
|
-
else
|
28
|
-
@file_log.debug "start running main context of #{context.__subject.desc}"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def end_context context
|
33
|
-
if context and context.__desc
|
34
|
-
@file_log.debug "context '#{context.__desc}' finished"
|
35
|
-
else
|
36
|
-
@file_log.debug "main context finished of #{context.__subject.desc}"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def start_spec spec, data=nil
|
41
|
-
log_msg = "start running spec [#{spec.name}] '#{spec.desc}'"
|
42
|
-
log_msg += " with data #{data}" if data
|
43
|
-
@file_log.debug log_msg
|
44
|
-
end
|
45
|
-
|
46
|
-
def end_spec spec, data=nil
|
47
|
-
log_msg = "running spec [#{spec.name}] '#{spec.desc}'"
|
48
|
-
log_msg += " with data #{data}" if data
|
49
|
-
log_msg += " finished"
|
50
|
-
@file_log.debug log_msg
|
51
|
-
end
|
52
|
-
|
53
|
-
def log_separator desc
|
54
|
-
desc = @fmt_sep.gsub('<desc>', desc) if @fmt_sep
|
55
|
-
@file_log.info desc
|
56
|
-
end
|
57
|
-
|
58
|
-
def start_group desc
|
59
|
-
desc = @fmt_start_group.gsub('<desc>', desc) if @fmt_start_group
|
60
|
-
@file_log.info desc
|
61
|
-
end
|
62
|
-
|
63
|
-
def end_group desc
|
64
|
-
desc = @fmt_end_group.gsub('<desc>', desc) if @fmt_end_group
|
65
|
-
@file_log.info desc
|
66
|
-
end
|
67
|
-
|
68
|
-
def log_process desc
|
69
|
-
@file_log.debug desc
|
70
|
-
end
|
71
|
-
|
72
|
-
def log_info message
|
73
|
-
@file_log.info "#{Status::INFO} #{message}"
|
74
|
-
end
|
75
|
-
|
76
|
-
def log_debug message
|
77
|
-
@file_log.debug "#{Status::DEBUG} #{message}"
|
78
|
-
end
|
79
|
-
|
80
|
-
def log_error spec, exception
|
81
|
-
file, line = exception.backtrace[0].match(/(.*\.rb):(\d+)/).captures
|
82
|
-
@file_log.error "An unexpected error occured at '#{file}:#{line}' while running spec '#{spec.name}': [#{exception.class}] #{exception.message}\n#{exception.backtrace.join "\n"}"
|
83
|
-
end
|
84
|
-
|
85
|
-
def log_skipped spec
|
86
|
-
@file_log.warn "spec '#{spec.desc}' canceled by user"
|
87
|
-
end
|
88
|
-
|
89
|
-
def log_status desc, status, annotation=nil
|
90
|
-
msg = "expected #{desc}...#{status.upcase}"
|
91
|
-
msg += " - #{annotation}" if annotation
|
92
|
-
@file_log.debug msg
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
1
|
+
module Spectre
|
2
|
+
module Logger
|
3
|
+
class File
|
4
|
+
def initialize config
|
5
|
+
raise 'No log format section in config for console logger' unless config.key? 'log_format' and config['log_format'].key? 'file'
|
6
|
+
|
7
|
+
@config = config['log_format']['file']
|
8
|
+
@fmt_start_group = @config['start_group']
|
9
|
+
@fmt_end_group = @config['end_group']
|
10
|
+
@fmt_sep = @config['separator']
|
11
|
+
|
12
|
+
@file_log = ::Logger.new config['log_file'], progname: 'spectre'
|
13
|
+
@file_log.level = config['debug'] ? 'DEBUG' : 'INFO'
|
14
|
+
end
|
15
|
+
|
16
|
+
def start_subject subject
|
17
|
+
@file_log.debug "start running subject '#{subject.desc}'"
|
18
|
+
end
|
19
|
+
|
20
|
+
def end_subject subject
|
21
|
+
@file_log.debug "subject '#{subject.desc}' finished"
|
22
|
+
end
|
23
|
+
|
24
|
+
def start_context context
|
25
|
+
if context and context.__desc
|
26
|
+
@file_log.debug "start running context '#{context.__desc}'"
|
27
|
+
else
|
28
|
+
@file_log.debug "start running main context of #{context.__subject.desc}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def end_context context
|
33
|
+
if context and context.__desc
|
34
|
+
@file_log.debug "context '#{context.__desc}' finished"
|
35
|
+
else
|
36
|
+
@file_log.debug "main context finished of #{context.__subject.desc}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def start_spec spec, data=nil
|
41
|
+
log_msg = "start running spec [#{spec.name}] '#{spec.desc}'"
|
42
|
+
log_msg += " with data #{data}" if data
|
43
|
+
@file_log.debug log_msg
|
44
|
+
end
|
45
|
+
|
46
|
+
def end_spec spec, data=nil
|
47
|
+
log_msg = "running spec [#{spec.name}] '#{spec.desc}'"
|
48
|
+
log_msg += " with data #{data}" if data
|
49
|
+
log_msg += " finished"
|
50
|
+
@file_log.debug log_msg
|
51
|
+
end
|
52
|
+
|
53
|
+
def log_separator desc
|
54
|
+
desc = @fmt_sep.gsub('<desc>', desc) if @fmt_sep
|
55
|
+
@file_log.info desc
|
56
|
+
end
|
57
|
+
|
58
|
+
def start_group desc
|
59
|
+
desc = @fmt_start_group.gsub('<desc>', desc) if @fmt_start_group
|
60
|
+
@file_log.info desc
|
61
|
+
end
|
62
|
+
|
63
|
+
def end_group desc
|
64
|
+
desc = @fmt_end_group.gsub('<desc>', desc) if @fmt_end_group
|
65
|
+
@file_log.info desc
|
66
|
+
end
|
67
|
+
|
68
|
+
def log_process desc
|
69
|
+
@file_log.debug desc
|
70
|
+
end
|
71
|
+
|
72
|
+
def log_info message
|
73
|
+
@file_log.info "#{Status::INFO} #{message}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def log_debug message
|
77
|
+
@file_log.debug "#{Status::DEBUG} #{message}"
|
78
|
+
end
|
79
|
+
|
80
|
+
def log_error spec, exception
|
81
|
+
file, line = exception.backtrace[0].match(/(.*\.rb):(\d+)/).captures
|
82
|
+
@file_log.error "An unexpected error occured at '#{file}:#{line}' while running spec '#{spec.name}': [#{exception.class}] #{exception.message}\n#{exception.backtrace.join "\n"}"
|
83
|
+
end
|
84
|
+
|
85
|
+
def log_skipped spec
|
86
|
+
@file_log.warn "spec '#{spec.desc}' canceled by user"
|
87
|
+
end
|
88
|
+
|
89
|
+
def log_status desc, status, annotation=nil
|
90
|
+
msg = "expected #{desc}...#{status.upcase}"
|
91
|
+
msg += " - #{annotation}" if annotation
|
92
|
+
@file_log.debug msg
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/lib/spectre/logger.rb
CHANGED
@@ -1,144 +1,146 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
@@
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
Logger.
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
alias_method :
|
127
|
-
alias_method :
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
1
|
+
require_relative '../spectre'
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
module Spectre
|
5
|
+
module Logger
|
6
|
+
module Status
|
7
|
+
OK = '[ok]'
|
8
|
+
FAILED = '[failed]'
|
9
|
+
ERROR = '[error]'
|
10
|
+
INFO = '[info]'
|
11
|
+
SKIPPED = '[skipped]'
|
12
|
+
DEBUG = '[debug]'
|
13
|
+
end
|
14
|
+
|
15
|
+
class << self
|
16
|
+
@@debug = false
|
17
|
+
@@logger = []
|
18
|
+
|
19
|
+
def debug!
|
20
|
+
@@debug = true
|
21
|
+
end
|
22
|
+
|
23
|
+
def debug?
|
24
|
+
@@debug
|
25
|
+
end
|
26
|
+
|
27
|
+
def add logger
|
28
|
+
@@logger.append logger
|
29
|
+
end
|
30
|
+
|
31
|
+
def start_subject subject
|
32
|
+
delegate(:start_subject, subject)
|
33
|
+
end
|
34
|
+
|
35
|
+
def end_subject subject
|
36
|
+
delegate(:end_subject, subject)
|
37
|
+
end
|
38
|
+
|
39
|
+
def start_context context
|
40
|
+
delegate(:start_context, context)
|
41
|
+
end
|
42
|
+
|
43
|
+
def end_context context
|
44
|
+
delegate(:end_context, context)
|
45
|
+
end
|
46
|
+
|
47
|
+
def start_spec spec, data=nil
|
48
|
+
delegate(:start_spec, spec, data)
|
49
|
+
end
|
50
|
+
|
51
|
+
def end_spec spec, data=nil
|
52
|
+
delegate(:end_spec, spec, data)
|
53
|
+
end
|
54
|
+
|
55
|
+
def log_subject subject
|
56
|
+
begin
|
57
|
+
start_subject(subject)
|
58
|
+
yield
|
59
|
+
ensure
|
60
|
+
end_subject(subject)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def log_context context
|
65
|
+
begin
|
66
|
+
start_context(context)
|
67
|
+
yield
|
68
|
+
ensure
|
69
|
+
end_context(context)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def log_spec spec, data=nil
|
74
|
+
start_spec(spec, data)
|
75
|
+
yield
|
76
|
+
end_spec(spec, data)
|
77
|
+
end
|
78
|
+
|
79
|
+
def log_separator desc
|
80
|
+
delegate(:log_separator, desc)
|
81
|
+
end
|
82
|
+
|
83
|
+
def start_group desc
|
84
|
+
delegate(:start_group, desc)
|
85
|
+
end
|
86
|
+
|
87
|
+
def end_group desc
|
88
|
+
delegate(:end_group, desc)
|
89
|
+
end
|
90
|
+
|
91
|
+
def log_process desc
|
92
|
+
delegate(:log_process, desc)
|
93
|
+
end
|
94
|
+
|
95
|
+
def log_info message
|
96
|
+
add_log(message)
|
97
|
+
delegate(:log_info, message)
|
98
|
+
end
|
99
|
+
|
100
|
+
def log_debug message
|
101
|
+
return unless @@debug
|
102
|
+
|
103
|
+
add_log(message)
|
104
|
+
delegate(:log_debug, message)
|
105
|
+
end
|
106
|
+
|
107
|
+
def log_error spec, exception
|
108
|
+
add_log(exception)
|
109
|
+
delegate(:log_error, spec, exception)
|
110
|
+
end
|
111
|
+
|
112
|
+
def log_skipped spec
|
113
|
+
delegate(:log_skipped, spec)
|
114
|
+
end
|
115
|
+
|
116
|
+
def log_status desc, status, annotation=nil
|
117
|
+
delegate(:log_status, desc, status, annotation)
|
118
|
+
end
|
119
|
+
|
120
|
+
def group desc
|
121
|
+
Logger.start_group desc
|
122
|
+
yield
|
123
|
+
Logger.end_group desc
|
124
|
+
end
|
125
|
+
|
126
|
+
alias_method :info, :log_info
|
127
|
+
alias_method :log, :log_info
|
128
|
+
alias_method :debug, :log_debug
|
129
|
+
alias_method :separate, :log_separator
|
130
|
+
|
131
|
+
private
|
132
|
+
|
133
|
+
def delegate method, *args
|
134
|
+
@@logger.each do |logger|
|
135
|
+
logger.send(method, *args) if logger.respond_to? method
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def add_log message
|
140
|
+
Spectre::Runner.current.log.append([DateTime.now, message])
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
Spectre.delegate :log, :info, :debug, :group, :separate, to: self
|
145
|
+
end
|
146
|
+
end
|
data/lib/spectre/mixin.rb
CHANGED
@@ -1,7 +1,27 @@
|
|
1
|
+
require_relative '../spectre'
|
2
|
+
require_relative 'logger'
|
3
|
+
|
1
4
|
require 'ostruct'
|
2
5
|
|
3
6
|
module Spectre
|
4
7
|
module Mixin
|
8
|
+
class MixinContext < Spectre::DslClass
|
9
|
+
def initialize desc
|
10
|
+
@__desc = desc
|
11
|
+
end
|
12
|
+
|
13
|
+
def required params, *keys
|
14
|
+
missing_keys = keys.select { |x| !params.to_h.key? x }
|
15
|
+
Spectre::Logger.log_debug("required parameters for '#{@__desc}': #{keys.join ', '}")
|
16
|
+
raise ArgumentError, "mixin '#{@__desc}' requires #{keys.join ', '}, but only has #{missing_keys.join ', '} given" unless missing_keys.empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
def optional params, *keys
|
20
|
+
Spectre::Logger.log_debug("optional parameters for '#{@__desc}': #{keys.join ', '}")
|
21
|
+
params
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
5
25
|
class << self
|
6
26
|
@@mixins = {}
|
7
27
|
|
@@ -11,31 +31,28 @@ module Spectre
|
|
11
31
|
|
12
32
|
def run desc, with: []
|
13
33
|
raise "no mixin with desc '#{desc}' defined" unless @@mixins.key? desc
|
14
|
-
Logger.log_debug "running mixin '#{desc}'"
|
15
34
|
|
16
|
-
|
17
|
-
|
35
|
+
Spectre::Logger.log_debug "running mixin '#{desc}'"
|
36
|
+
|
37
|
+
params = with || {}
|
38
|
+
|
39
|
+
ctx = MixinContext.new(desc)
|
40
|
+
|
41
|
+
if params.is_a? Array
|
42
|
+
return_val = ctx._execute(*params, &@@mixins[desc])
|
43
|
+
elsif params.is_a? Hash
|
44
|
+
return_val = ctx._execute(OpenStruct.new(params), &@@mixins[desc])
|
18
45
|
else
|
19
|
-
|
46
|
+
return_val = ctx._execute(params, &@@mixins[desc])
|
20
47
|
end
|
48
|
+
|
49
|
+
return_val.is_a?(Hash) ? OpenStruct.new(return_val) : return_val
|
21
50
|
end
|
22
51
|
|
23
52
|
alias_method :also, :run
|
24
53
|
alias_method :step, :run
|
25
54
|
end
|
26
55
|
|
27
|
-
Spectre.
|
28
|
-
if not config.key? 'mixin_patterns'
|
29
|
-
return
|
30
|
-
end
|
31
|
-
|
32
|
-
config['mixin_patterns'].each do |pattern|
|
33
|
-
Dir.glob(pattern).each do|f|
|
34
|
-
require_relative File.join(Dir.pwd, f)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
Spectre.delegate :mixin, :run, :also, :step, to: Mixin
|
56
|
+
Spectre.delegate :mixin, :run, :also, :step, to: self
|
40
57
|
end
|
41
|
-
end
|
58
|
+
end
|
@@ -5,7 +5,6 @@ module Spectre::Reporter
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def report run_infos
|
8
|
-
|
9
8
|
report_str = ''
|
10
9
|
|
11
10
|
errors = 0
|
@@ -15,7 +14,6 @@ module Spectre::Reporter
|
|
15
14
|
run_infos
|
16
15
|
.select { |x| x.error != nil or x.failure != nil }
|
17
16
|
.each_with_index do |run_info, index|
|
18
|
-
|
19
17
|
spec = run_info.spec
|
20
18
|
|
21
19
|
report_str += "\n#{index+1}) #{format_title(run_info)}\n"
|
@@ -93,11 +91,11 @@ module Spectre::Reporter
|
|
93
91
|
file.slice!(Dir.pwd + '/')
|
94
92
|
|
95
93
|
str = ''
|
96
|
-
str += " file.....: #{file}\n"
|
97
|
-
str += " line.....: #{line}\n"
|
94
|
+
str += " file.....: #{file}:#{line}\n"
|
98
95
|
str += " type.....: #{error.class}\n"
|
99
96
|
str += " message..: #{error.message}\n"
|
97
|
+
str += " backtrace: \n #{error.backtrace.join("\n ")}\n" if @config['debug']
|
100
98
|
str
|
101
99
|
end
|
102
100
|
end
|
103
|
-
end
|
101
|
+
end
|
@@ -57,8 +57,9 @@ module Spectre::Reporter
|
|
57
57
|
|
58
58
|
if run_info.log.count > 0 or run_info.properties.count > 0 or run_info.data
|
59
59
|
xml_str += '<system-out>'
|
60
|
+
xml_str += '<![CDATA['
|
60
61
|
|
61
|
-
if
|
62
|
+
if run_info.properties.count > 0
|
62
63
|
run_info.properties.each do |key, val|
|
63
64
|
xml_str += "#{key}: #{val}\n"
|
64
65
|
end
|
@@ -75,6 +76,7 @@ module Spectre::Reporter
|
|
75
76
|
xml_str += messages.join("\n")
|
76
77
|
end
|
77
78
|
|
79
|
+
xml_str += ']]>'
|
78
80
|
xml_str += '</system-out>'
|
79
81
|
end
|
80
82
|
|
@@ -86,7 +88,7 @@ module Spectre::Reporter
|
|
86
88
|
|
87
89
|
xml_str += '</testsuites>'
|
88
90
|
|
89
|
-
Dir.mkdir @config['out_path']
|
91
|
+
Dir.mkdir @config['out_path'] unless Dir.exist? @config['out_path']
|
90
92
|
|
91
93
|
file_path = File.join(@config['out_path'], "spectre-junit_#{timestamp}.xml")
|
92
94
|
|
@@ -95,4 +97,4 @@ module Spectre::Reporter
|
|
95
97
|
end
|
96
98
|
end
|
97
99
|
end
|
98
|
-
end
|
100
|
+
end
|