cuke_parser 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cuke_parser.rb +6 -0
- data/lib/parse_engine/json_parser.rb +22 -113
- metadata +13 -13
data/lib/cuke_parser.rb
CHANGED
@@ -24,6 +24,12 @@ module CukeParser
|
|
24
24
|
json_parser = ParseEngine::JsonParser.new
|
25
25
|
json_parser.get_build(file_path,cuke_data)
|
26
26
|
end
|
27
|
+
|
28
|
+
def CukeParser.json_complete(file_path,cuke_data,env_data)
|
29
|
+
json_parser = ParseEngine::JsonParser.new
|
30
|
+
json_parser.get_complete_build(file_path,cuke_data,env_data)
|
31
|
+
end
|
32
|
+
|
27
33
|
|
28
34
|
def CukeParser.json_jenkins_list(file_path,timestamp)
|
29
35
|
json_parser = ParseEngine::JsonParser.new
|
@@ -18,12 +18,29 @@ module CukeParser
|
|
18
18
|
time = today.to_s.split(" ")[1]
|
19
19
|
time.gsub!(":","-")
|
20
20
|
@cur_build = CukeModel::CukeSuite.new(date,time,today,nil,nil,nil,nil,nil)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
return parse_build(file_path)
|
22
|
+
else
|
23
|
+
#nothing was found
|
24
|
+
return false
|
25
|
+
end
|
26
26
|
end
|
27
|
+
|
28
|
+
def get_complete_build(file_path,cuke_data,env_data)
|
29
|
+
cuke_file_path = file_path + "/" + cuke_data + ".json"
|
30
|
+
system_data_file_path = file_path + "/" + env_data + ".json"
|
31
|
+
if File.exists?(cuke_file_path) and File.exists?(system_data_file_path)
|
32
|
+
today = Time.now
|
33
|
+
date = today.to_s.split(" ")[0]
|
34
|
+
time = today.to_s.split(" ")[1]
|
35
|
+
time.gsub!(":","-")
|
36
|
+
system_data = JSON.parse(File.read(system_data_file_path))
|
37
|
+
@cur_build = CukeModel::CukeSuite.new(date,time,today,system_data['mobilizer_build_tag'],system_data['mobilizer'],system_data['os'],system_data['url'],system_data['browser'])
|
38
|
+
return parse_build(cuke_file_path)
|
39
|
+
else
|
40
|
+
#nothing was found
|
41
|
+
return false
|
42
|
+
end
|
43
|
+
end
|
27
44
|
|
28
45
|
def parse_build(file_path)
|
29
46
|
document = JSON.parse(File.read(file_path))
|
@@ -122,114 +139,6 @@ module CukeParser
|
|
122
139
|
end
|
123
140
|
end
|
124
141
|
|
125
|
-
#goes through jobs and pulls out performance information from json dumps
|
126
|
-
#requires Pickle Job name, last entry for date_time on that model (so we only pull new data)
|
127
|
-
#Example BuildVerificationTest = BVT (so use BVT when calling from the controller)
|
128
|
-
def get_deprecated(file_path,build_stamp)
|
129
|
-
build_list = []
|
130
|
-
#step through file directory and find cucumber.json
|
131
|
-
dirPath = file_path + "/builds"
|
132
|
-
#dirPath = "C:/Users/cbrachmann/workspace/CukePerformance/app/Performance/builds"
|
133
|
-
dir = @utils.dir_purge(dirPath,build_stamp)
|
134
|
-
if dir.kind_of?(Array)
|
135
|
-
dir.each do |buildFolder|
|
136
|
-
curPath = dirPath + "/" + buildFolder
|
137
|
-
systemDatafilePath = dirPath + "/" + buildFolder + "/archive/systemData.json"
|
138
|
-
filePath = dirPath + "/" + buildFolder + "/archive/cucumber.json"
|
139
|
-
if Dir.exists?(curPath) and File.exists?(systemDatafilePath) and File.exists?(filePath)#get the date time stamp from the name of this directory
|
140
|
-
build = buildFolder.split("_")
|
141
|
-
date = build[0]
|
142
|
-
time = build[1]
|
143
|
-
dateArray = date.split("-")
|
144
|
-
timeArray = time.split("-")
|
145
|
-
dt = []
|
146
|
-
dateArray.each do |d|
|
147
|
-
dt.push(d.to_i)
|
148
|
-
end
|
149
|
-
timeArray.each do |t|
|
150
|
-
dt.push(t.to_i)
|
151
|
-
end
|
152
|
-
runstamp = Time.new(dt[0],dt[1],dt[2],dt[3],dt[4],dt[5])
|
153
|
-
systemDataFile = File.read(systemDatafilePath)
|
154
|
-
systemData = JSON.parse(systemDataFile)
|
155
|
-
#mobilizer_build_tag, mobilizer, os, url, browser
|
156
|
-
current_build = CukeModel::CukeSuite.new(date,time,runstamp,systemData['mobilizer_build_tag'],systemData['mobilizer'],systemData['os'],systemData['url'],systemData['browser'])
|
157
|
-
|
158
|
-
#now we have the cucumber.json file location, lets process it
|
159
|
-
file = File.read(filePath)
|
160
|
-
document = JSON.parse(file)
|
161
|
-
|
162
|
-
feature_list = []
|
163
|
-
featureTotal = 0
|
164
|
-
|
165
|
-
document.each do |feature|
|
166
|
-
current_feature = CukeModel::CukeFeature.new(feature['keyword'],feature['name'])
|
167
|
-
scenarioTotal = 0
|
168
|
-
scenario_list = []
|
169
|
-
feature['elements'].each do |scenario|
|
170
|
-
current_scenario = CukeModel::CukeScenario.new(scenario['keyword'],scenario['name'])
|
171
|
-
stepTotal = 0
|
172
|
-
step_list = []
|
173
|
-
scenario['steps'].each do |step|
|
174
|
-
stepErrorMessage = ''
|
175
|
-
stepFailureImage = ''
|
176
|
-
stepTotal = stepTotal + step['result']['duration']
|
177
|
-
dur = step['result']['duration']
|
178
|
-
convDur = Time.at((dur / 1000000000.00)).gmtime.strftime('%R:%S:%L')
|
179
|
-
if step['result']['status'] == "failed"
|
180
|
-
current_scenario.status = "failed"
|
181
|
-
current_feature.status = "failed"
|
182
|
-
current_build.status = "failed"
|
183
|
-
stepErrorMessage = step['result']['error_message']
|
184
|
-
#failed steps should have an image available:
|
185
|
-
unless step['embeddings'].nil?
|
186
|
-
stepFailureImage = step['embeddings'][0]['data']
|
187
|
-
end
|
188
|
-
end
|
189
|
-
step_list.push(CukeModel::CukeStep.new(step['keyword'],step['name'],dur,convDur,step['result']['status'],stepErrorMessage,stepFailureImage))
|
190
|
-
end
|
191
|
-
if current_scenario.status.empty?
|
192
|
-
#all the steps passed
|
193
|
-
current_scenario.status = "passed"
|
194
|
-
end
|
195
|
-
current_scenario.duration = stepTotal
|
196
|
-
current_scenario.converted_duration = Time.at((stepTotal / 1000000000.00)).gmtime.strftime('%R:%S:%L')
|
197
|
-
current_scenario.steps = step_list
|
198
|
-
scenario_list.push(current_scenario)
|
199
|
-
scenarioTotal = scenarioTotal + stepTotal
|
200
|
-
end
|
201
|
-
if current_feature.status.empty?
|
202
|
-
#all the steps passed
|
203
|
-
current_feature.status = "passed"
|
204
|
-
end
|
205
|
-
current_feature.duration = scenarioTotal
|
206
|
-
current_feature.converted_duration = Time.at((scenarioTotal / 1000000000.00)).gmtime.strftime('%R:%S:%L')
|
207
|
-
current_feature.scenarios = scenario_list
|
208
|
-
feature_list.push(current_feature)
|
209
|
-
featureTotal = featureTotal + scenarioTotal
|
210
|
-
end
|
211
|
-
|
212
|
-
totalTime = 0
|
213
|
-
feature_list.each do |feature|
|
214
|
-
totalTime = totalTime + feature.duration
|
215
|
-
end
|
216
|
-
|
217
|
-
if current_build.status.empty?
|
218
|
-
#all the steps passed
|
219
|
-
current_build.status = "passed"
|
220
|
-
end
|
221
|
-
current_build.duration = totalTime
|
222
|
-
current_build.converted_duration = Time.at(totalTime / 1000000000.00).gmtime.strftime('%R:%S:%L')
|
223
|
-
current_build.features = feature_list
|
224
|
-
build_list.push(current_build)
|
225
|
-
end
|
226
|
-
end
|
227
|
-
return build_list
|
228
|
-
else
|
229
|
-
return false
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
142
|
end #end of JsonParser class
|
234
143
|
end #end of ParseEnginer module
|
235
144
|
end #end CukeParser module
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuke_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
16
|
-
requirement: &
|
16
|
+
requirement: &28417272 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.1.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *28417272
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &28416984 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.4.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *28416984
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: nokogiri
|
38
|
-
requirement: &
|
38
|
+
requirement: &28416708 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.5.9
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *28416708
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &28416432 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.9.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *28416432
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &28416156 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: 2.11.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *28416156
|
69
69
|
description: Library to easily extract information for tracking your Cukes, their
|
70
70
|
overall performance, and generates HTML reports.
|
71
71
|
email: rick.beyer@gmail.com
|
@@ -122,7 +122,7 @@ rubyforge_project:
|
|
122
122
|
rubygems_version: 1.8.16
|
123
123
|
signing_key:
|
124
124
|
specification_version: 3
|
125
|
-
summary: cuke_parser-1.0.
|
125
|
+
summary: cuke_parser-1.0.3
|
126
126
|
test_files:
|
127
127
|
- test/cuke_parser_test.rb
|
128
128
|
- test/json_test.rb
|