rutema 2.0.0.pre9 → 2.0.0.pre10
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/History.txt +2 -0
- data/lib/rutema/core/framework.rb +29 -1
- data/lib/rutema/core/reporter.rb +17 -13
- data/lib/rutema/reporters/junit.rb +8 -8
- data/lib/rutema/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: a435cb8b197971e43324e00bd454b221537711c5
|
4
|
+
data.tar.gz: 26ac2971066f82bad55a72bfbbcdcb07fb0da797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2af990da6cc49aea9f3c07010bfce221cb878b776b38ee94672f81bb0a777485e4a5b265cd3c2b4a5c3a8fe966d858c1049b902bc8f6c3815a822f4d874e68d2
|
7
|
+
data.tar.gz: c8a0914225440da356b6f0f7abe03507f22d91a6a66df098fd3256b3d69b14410200cc7f2cbb87a3d29aa86193e618c5840535f360130487cf9c48a4ac6c737a
|
data/History.txt
CHANGED
@@ -11,7 +11,7 @@ module Rutema
|
|
11
11
|
def initialize params
|
12
12
|
@test=params.fetch(:test,"")
|
13
13
|
@text=params.fetch(:text,"")
|
14
|
-
@timestamp=params.fetch(:timestamp,
|
14
|
+
@timestamp=params.fetch(:timestamp,Time.now)
|
15
15
|
end
|
16
16
|
|
17
17
|
def to_s
|
@@ -31,6 +31,10 @@ module Rutema
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
#The Runner continuously sends these when executing tests
|
35
|
+
#
|
36
|
+
#If there is an engine error (e.g. when parsing) you will get an ErrorMessage, if it is a test error
|
37
|
+
#you will get a RunnerMessage with :error in the status.
|
34
38
|
class RunnerMessage<Message
|
35
39
|
attr_accessor :duration,:status,:number,:out,:err
|
36
40
|
def initialize params
|
@@ -58,6 +62,30 @@ module Rutema
|
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
65
|
+
#While executing tests the state of each test is collected in an
|
66
|
+
#instance of ReportState and the collection is at the end passed to the available block reporters
|
67
|
+
#
|
68
|
+
#ReportState assumes the timestamp of the first message, the status of the last message
|
69
|
+
#and accumulates the duration reported by all messages in it's collection.
|
70
|
+
class ReportState
|
71
|
+
attr_accessor :steps
|
72
|
+
attr_reader :test,:timestamp,:duration,:status
|
73
|
+
|
74
|
+
def initialize message
|
75
|
+
@test=message.test
|
76
|
+
@timestamp=message.timestamp
|
77
|
+
@duration=message.duration
|
78
|
+
@status=message.status
|
79
|
+
@steps=[message]
|
80
|
+
end
|
81
|
+
|
82
|
+
def <<(message)
|
83
|
+
@steps<<message
|
84
|
+
@duration+=message.duration
|
85
|
+
@status=message.status
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
61
89
|
module Messaging
|
62
90
|
def error identifier,message
|
63
91
|
@queue.push(ErrorMessage.new(:test=>identifier,:text=>message,:timestamp=>Time.now))
|
data/lib/rutema/core/reporter.rb
CHANGED
@@ -51,7 +51,9 @@ module Rutema
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
|
-
|
54
|
+
#This reporter is always instantiated and collects all messages fired by the rutema engine
|
55
|
+
#
|
56
|
+
#The collections of errors and states are then at the end of a run fed to the block reporters
|
55
57
|
class Collector<EventReporter
|
56
58
|
attr_reader :errors,:states
|
57
59
|
def initialize params,dispatcher
|
@@ -63,21 +65,24 @@ module Rutema
|
|
63
65
|
def update message
|
64
66
|
case message
|
65
67
|
when RunnerMessage
|
66
|
-
test_state=@states
|
67
|
-
test_state
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
steps<<message
|
73
|
-
test_state["steps"]=steps
|
68
|
+
test_state=@states[message.test]
|
69
|
+
if test_state
|
70
|
+
test_state<<message
|
71
|
+
else
|
72
|
+
test_state=Rutema::ReportState.new(message)
|
73
|
+
end
|
74
74
|
@states[message.test]=test_state
|
75
75
|
when ErrorMessage
|
76
76
|
@errors<<message
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
80
|
-
|
80
|
+
#A very simple event reporter that outputs to the console
|
81
|
+
#
|
82
|
+
#It has three settings: off, normal and verbose.
|
83
|
+
#
|
84
|
+
#Example configuration:
|
85
|
+
# cfg.reporter={:class=>Rutema::Reporters::Console, "mode"=>"verbose"}
|
81
86
|
class Console<EventReporter
|
82
87
|
def initialize configuration,dispatcher
|
83
88
|
super(configuration,dispatcher)
|
@@ -108,9 +113,8 @@ module Rutema
|
|
108
113
|
end
|
109
114
|
def report specs,states,errors
|
110
115
|
failures=[]
|
111
|
-
states.each
|
112
|
-
|
113
|
-
end
|
116
|
+
states.each{|k,v| failures<<v.test if v.status==:error}
|
117
|
+
|
114
118
|
unless @silent
|
115
119
|
puts "#{errors.size} errors. #{states.size} test cases executed. #{failures.size} failed"
|
116
120
|
unless failures.empty?
|
@@ -34,8 +34,8 @@ module Rutema
|
|
34
34
|
total_duration=0
|
35
35
|
states.each do |k,v|
|
36
36
|
tests<<test_case(k,v)
|
37
|
-
number_of_failed+=1 if v
|
38
|
-
total_duration+=v
|
37
|
+
number_of_failed+=1 if v.status!=:success
|
38
|
+
total_duration+=v.duration.to_f
|
39
39
|
end
|
40
40
|
#<testsuite disabled="0" errors="0" failures="1" hostname="" id=""
|
41
41
|
#name="" package="" skipped="" tests="" time="" timestamp="">
|
@@ -59,17 +59,17 @@ module Rutema
|
|
59
59
|
# <error> => test encountered an error
|
60
60
|
#</testcase>
|
61
61
|
element_test=REXML::Element.new("testcase")
|
62
|
-
element_test.add_attributes("name"=>name,"time"=>state
|
63
|
-
if state
|
62
|
+
element_test.add_attributes("name"=>name,"time"=>state.duration,"classname"=>@configuration.context[:config_name])
|
63
|
+
if state.status!=:success
|
64
64
|
fail=REXML::Element.new("failure")
|
65
|
-
fail.add_attribute("message","Step #{state
|
66
|
-
fail.add_text "Step #{state
|
65
|
+
fail.add_attribute("message","Step #{state.steps.last.number} failed.")
|
66
|
+
fail.add_text "Step #{state.steps.last.number} failed."
|
67
67
|
element_test.add_element(fail)
|
68
68
|
out=REXML::Element.new("system-out")
|
69
|
-
out.add_text state
|
69
|
+
out.add_text state.steps.last.out
|
70
70
|
element_test.add_element(out)
|
71
71
|
err=REXML::Element.new("system-err")
|
72
|
-
err.add_text state
|
72
|
+
err.add_text state.steps.last.err
|
73
73
|
element_test.add_element(err)
|
74
74
|
end
|
75
75
|
return element_test
|
data/lib/rutema/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rutema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.pre10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vassilis Rizopoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: patir
|