cuke_parser 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cuke_model/feature.rb +32 -32
- data/lib/cuke_model/scenario.rb +32 -32
- data/lib/cuke_model/step.rb +33 -33
- data/lib/cuke_model/suite.rb +37 -37
- data/lib/cuke_parser.rb +24 -24
- data/lib/parse_engine/json_parser.rb +237 -237
- data/lib/parse_engine/parser_utils.rb +74 -74
- data/test/builds/2013-04-22_03-01-25/archive/cucumber.json +1 -0
- data/test/builds/2013-04-22_03-01-25/archive/systemData.json +1 -0
- data/test/builds/2013-04-23_03-01-25/archive/cucumber.json +1 -0
- data/test/builds/2013-04-23_03-01-25/archive/systemData.json +1 -0
- data/test/cuke_parser_test.rb +9 -0
- data/test/json_test.rb +41 -0
- data/test/results/json_jenkins_results.txt +11 -0
- data/test/results/json_results.txt +11 -0
- metadata +28 -32
data/lib/cuke_model/feature.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
module CukeParser
|
2
|
-
module CukeModel
|
3
|
-
class CukeFeature
|
4
|
-
#this will store all of our features
|
5
|
-
attr_reader :keyword, :name, :duration, :converted_duration, :scenarios, :status
|
6
|
-
attr_writer :duration, :converted_duration, :scenarios, :status
|
7
|
-
def initialize(keyword, name)
|
8
|
-
@keyword = keyword
|
9
|
-
@name = name
|
10
|
-
@duration = 0
|
11
|
-
@converted_duration = 0
|
12
|
-
@scenarios = []
|
13
|
-
@status = ""
|
14
|
-
end
|
15
|
-
|
16
|
-
def to_csv
|
17
|
-
#prints csv format
|
18
|
-
"#@keyword,#@name,#@duration,#@converted_duration"
|
19
|
-
end
|
20
|
-
|
21
|
-
def to_csv_pretty
|
22
|
-
#prints pretty csv format
|
23
|
-
"\t #@keyword,#@name,#@duration,#@converted_duration"
|
24
|
-
end
|
25
|
-
|
26
|
-
def getFullName
|
27
|
-
#returns keyword + name
|
28
|
-
fullName = @keyword + " " + @name
|
29
|
-
return fullName
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
1
|
+
module CukeParser
|
2
|
+
module CukeModel
|
3
|
+
class CukeFeature
|
4
|
+
#this will store all of our features
|
5
|
+
attr_reader :keyword, :name, :duration, :converted_duration, :scenarios, :status
|
6
|
+
attr_writer :duration, :converted_duration, :scenarios, :status
|
7
|
+
def initialize(keyword, name)
|
8
|
+
@keyword = keyword
|
9
|
+
@name = name
|
10
|
+
@duration = 0
|
11
|
+
@converted_duration = 0
|
12
|
+
@scenarios = []
|
13
|
+
@status = ""
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_csv
|
17
|
+
#prints csv format
|
18
|
+
"#@keyword,#@name,#@duration,#@converted_duration"
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_csv_pretty
|
22
|
+
#prints pretty csv format
|
23
|
+
"\t #@keyword,#@name,#@duration,#@converted_duration"
|
24
|
+
end
|
25
|
+
|
26
|
+
def getFullName
|
27
|
+
#returns keyword + name
|
28
|
+
fullName = @keyword + " " + @name
|
29
|
+
return fullName
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
33
|
end
|
data/lib/cuke_model/scenario.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
module CukeParser
|
2
|
-
module CukeModel
|
3
|
-
class CukeScenario
|
4
|
-
#this will store all the info for a scenario
|
5
|
-
attr_reader :keyword, :name, :duration, :converted_duration, :steps, :status
|
6
|
-
attr_writer :duration, :converted_duration, :steps, :status
|
7
|
-
def initialize(keyword, name)
|
8
|
-
@keyword = keyword
|
9
|
-
@name = name
|
10
|
-
@duration = 0
|
11
|
-
@converted_duration = 0
|
12
|
-
@steps = []
|
13
|
-
@status = ""
|
14
|
-
end
|
15
|
-
|
16
|
-
def to_csv
|
17
|
-
#prints csv format
|
18
|
-
"#@keyword,#@name,#@duration,#@converted_duration"
|
19
|
-
end
|
20
|
-
|
21
|
-
def to_csv_pretty
|
22
|
-
#prints pretty csv format
|
23
|
-
"\t\t #@keyword,#@name,#@duration,#@converted_duration"
|
24
|
-
end
|
25
|
-
|
26
|
-
def getFullName
|
27
|
-
#returns keyword + name
|
28
|
-
fullName = @keyword + " " + @name
|
29
|
-
return fullName
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
1
|
+
module CukeParser
|
2
|
+
module CukeModel
|
3
|
+
class CukeScenario
|
4
|
+
#this will store all the info for a scenario
|
5
|
+
attr_reader :keyword, :name, :duration, :converted_duration, :steps, :status
|
6
|
+
attr_writer :duration, :converted_duration, :steps, :status
|
7
|
+
def initialize(keyword, name)
|
8
|
+
@keyword = keyword
|
9
|
+
@name = name
|
10
|
+
@duration = 0
|
11
|
+
@converted_duration = 0
|
12
|
+
@steps = []
|
13
|
+
@status = ""
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_csv
|
17
|
+
#prints csv format
|
18
|
+
"#@keyword,#@name,#@duration,#@converted_duration"
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_csv_pretty
|
22
|
+
#prints pretty csv format
|
23
|
+
"\t\t #@keyword,#@name,#@duration,#@converted_duration"
|
24
|
+
end
|
25
|
+
|
26
|
+
def getFullName
|
27
|
+
#returns keyword + name
|
28
|
+
fullName = @keyword + " " + @name
|
29
|
+
return fullName
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
33
|
end
|
data/lib/cuke_model/step.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
module CukeParser
|
2
|
-
module CukeModel
|
3
|
-
class CukeStep
|
4
|
-
#this will be where we track step information
|
5
|
-
attr_reader :keyword, :name, :duration, :converted_duration, :status, :reason_for_failure, :failure_image
|
6
|
-
attr_writer :duration, :converted_duration, :status, :reason_for_failure, :failure_image
|
7
|
-
def initialize(keyword, name, duration, converted_duration, status, reason_for_failure, failure_image)
|
8
|
-
@keyword = keyword
|
9
|
-
@name = name
|
10
|
-
@duration = duration
|
11
|
-
@converted_duration = converted_duration
|
12
|
-
@status = status
|
13
|
-
@reason_for_failure = reason_for_failure
|
14
|
-
@failure_image = failure_image
|
15
|
-
end
|
16
|
-
|
17
|
-
def to_csv
|
18
|
-
#prints csv format
|
19
|
-
"#@keyword,#@name,#@duration,#@converted_duration,#@status"
|
20
|
-
end
|
21
|
-
|
22
|
-
def to_csv_pretty
|
23
|
-
#prints pretty csv format
|
24
|
-
"\t\t\t #@keyword,#@name,#@duration,#@converted_duration,#@status"
|
25
|
-
end
|
26
|
-
|
27
|
-
def getFullName
|
28
|
-
#returns keyword + name
|
29
|
-
fullName = @keyword + " " + @name
|
30
|
-
return fullName
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
1
|
+
module CukeParser
|
2
|
+
module CukeModel
|
3
|
+
class CukeStep
|
4
|
+
#this will be where we track step information
|
5
|
+
attr_reader :keyword, :name, :duration, :converted_duration, :status, :reason_for_failure, :failure_image
|
6
|
+
attr_writer :duration, :converted_duration, :status, :reason_for_failure, :failure_image
|
7
|
+
def initialize(keyword, name, duration, converted_duration, status, reason_for_failure, failure_image)
|
8
|
+
@keyword = keyword
|
9
|
+
@name = name
|
10
|
+
@duration = duration
|
11
|
+
@converted_duration = converted_duration
|
12
|
+
@status = status
|
13
|
+
@reason_for_failure = reason_for_failure
|
14
|
+
@failure_image = failure_image
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_csv
|
18
|
+
#prints csv format
|
19
|
+
"#@keyword,#@name,#@duration,#@converted_duration,#@status"
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_csv_pretty
|
23
|
+
#prints pretty csv format
|
24
|
+
"\t\t\t #@keyword,#@name,#@duration,#@converted_duration,#@status"
|
25
|
+
end
|
26
|
+
|
27
|
+
def getFullName
|
28
|
+
#returns keyword + name
|
29
|
+
fullName = @keyword + " " + @name
|
30
|
+
return fullName
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
34
|
end
|
data/lib/cuke_model/suite.rb
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
module CukeParser
|
2
|
-
module CukeModel
|
3
|
-
class CukeSuite
|
4
|
-
#this will store all the elements for a specific feature
|
5
|
-
attr_reader :date, :time, :runstamp, :duration, :converted_duration, :features, :browser, :os, :branch_number, :branch_build_tag, :url, :status
|
6
|
-
attr_writer :duration, :converted_duration, :features, :status, :date, :time
|
7
|
-
def initialize(date, time, runstamp, branch_build_tag, branch_number, os, url, browser)
|
8
|
-
@date = date
|
9
|
-
@time = time
|
10
|
-
@runstamp = runstamp
|
11
|
-
@duration = 0
|
12
|
-
@converted_duration = 0
|
13
|
-
@features = []
|
14
|
-
@browser = browser
|
15
|
-
@os = os
|
16
|
-
@branch_number = branch_number
|
17
|
-
@branch_build_tag = branch_build_tag
|
18
|
-
@url = url
|
19
|
-
@status = ""
|
20
|
-
end
|
21
|
-
|
22
|
-
def to_csv
|
23
|
-
#prints pretty csv format
|
24
|
-
"#@date #@time,#@duration,#@converted_duration,#@browser,#@os,#@branch_number,#@branch_build_tag,#@url,#@status"
|
25
|
-
end
|
26
|
-
|
27
|
-
def to_csv_pretty
|
28
|
-
return self.to_csv
|
29
|
-
end
|
30
|
-
|
31
|
-
def getFullName
|
32
|
-
#returns keyword + name
|
33
|
-
fullName = @date + "_" + @time
|
34
|
-
return fullName
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
1
|
+
module CukeParser
|
2
|
+
module CukeModel
|
3
|
+
class CukeSuite
|
4
|
+
#this will store all the elements for a specific feature
|
5
|
+
attr_reader :date, :time, :runstamp, :duration, :converted_duration, :features, :browser, :os, :branch_number, :branch_build_tag, :url, :status
|
6
|
+
attr_writer :duration, :converted_duration, :features, :status, :date, :time
|
7
|
+
def initialize(date, time, runstamp, branch_build_tag, branch_number, os, url, browser)
|
8
|
+
@date = date
|
9
|
+
@time = time
|
10
|
+
@runstamp = runstamp
|
11
|
+
@duration = 0
|
12
|
+
@converted_duration = 0
|
13
|
+
@features = []
|
14
|
+
@browser = browser
|
15
|
+
@os = os
|
16
|
+
@branch_number = branch_number
|
17
|
+
@branch_build_tag = branch_build_tag
|
18
|
+
@url = url
|
19
|
+
@status = ""
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_csv
|
23
|
+
#prints pretty csv format
|
24
|
+
"#@date #@time,#@duration,#@converted_duration,#@browser,#@os,#@branch_number,#@branch_build_tag,#@url,#@status"
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_csv_pretty
|
28
|
+
return self.to_csv
|
29
|
+
end
|
30
|
+
|
31
|
+
def getFullName
|
32
|
+
#returns keyword + name
|
33
|
+
fullName = @date + "_" + @time
|
34
|
+
return fullName
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
38
|
end
|
data/lib/cuke_parser.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
require 'parse_engine/json_parser.rb'
|
2
|
-
require 'parse_engine/parser_utils.rb'
|
3
|
-
|
4
|
-
module CukeParser
|
5
|
-
|
6
|
-
@json_parser = ParseEngine::JsonParser.new
|
7
|
-
@parser_utils = ParseEngine::ParserUtils.new
|
8
|
-
|
9
|
-
def CukeParser.write_pretty(build,file)
|
10
|
-
@parser_utils.pretty(build,file)
|
11
|
-
end
|
12
|
-
|
13
|
-
def CukeParser.write_build(build,file)
|
14
|
-
@parser_utils.ugly(build,file)
|
15
|
-
end
|
16
|
-
|
17
|
-
def CukeParser.json(file_path)
|
18
|
-
@json_parser.get_build(file_path)
|
19
|
-
end
|
20
|
-
|
21
|
-
def CukeParser.json_jenkins_list(file_path,timestamp)
|
22
|
-
@json_parser.get_jenkins_build_list(file_path,timestamp)
|
23
|
-
end
|
24
|
-
|
1
|
+
require 'parse_engine/json_parser.rb'
|
2
|
+
require 'parse_engine/parser_utils.rb'
|
3
|
+
|
4
|
+
module CukeParser
|
5
|
+
|
6
|
+
@json_parser = ParseEngine::JsonParser.new
|
7
|
+
@parser_utils = ParseEngine::ParserUtils.new
|
8
|
+
|
9
|
+
def CukeParser.write_pretty(build,file)
|
10
|
+
@parser_utils.pretty(build,file)
|
11
|
+
end
|
12
|
+
|
13
|
+
def CukeParser.write_build(build,file)
|
14
|
+
@parser_utils.ugly(build,file)
|
15
|
+
end
|
16
|
+
|
17
|
+
def CukeParser.json(file_path)
|
18
|
+
@json_parser.get_build(file_path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def CukeParser.json_jenkins_list(file_path,timestamp)
|
22
|
+
@json_parser.get_jenkins_build_list(file_path,timestamp)
|
23
|
+
end
|
24
|
+
|
25
25
|
end #end CukeParser module
|
@@ -1,238 +1,238 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'cuke_model/feature.rb'
|
3
|
-
require 'cuke_model/scenario.rb'
|
4
|
-
require 'cuke_model/step.rb'
|
5
|
-
require 'cuke_model/suite.rb'
|
6
|
-
|
7
|
-
module CukeParser
|
8
|
-
module ParseEngine
|
9
|
-
class JsonParser
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
@utils = ParserUtils.new
|
13
|
-
@system_data_path = "/archive/systemData.json"
|
14
|
-
@cuke_data = "/archive/cucumber.json"
|
15
|
-
end
|
16
|
-
|
17
|
-
def get_build(file_path)
|
18
|
-
file_path = file_path + "/cucumber.json"
|
19
|
-
if File.exists?(file_path)
|
20
|
-
today = Time.now
|
21
|
-
date = today.to_s.split(" ")[0]
|
22
|
-
time = today.to_s.split(" ")[1]
|
23
|
-
@cur_build = CukeModel::CukeSuite.new(date,time,today,nil,nil,nil,nil,nil)
|
24
|
-
return parse_build(file_path)
|
25
|
-
else
|
26
|
-
#nothing was found
|
27
|
-
return false
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def parse_build(file_path)
|
32
|
-
document = JSON.parse(File.read(file_path))
|
33
|
-
features = parse_features(document)
|
34
|
-
if @cur_build.status.empty?
|
35
|
-
#all the steps passed
|
36
|
-
@cur_build.status = "passed"
|
37
|
-
end
|
38
|
-
@cur_build.duration = features['duration']
|
39
|
-
@cur_build.converted_duration = @utils.format_time(features['duration'])
|
40
|
-
@cur_build.features = features['list']
|
41
|
-
return @cur_build
|
42
|
-
end
|
43
|
-
|
44
|
-
def parse_features(features)
|
45
|
-
feature_data = Hash['duration', 0, 'list', Array.new]
|
46
|
-
features.each do |feature|
|
47
|
-
@cur_feature = CukeModel::CukeFeature.new(feature['keyword'],feature['name'])
|
48
|
-
scenarios = parse_scenarios(feature['elements'])
|
49
|
-
if @cur_feature.status.empty?
|
50
|
-
#all the steps passed
|
51
|
-
@cur_feature.status = "passed"
|
52
|
-
end
|
53
|
-
@cur_feature.duration = scenarios['duration']
|
54
|
-
@cur_feature.converted_duration = @utils.format_time(scenarios['duration'])
|
55
|
-
@cur_feature.scenarios = scenarios['list']
|
56
|
-
feature_data['list'].push(@cur_feature)
|
57
|
-
feature_data['duration'] = feature_data['duration'] + @cur_feature.duration
|
58
|
-
end
|
59
|
-
return feature_data
|
60
|
-
end
|
61
|
-
|
62
|
-
def parse_scenarios(scenarios)
|
63
|
-
scenario_data = Hash['duration', 0, 'list', Array.new]
|
64
|
-
scenarios.each do |scenario|
|
65
|
-
@cur_scenario = CukeModel::CukeScenario.new(scenario['keyword'],scenario['name'])
|
66
|
-
steps = parse_steps(scenario['steps'])
|
67
|
-
if @cur_scenario.status.empty?
|
68
|
-
#all the steps passed
|
69
|
-
@cur_scenario.status = "passed"
|
70
|
-
end
|
71
|
-
@cur_scenario.duration = steps['duration']
|
72
|
-
@cur_scenario.converted_duration = @utils.format_time(steps['duration'])
|
73
|
-
@cur_scenario.steps = steps['list']
|
74
|
-
scenario_data['list'].push(@cur_scenario)
|
75
|
-
scenario_data['duration'] = scenario_data['duration'] + @cur_scenario.duration
|
76
|
-
end
|
77
|
-
return scenario_data
|
78
|
-
end
|
79
|
-
|
80
|
-
def parse_steps(steps)
|
81
|
-
step_data = Hash['duration', 0, 'list', Array.new]
|
82
|
-
steps.each do |step|
|
83
|
-
stepErrorMessage = ''
|
84
|
-
stepFailureImage = ''
|
85
|
-
step_data['duration'] = step_data['duration'] + step['result']['duration']
|
86
|
-
dur = step['result']['duration']
|
87
|
-
convDur = @utils.format_time(dur)
|
88
|
-
if step['result']['status'] == "failed"
|
89
|
-
@cur_scenario.status = "failed"
|
90
|
-
@cur_feature.status = "failed"
|
91
|
-
@cur_build.status = "failed"
|
92
|
-
stepErrorMessage = step['result']['error_message']
|
93
|
-
#failed steps should have an image available:
|
94
|
-
unless step['embeddings'].nil?
|
95
|
-
stepFailureImage = step['embeddings'][0]['data']
|
96
|
-
end
|
97
|
-
end
|
98
|
-
step_data['list'].push(CukeModel::CukeStep.new(step['keyword'],step['name'],dur,convDur,step['result']['status'],stepErrorMessage,stepFailureImage))
|
99
|
-
end
|
100
|
-
return step_data
|
101
|
-
end
|
102
|
-
|
103
|
-
def get_jenkins_build_list(file_path,build_stamp)
|
104
|
-
build_list = []
|
105
|
-
dir_path = file_path + "/builds"
|
106
|
-
dir = @utils.dir_purge(dir_path,build_stamp)
|
107
|
-
if dir.kind_of?(Array)
|
108
|
-
dir.each do |build_folder|
|
109
|
-
cur_path = dir_path + "/" + build_folder
|
110
|
-
system_data_file_path = cur_path + @system_data_path
|
111
|
-
cuke_file_path = cur_path + @cuke_data
|
112
|
-
if Dir.exists?(cur_path) and File.exists?(system_data_file_path) and File.exists?(cuke_file_path)
|
113
|
-
timestamp = @utils.parse_time(build_folder.split("_"))
|
114
|
-
system_data_file = File.read(system_data_file_path)
|
115
|
-
system_data = JSON.parse(system_data_file)
|
116
|
-
#mobilizer_build_tag, mobilizer, os, url, browser
|
117
|
-
@cur_build = CukeModel::CukeSuite.new(timestamp['date'],timestamp['time'],timestamp['runstamp'],system_data['mobilizer_build_tag'],system_data['mobilizer'],system_data['os'],system_data['url'],system_data['browser'])
|
118
|
-
#now we have the cucumber.json file location, lets process it
|
119
|
-
build_list.push(parse_build(cuke_file_path))
|
120
|
-
end
|
121
|
-
end
|
122
|
-
return build_list
|
123
|
-
else
|
124
|
-
return false
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
#goes through jobs and pulls out performance information from json dumps
|
129
|
-
#requires Pickle Job name, last entry for date_time on that model (so we only pull new data)
|
130
|
-
#Example BuildVerificationTest = BVT (so use BVT when calling from the controller)
|
131
|
-
def get_deprecated(file_path,build_stamp)
|
132
|
-
build_list = []
|
133
|
-
#step through file directory and find cucumber.json
|
134
|
-
dirPath = file_path + "/builds"
|
135
|
-
#dirPath = "C:/Users/cbrachmann/workspace/CukePerformance/app/Performance/builds"
|
136
|
-
dir = @utils.dir_purge(dirPath,build_stamp)
|
137
|
-
if dir.kind_of?(Array)
|
138
|
-
dir.each do |buildFolder|
|
139
|
-
curPath = dirPath + "/" + buildFolder
|
140
|
-
systemDatafilePath = dirPath + "/" + buildFolder + "/archive/systemData.json"
|
141
|
-
filePath = dirPath + "/" + buildFolder + "/archive/cucumber.json"
|
142
|
-
if Dir.exists?(curPath) and File.exists?(systemDatafilePath) and File.exists?(filePath)#get the date time stamp from the name of this directory
|
143
|
-
build = buildFolder.split("_")
|
144
|
-
date = build[0]
|
145
|
-
time = build[1]
|
146
|
-
dateArray = date.split("-")
|
147
|
-
timeArray = time.split("-")
|
148
|
-
dt = []
|
149
|
-
dateArray.each do |d|
|
150
|
-
dt.push(d.to_i)
|
151
|
-
end
|
152
|
-
timeArray.each do |t|
|
153
|
-
dt.push(t.to_i)
|
154
|
-
end
|
155
|
-
runstamp = Time.new(dt[0],dt[1],dt[2],dt[3],dt[4],dt[5])
|
156
|
-
systemDataFile = File.read(systemDatafilePath)
|
157
|
-
systemData = JSON.parse(systemDataFile)
|
158
|
-
#mobilizer_build_tag, mobilizer, os, url, browser
|
159
|
-
current_build = CukeModel::CukeSuite.new(date,time,runstamp,systemData['mobilizer_build_tag'],systemData['mobilizer'],systemData['os'],systemData['url'],systemData['browser'])
|
160
|
-
|
161
|
-
#now we have the cucumber.json file location, lets process it
|
162
|
-
file = File.read(filePath)
|
163
|
-
document = JSON.parse(file)
|
164
|
-
|
165
|
-
feature_list = []
|
166
|
-
featureTotal = 0
|
167
|
-
|
168
|
-
document.each do |feature|
|
169
|
-
current_feature = CukeModel::CukeFeature.new(feature['keyword'],feature['name'])
|
170
|
-
scenarioTotal = 0
|
171
|
-
scenario_list = []
|
172
|
-
feature['elements'].each do |scenario|
|
173
|
-
current_scenario = CukeModel::CukeScenario.new(scenario['keyword'],scenario['name'])
|
174
|
-
stepTotal = 0
|
175
|
-
step_list = []
|
176
|
-
scenario['steps'].each do |step|
|
177
|
-
stepErrorMessage = ''
|
178
|
-
stepFailureImage = ''
|
179
|
-
stepTotal = stepTotal + step['result']['duration']
|
180
|
-
dur = step['result']['duration']
|
181
|
-
convDur = Time.at((dur / 1000000000.00)).gmtime.strftime('%R:%S:%L')
|
182
|
-
if step['result']['status'] == "failed"
|
183
|
-
current_scenario.status = "failed"
|
184
|
-
current_feature.status = "failed"
|
185
|
-
current_build.status = "failed"
|
186
|
-
stepErrorMessage = step['result']['error_message']
|
187
|
-
#failed steps should have an image available:
|
188
|
-
unless step['embeddings'].nil?
|
189
|
-
stepFailureImage = step['embeddings'][0]['data']
|
190
|
-
end
|
191
|
-
end
|
192
|
-
step_list.push(CukeModel::CukeStep.new(step['keyword'],step['name'],dur,convDur,step['result']['status'],stepErrorMessage,stepFailureImage))
|
193
|
-
end
|
194
|
-
if current_scenario.status.empty?
|
195
|
-
#all the steps passed
|
196
|
-
current_scenario.status = "passed"
|
197
|
-
end
|
198
|
-
current_scenario.duration = stepTotal
|
199
|
-
current_scenario.converted_duration = Time.at((stepTotal / 1000000000.00)).gmtime.strftime('%R:%S:%L')
|
200
|
-
current_scenario.steps = step_list
|
201
|
-
scenario_list.push(current_scenario)
|
202
|
-
scenarioTotal = scenarioTotal + stepTotal
|
203
|
-
end
|
204
|
-
if current_feature.status.empty?
|
205
|
-
#all the steps passed
|
206
|
-
current_feature.status = "passed"
|
207
|
-
end
|
208
|
-
current_feature.duration = scenarioTotal
|
209
|
-
current_feature.converted_duration = Time.at((scenarioTotal / 1000000000.00)).gmtime.strftime('%R:%S:%L')
|
210
|
-
current_feature.scenarios = scenario_list
|
211
|
-
feature_list.push(current_feature)
|
212
|
-
featureTotal = featureTotal + scenarioTotal
|
213
|
-
end
|
214
|
-
|
215
|
-
totalTime = 0
|
216
|
-
feature_list.each do |feature|
|
217
|
-
totalTime = totalTime + feature.duration
|
218
|
-
end
|
219
|
-
|
220
|
-
if current_build.status.empty?
|
221
|
-
#all the steps passed
|
222
|
-
current_build.status = "passed"
|
223
|
-
end
|
224
|
-
current_build.duration = totalTime
|
225
|
-
current_build.converted_duration = Time.at(totalTime / 1000000000.00).gmtime.strftime('%R:%S:%L')
|
226
|
-
current_build.features = feature_list
|
227
|
-
build_list.push(current_build)
|
228
|
-
end
|
229
|
-
end
|
230
|
-
return build_list
|
231
|
-
else
|
232
|
-
return false
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
end #end of JsonParser class
|
237
|
-
end #end of ParseEnginer module
|
1
|
+
require 'json'
|
2
|
+
require 'cuke_model/feature.rb'
|
3
|
+
require 'cuke_model/scenario.rb'
|
4
|
+
require 'cuke_model/step.rb'
|
5
|
+
require 'cuke_model/suite.rb'
|
6
|
+
|
7
|
+
module CukeParser
|
8
|
+
module ParseEngine
|
9
|
+
class JsonParser
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@utils = ParserUtils.new
|
13
|
+
@system_data_path = "/archive/systemData.json"
|
14
|
+
@cuke_data = "/archive/cucumber.json"
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_build(file_path)
|
18
|
+
file_path = file_path + "/cucumber.json"
|
19
|
+
if File.exists?(file_path)
|
20
|
+
today = Time.now
|
21
|
+
date = today.to_s.split(" ")[0]
|
22
|
+
time = today.to_s.split(" ")[1]
|
23
|
+
@cur_build = CukeModel::CukeSuite.new(date,time,today,nil,nil,nil,nil,nil)
|
24
|
+
return parse_build(file_path)
|
25
|
+
else
|
26
|
+
#nothing was found
|
27
|
+
return false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def parse_build(file_path)
|
32
|
+
document = JSON.parse(File.read(file_path))
|
33
|
+
features = parse_features(document)
|
34
|
+
if @cur_build.status.empty?
|
35
|
+
#all the steps passed
|
36
|
+
@cur_build.status = "passed"
|
37
|
+
end
|
38
|
+
@cur_build.duration = features['duration']
|
39
|
+
@cur_build.converted_duration = @utils.format_time(features['duration'])
|
40
|
+
@cur_build.features = features['list']
|
41
|
+
return @cur_build
|
42
|
+
end
|
43
|
+
|
44
|
+
def parse_features(features)
|
45
|
+
feature_data = Hash['duration', 0, 'list', Array.new]
|
46
|
+
features.each do |feature|
|
47
|
+
@cur_feature = CukeModel::CukeFeature.new(feature['keyword'],feature['name'])
|
48
|
+
scenarios = parse_scenarios(feature['elements'])
|
49
|
+
if @cur_feature.status.empty?
|
50
|
+
#all the steps passed
|
51
|
+
@cur_feature.status = "passed"
|
52
|
+
end
|
53
|
+
@cur_feature.duration = scenarios['duration']
|
54
|
+
@cur_feature.converted_duration = @utils.format_time(scenarios['duration'])
|
55
|
+
@cur_feature.scenarios = scenarios['list']
|
56
|
+
feature_data['list'].push(@cur_feature)
|
57
|
+
feature_data['duration'] = feature_data['duration'] + @cur_feature.duration
|
58
|
+
end
|
59
|
+
return feature_data
|
60
|
+
end
|
61
|
+
|
62
|
+
def parse_scenarios(scenarios)
|
63
|
+
scenario_data = Hash['duration', 0, 'list', Array.new]
|
64
|
+
scenarios.each do |scenario|
|
65
|
+
@cur_scenario = CukeModel::CukeScenario.new(scenario['keyword'],scenario['name'])
|
66
|
+
steps = parse_steps(scenario['steps'])
|
67
|
+
if @cur_scenario.status.empty?
|
68
|
+
#all the steps passed
|
69
|
+
@cur_scenario.status = "passed"
|
70
|
+
end
|
71
|
+
@cur_scenario.duration = steps['duration']
|
72
|
+
@cur_scenario.converted_duration = @utils.format_time(steps['duration'])
|
73
|
+
@cur_scenario.steps = steps['list']
|
74
|
+
scenario_data['list'].push(@cur_scenario)
|
75
|
+
scenario_data['duration'] = scenario_data['duration'] + @cur_scenario.duration
|
76
|
+
end
|
77
|
+
return scenario_data
|
78
|
+
end
|
79
|
+
|
80
|
+
def parse_steps(steps)
|
81
|
+
step_data = Hash['duration', 0, 'list', Array.new]
|
82
|
+
steps.each do |step|
|
83
|
+
stepErrorMessage = ''
|
84
|
+
stepFailureImage = ''
|
85
|
+
step_data['duration'] = step_data['duration'] + step['result']['duration']
|
86
|
+
dur = step['result']['duration']
|
87
|
+
convDur = @utils.format_time(dur)
|
88
|
+
if step['result']['status'] == "failed"
|
89
|
+
@cur_scenario.status = "failed"
|
90
|
+
@cur_feature.status = "failed"
|
91
|
+
@cur_build.status = "failed"
|
92
|
+
stepErrorMessage = step['result']['error_message']
|
93
|
+
#failed steps should have an image available:
|
94
|
+
unless step['embeddings'].nil?
|
95
|
+
stepFailureImage = step['embeddings'][0]['data']
|
96
|
+
end
|
97
|
+
end
|
98
|
+
step_data['list'].push(CukeModel::CukeStep.new(step['keyword'],step['name'],dur,convDur,step['result']['status'],stepErrorMessage,stepFailureImage))
|
99
|
+
end
|
100
|
+
return step_data
|
101
|
+
end
|
102
|
+
|
103
|
+
def get_jenkins_build_list(file_path,build_stamp)
|
104
|
+
build_list = []
|
105
|
+
dir_path = file_path + "/builds"
|
106
|
+
dir = @utils.dir_purge(dir_path,build_stamp)
|
107
|
+
if dir.kind_of?(Array)
|
108
|
+
dir.each do |build_folder|
|
109
|
+
cur_path = dir_path + "/" + build_folder
|
110
|
+
system_data_file_path = cur_path + @system_data_path
|
111
|
+
cuke_file_path = cur_path + @cuke_data
|
112
|
+
if Dir.exists?(cur_path) and File.exists?(system_data_file_path) and File.exists?(cuke_file_path)
|
113
|
+
timestamp = @utils.parse_time(build_folder.split("_"))
|
114
|
+
system_data_file = File.read(system_data_file_path)
|
115
|
+
system_data = JSON.parse(system_data_file)
|
116
|
+
#mobilizer_build_tag, mobilizer, os, url, browser
|
117
|
+
@cur_build = CukeModel::CukeSuite.new(timestamp['date'],timestamp['time'],timestamp['runstamp'],system_data['mobilizer_build_tag'],system_data['mobilizer'],system_data['os'],system_data['url'],system_data['browser'])
|
118
|
+
#now we have the cucumber.json file location, lets process it
|
119
|
+
build_list.push(parse_build(cuke_file_path))
|
120
|
+
end
|
121
|
+
end
|
122
|
+
return build_list
|
123
|
+
else
|
124
|
+
return false
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
#goes through jobs and pulls out performance information from json dumps
|
129
|
+
#requires Pickle Job name, last entry for date_time on that model (so we only pull new data)
|
130
|
+
#Example BuildVerificationTest = BVT (so use BVT when calling from the controller)
|
131
|
+
def get_deprecated(file_path,build_stamp)
|
132
|
+
build_list = []
|
133
|
+
#step through file directory and find cucumber.json
|
134
|
+
dirPath = file_path + "/builds"
|
135
|
+
#dirPath = "C:/Users/cbrachmann/workspace/CukePerformance/app/Performance/builds"
|
136
|
+
dir = @utils.dir_purge(dirPath,build_stamp)
|
137
|
+
if dir.kind_of?(Array)
|
138
|
+
dir.each do |buildFolder|
|
139
|
+
curPath = dirPath + "/" + buildFolder
|
140
|
+
systemDatafilePath = dirPath + "/" + buildFolder + "/archive/systemData.json"
|
141
|
+
filePath = dirPath + "/" + buildFolder + "/archive/cucumber.json"
|
142
|
+
if Dir.exists?(curPath) and File.exists?(systemDatafilePath) and File.exists?(filePath)#get the date time stamp from the name of this directory
|
143
|
+
build = buildFolder.split("_")
|
144
|
+
date = build[0]
|
145
|
+
time = build[1]
|
146
|
+
dateArray = date.split("-")
|
147
|
+
timeArray = time.split("-")
|
148
|
+
dt = []
|
149
|
+
dateArray.each do |d|
|
150
|
+
dt.push(d.to_i)
|
151
|
+
end
|
152
|
+
timeArray.each do |t|
|
153
|
+
dt.push(t.to_i)
|
154
|
+
end
|
155
|
+
runstamp = Time.new(dt[0],dt[1],dt[2],dt[3],dt[4],dt[5])
|
156
|
+
systemDataFile = File.read(systemDatafilePath)
|
157
|
+
systemData = JSON.parse(systemDataFile)
|
158
|
+
#mobilizer_build_tag, mobilizer, os, url, browser
|
159
|
+
current_build = CukeModel::CukeSuite.new(date,time,runstamp,systemData['mobilizer_build_tag'],systemData['mobilizer'],systemData['os'],systemData['url'],systemData['browser'])
|
160
|
+
|
161
|
+
#now we have the cucumber.json file location, lets process it
|
162
|
+
file = File.read(filePath)
|
163
|
+
document = JSON.parse(file)
|
164
|
+
|
165
|
+
feature_list = []
|
166
|
+
featureTotal = 0
|
167
|
+
|
168
|
+
document.each do |feature|
|
169
|
+
current_feature = CukeModel::CukeFeature.new(feature['keyword'],feature['name'])
|
170
|
+
scenarioTotal = 0
|
171
|
+
scenario_list = []
|
172
|
+
feature['elements'].each do |scenario|
|
173
|
+
current_scenario = CukeModel::CukeScenario.new(scenario['keyword'],scenario['name'])
|
174
|
+
stepTotal = 0
|
175
|
+
step_list = []
|
176
|
+
scenario['steps'].each do |step|
|
177
|
+
stepErrorMessage = ''
|
178
|
+
stepFailureImage = ''
|
179
|
+
stepTotal = stepTotal + step['result']['duration']
|
180
|
+
dur = step['result']['duration']
|
181
|
+
convDur = Time.at((dur / 1000000000.00)).gmtime.strftime('%R:%S:%L')
|
182
|
+
if step['result']['status'] == "failed"
|
183
|
+
current_scenario.status = "failed"
|
184
|
+
current_feature.status = "failed"
|
185
|
+
current_build.status = "failed"
|
186
|
+
stepErrorMessage = step['result']['error_message']
|
187
|
+
#failed steps should have an image available:
|
188
|
+
unless step['embeddings'].nil?
|
189
|
+
stepFailureImage = step['embeddings'][0]['data']
|
190
|
+
end
|
191
|
+
end
|
192
|
+
step_list.push(CukeModel::CukeStep.new(step['keyword'],step['name'],dur,convDur,step['result']['status'],stepErrorMessage,stepFailureImage))
|
193
|
+
end
|
194
|
+
if current_scenario.status.empty?
|
195
|
+
#all the steps passed
|
196
|
+
current_scenario.status = "passed"
|
197
|
+
end
|
198
|
+
current_scenario.duration = stepTotal
|
199
|
+
current_scenario.converted_duration = Time.at((stepTotal / 1000000000.00)).gmtime.strftime('%R:%S:%L')
|
200
|
+
current_scenario.steps = step_list
|
201
|
+
scenario_list.push(current_scenario)
|
202
|
+
scenarioTotal = scenarioTotal + stepTotal
|
203
|
+
end
|
204
|
+
if current_feature.status.empty?
|
205
|
+
#all the steps passed
|
206
|
+
current_feature.status = "passed"
|
207
|
+
end
|
208
|
+
current_feature.duration = scenarioTotal
|
209
|
+
current_feature.converted_duration = Time.at((scenarioTotal / 1000000000.00)).gmtime.strftime('%R:%S:%L')
|
210
|
+
current_feature.scenarios = scenario_list
|
211
|
+
feature_list.push(current_feature)
|
212
|
+
featureTotal = featureTotal + scenarioTotal
|
213
|
+
end
|
214
|
+
|
215
|
+
totalTime = 0
|
216
|
+
feature_list.each do |feature|
|
217
|
+
totalTime = totalTime + feature.duration
|
218
|
+
end
|
219
|
+
|
220
|
+
if current_build.status.empty?
|
221
|
+
#all the steps passed
|
222
|
+
current_build.status = "passed"
|
223
|
+
end
|
224
|
+
current_build.duration = totalTime
|
225
|
+
current_build.converted_duration = Time.at(totalTime / 1000000000.00).gmtime.strftime('%R:%S:%L')
|
226
|
+
current_build.features = feature_list
|
227
|
+
build_list.push(current_build)
|
228
|
+
end
|
229
|
+
end
|
230
|
+
return build_list
|
231
|
+
else
|
232
|
+
return false
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
end #end of JsonParser class
|
237
|
+
end #end of ParseEnginer module
|
238
238
|
end #end CukeParser module
|
@@ -1,75 +1,75 @@
|
|
1
|
-
module CukeParser
|
2
|
-
module ParseEngine
|
3
|
-
class ParserUtils
|
4
|
-
|
5
|
-
def intialize
|
6
|
-
#nothing yet
|
7
|
-
end
|
8
|
-
|
9
|
-
def parse_time(datetime)
|
10
|
-
timestamp = Hash['date', datetime[0], 'time', datetime[1], 'runstamp', 0]
|
11
|
-
dt = []
|
12
|
-
timestamp['date'].split("-").each do |d|
|
13
|
-
dt.push(d.to_i)
|
14
|
-
end
|
15
|
-
timestamp['time'].split("-").each do |t|
|
16
|
-
dt.push(t.to_i)
|
17
|
-
end
|
18
|
-
timestamp['runstamp'] = Time.new(dt[0],dt[1],dt[2],dt[3],dt[4],dt[5])
|
19
|
-
return timestamp
|
20
|
-
end
|
21
|
-
|
22
|
-
def dir_purge(dir_path, build_stamp)
|
23
|
-
#get rid of directories we already have data for
|
24
|
-
drop_num = 2
|
25
|
-
if Dir.exists?(dir_path)
|
26
|
-
dir = Dir.entries(dir_path)
|
27
|
-
if build_stamp != "empty"
|
28
|
-
dir.each do |build_folder|
|
29
|
-
if build_folder <= build_stamp
|
30
|
-
drop_num = dir.index(build_folder) + 1
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
dir = dir.drop(drop_num)
|
35
|
-
return dir
|
36
|
-
else
|
37
|
-
#not a valid directory (does not exist must let App know so User can be notified)
|
38
|
-
return false
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def pretty(build,file)
|
43
|
-
#build is always first line, no indentation needed to make it "pretty"
|
44
|
-
file.puts build.to_csv
|
45
|
-
build.features.each do |feature|
|
46
|
-
file.puts feature.to_csv_pretty
|
47
|
-
feature.scenarios.each do |scenario|
|
48
|
-
file.puts scenario.to_csv_pretty
|
49
|
-
scenario.steps.each do |step|
|
50
|
-
file.puts step.to_csv_pretty
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def ugly(build,file)
|
57
|
-
file.puts build.to_csv
|
58
|
-
build.features.each do |feature|
|
59
|
-
file.puts feature.to_csv
|
60
|
-
feature.scenarios.each do |scenario|
|
61
|
-
file.puts scenario.to_csv
|
62
|
-
scenario.steps.each do |step|
|
63
|
-
file.puts step.to_csv
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def format_time(time)
|
70
|
-
Time.at(time / 1000000000.00).gmtime.strftime('%R:%S:%L')
|
71
|
-
end
|
72
|
-
|
73
|
-
end #end of ParserUtils class
|
74
|
-
end #end of ParseEnginer module
|
1
|
+
module CukeParser
|
2
|
+
module ParseEngine
|
3
|
+
class ParserUtils
|
4
|
+
|
5
|
+
def intialize
|
6
|
+
#nothing yet
|
7
|
+
end
|
8
|
+
|
9
|
+
def parse_time(datetime)
|
10
|
+
timestamp = Hash['date', datetime[0], 'time', datetime[1], 'runstamp', 0]
|
11
|
+
dt = []
|
12
|
+
timestamp['date'].split("-").each do |d|
|
13
|
+
dt.push(d.to_i)
|
14
|
+
end
|
15
|
+
timestamp['time'].split("-").each do |t|
|
16
|
+
dt.push(t.to_i)
|
17
|
+
end
|
18
|
+
timestamp['runstamp'] = Time.new(dt[0],dt[1],dt[2],dt[3],dt[4],dt[5])
|
19
|
+
return timestamp
|
20
|
+
end
|
21
|
+
|
22
|
+
def dir_purge(dir_path, build_stamp)
|
23
|
+
#get rid of directories we already have data for
|
24
|
+
drop_num = 2
|
25
|
+
if Dir.exists?(dir_path)
|
26
|
+
dir = Dir.entries(dir_path)
|
27
|
+
if build_stamp != "empty"
|
28
|
+
dir.each do |build_folder|
|
29
|
+
if build_folder <= build_stamp
|
30
|
+
drop_num = dir.index(build_folder) + 1
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
dir = dir.drop(drop_num)
|
35
|
+
return dir
|
36
|
+
else
|
37
|
+
#not a valid directory (does not exist must let App know so User can be notified)
|
38
|
+
return false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def pretty(build,file)
|
43
|
+
#build is always first line, no indentation needed to make it "pretty"
|
44
|
+
file.puts build.to_csv
|
45
|
+
build.features.each do |feature|
|
46
|
+
file.puts feature.to_csv_pretty
|
47
|
+
feature.scenarios.each do |scenario|
|
48
|
+
file.puts scenario.to_csv_pretty
|
49
|
+
scenario.steps.each do |step|
|
50
|
+
file.puts step.to_csv_pretty
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def ugly(build,file)
|
57
|
+
file.puts build.to_csv
|
58
|
+
build.features.each do |feature|
|
59
|
+
file.puts feature.to_csv
|
60
|
+
feature.scenarios.each do |scenario|
|
61
|
+
file.puts scenario.to_csv
|
62
|
+
scenario.steps.each do |step|
|
63
|
+
file.puts step.to_csv
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def format_time(time)
|
70
|
+
Time.at(time / 1000000000.00).gmtime.strftime('%R:%S:%L')
|
71
|
+
end
|
72
|
+
|
73
|
+
end #end of ParserUtils class
|
74
|
+
end #end of ParseEnginer module
|
75
75
|
end#end of CukeParser Module
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"keyword":"Feature","name":"Rick Test","line":1,"description":"","id":"rick-test","uri":"features\\Rick.feature","elements":[{"keyword":"Background","name":"","line":3,"description":"","type":"background","steps":[{"keyword":"Given ","name":"numbers \"46\" and \"2\"","line":4,"match":{"arguments":[{"offset":9,"val":"46"},{"offset":18,"val":"2"}],"location":"features/step_definitions/Global_steps.rb:1070"},"result":{"status":"passed","duration":2000000}},{"keyword":"And ","name":"I multiply them","line":5,"match":{"location":"features/step_definitions/Global_steps.rb:1074"},"result":{"status":"passed","duration":0}}]},{"keyword":"Scenario","name":"Add Two Numbers","line":8,"description":"","tags":[{"name":"@cuke_parser","line":7}],"id":"rick-test;add-two-numbers","type":"scenario","steps":[{"keyword":"Given ","name":"numbers \"46\" and \"2\"","line":4,"match":{"arguments":[{"offset":9,"val":"46"},{"offset":18,"val":"2"}],"location":"features/step_definitions/Global_steps.rb:1070"},"result":{"status":"passed","duration":1000000}},{"keyword":"And ","name":"I multiply them","line":5,"match":{"location":"features/step_definitions/Global_steps.rb:1074"},"result":{"status":"passed","duration":0}},{"keyword":"Given ","name":"two numbers \"46\" and \"2\"","line":9,"match":{"arguments":[{"offset":13,"val":"46"},{"offset":22,"val":"2"}],"location":"features/step_definitions/Global_steps.rb:1078"},"result":{"status":"passed","duration":1000000}},{"keyword":"When ","name":"I add them","line":10,"match":{"location":"features/step_definitions/Global_steps.rb:1083"},"result":{"status":"passed","duration":0}},{"keyword":"Then ","name":"result is \"48\"","line":11,"match":{"arguments":[{"offset":11,"val":"48"}],"location":"features/step_definitions/Global_steps.rb:1087"},"result":{"status":"passed","duration":17000000}}]}]}]
|
@@ -0,0 +1 @@
|
|
1
|
+
{"browser":"firefox","os":"Windows_NT","mobilizer":"0.0.5","mobilizer_build_tag":"cuke_parser-0.0.5","url":"https://rubygems.org/gems/cuke_parser"}
|
@@ -0,0 +1 @@
|
|
1
|
+
[{"keyword":"Feature","name":"Rick Test","line":1,"description":"","id":"rick-test","uri":"features\\Rick.feature","elements":[{"keyword":"Background","name":"","line":3,"description":"","type":"background","steps":[{"keyword":"Given ","name":"numbers \"46\" and \"2\"","line":4,"match":{"arguments":[{"offset":9,"val":"46"},{"offset":18,"val":"2"}],"location":"features/step_definitions/Global_steps.rb:1070"},"result":{"status":"passed","duration":2000000}},{"keyword":"And ","name":"I multiply them","line":5,"match":{"location":"features/step_definitions/Global_steps.rb:1074"},"result":{"status":"passed","duration":0}}]},{"keyword":"Scenario","name":"Add Two Numbers","line":8,"description":"","tags":[{"name":"@cuke_parser","line":7}],"id":"rick-test;add-two-numbers","type":"scenario","steps":[{"keyword":"Given ","name":"numbers \"46\" and \"2\"","line":4,"match":{"arguments":[{"offset":9,"val":"46"},{"offset":18,"val":"2"}],"location":"features/step_definitions/Global_steps.rb:1070"},"result":{"status":"passed","duration":1000000}},{"keyword":"And ","name":"I multiply them","line":5,"match":{"location":"features/step_definitions/Global_steps.rb:1074"},"result":{"status":"passed","duration":0}},{"keyword":"Given ","name":"two numbers \"46\" and \"2\"","line":9,"match":{"arguments":[{"offset":13,"val":"46"},{"offset":22,"val":"2"}],"location":"features/step_definitions/Global_steps.rb:1078"},"result":{"status":"passed","duration":1000000}},{"keyword":"When ","name":"I add them","line":10,"match":{"location":"features/step_definitions/Global_steps.rb:1083"},"result":{"status":"passed","duration":0}},{"keyword":"Then ","name":"result is \"48\"","line":11,"match":{"arguments":[{"offset":11,"val":"48"}],"location":"features/step_definitions/Global_steps.rb:1087"},"result":{"status":"passed","duration":17000000}}]}]}]
|
@@ -0,0 +1 @@
|
|
1
|
+
{"browser":"firefox","os":"Windows_NT","mobilizer":"0.0.5","mobilizer_build_tag":"cuke_parser-0.0.5","url":"https://rubygems.org/gems/cuke_parser"}
|
data/test/json_test.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'cuke_parser'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'rspec'
|
4
|
+
|
5
|
+
module CukeParserTest
|
6
|
+
|
7
|
+
class JsonTest
|
8
|
+
|
9
|
+
include RSpec::Matchers
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
Dir.chdir("./test")
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_json_jenkins_list
|
16
|
+
timestamp = "2013-04-22_03-01-25"
|
17
|
+
location = "."
|
18
|
+
result = CukeParser.json_jenkins_list(location,timestamp)
|
19
|
+
output = File.open("result.txt","w+")
|
20
|
+
result.each do |build|
|
21
|
+
CukeParser.write_build(build,output)
|
22
|
+
end
|
23
|
+
output.close
|
24
|
+
FileUtils.compare_file("result.txt","./results/json_jenkins_results.txt").should be_true
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_json
|
28
|
+
location = "./builds/2013-04-23_03-01-25/archive"
|
29
|
+
result = CukeParser.json(location)
|
30
|
+
#we need to overwrite the date because get_json_build just grabs Time.now as the date
|
31
|
+
result.date = "2013-04-23"
|
32
|
+
result.time = "03-01-25"
|
33
|
+
#write our results to a text file
|
34
|
+
output = File.open("result.txt","w+")
|
35
|
+
CukeParser.write_build(result,output)
|
36
|
+
output.close
|
37
|
+
FileUtils.compare_file("result.txt","./results/json_results.txt").should be_true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
2013-04-23 03-01-25,21000000,00:00:00:021,firefox,Windows_NT,0.0.5,cuke_parser-0.0.5,https://rubygems.org/gems/cuke_parser,passed
|
2
|
+
Feature,Rick Test,21000000,00:00:00:021
|
3
|
+
Background,,2000000,00:00:00:002
|
4
|
+
Given ,numbers "46" and "2",2000000,00:00:00:002,passed
|
5
|
+
And ,I multiply them,0,00:00:00:000,passed
|
6
|
+
Scenario,Add Two Numbers,19000000,00:00:00:018
|
7
|
+
Given ,numbers "46" and "2",1000000,00:00:00:001,passed
|
8
|
+
And ,I multiply them,0,00:00:00:000,passed
|
9
|
+
Given ,two numbers "46" and "2",1000000,00:00:00:001,passed
|
10
|
+
When ,I add them,0,00:00:00:000,passed
|
11
|
+
Then ,result is "48",17000000,00:00:00:017,passed
|
@@ -0,0 +1,11 @@
|
|
1
|
+
2013-04-23 03-01-25,21000000,00:00:00:021,,,,,,passed
|
2
|
+
Feature,Rick Test,21000000,00:00:00:021
|
3
|
+
Background,,2000000,00:00:00:002
|
4
|
+
Given ,numbers "46" and "2",2000000,00:00:00:002,passed
|
5
|
+
And ,I multiply them,0,00:00:00:000,passed
|
6
|
+
Scenario,Add Two Numbers,19000000,00:00:00:018
|
7
|
+
Given ,numbers "46" and "2",1000000,00:00:00:001,passed
|
8
|
+
And ,I multiply them,0,00:00:00:000,passed
|
9
|
+
Given ,two numbers "46" and "2",1000000,00:00:00:001,passed
|
10
|
+
When ,I add them,0,00:00:00:000,passed
|
11
|
+
Then ,result is "48",17000000,00:00:00:017,passed
|
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: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-04-27 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &26605152 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.1.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 2.1.2
|
24
|
+
version_requirements: *26605152
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: json
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &26625204 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: 1.4.6
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.4.6
|
35
|
+
version_requirements: *26625204
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: rake
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &26624712 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,15 +43,10 @@ dependencies:
|
|
53
43
|
version: 0.9.2
|
54
44
|
type: :development
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.9.2
|
46
|
+
version_requirements: *26624712
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: rspec
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &26623416 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ~>
|
@@ -69,12 +54,7 @@ dependencies:
|
|
69
54
|
version: 2.11.0
|
70
55
|
type: :development
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 2.11.0
|
57
|
+
version_requirements: *26623416
|
78
58
|
description: Library to easily pull out information for tracking your Cukes
|
79
59
|
email: rick.beyer@gmail.com
|
80
60
|
executables: []
|
@@ -88,6 +68,14 @@ files:
|
|
88
68
|
- lib/cuke_parser.rb
|
89
69
|
- lib/parse_engine/json_parser.rb
|
90
70
|
- lib/parse_engine/parser_utils.rb
|
71
|
+
- test/cuke_parser_test.rb
|
72
|
+
- test/json_test.rb
|
73
|
+
- test/builds/2013-04-22_03-01-25/archive/cucumber.json
|
74
|
+
- test/builds/2013-04-22_03-01-25/archive/systemData.json
|
75
|
+
- test/builds/2013-04-23_03-01-25/archive/cucumber.json
|
76
|
+
- test/builds/2013-04-23_03-01-25/archive/systemData.json
|
77
|
+
- test/results/json_jenkins_results.txt
|
78
|
+
- test/results/json_results.txt
|
91
79
|
homepage:
|
92
80
|
licenses: []
|
93
81
|
post_install_message:
|
@@ -108,9 +96,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
96
|
version: '0'
|
109
97
|
requirements: []
|
110
98
|
rubyforge_project:
|
111
|
-
rubygems_version: 1.8.
|
99
|
+
rubygems_version: 1.8.16
|
112
100
|
signing_key:
|
113
101
|
specification_version: 3
|
114
|
-
summary: cuke_parser-0.0.
|
115
|
-
test_files:
|
102
|
+
summary: cuke_parser-0.0.5
|
103
|
+
test_files:
|
104
|
+
- test/cuke_parser_test.rb
|
105
|
+
- test/json_test.rb
|
106
|
+
- test/builds/2013-04-22_03-01-25/archive/cucumber.json
|
107
|
+
- test/builds/2013-04-22_03-01-25/archive/systemData.json
|
108
|
+
- test/builds/2013-04-23_03-01-25/archive/cucumber.json
|
109
|
+
- test/builds/2013-04-23_03-01-25/archive/systemData.json
|
110
|
+
- test/results/json_jenkins_results.txt
|
111
|
+
- test/results/json_results.txt
|
116
112
|
has_rdoc:
|