soda 1.3.7 → 1.3.9
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.
- data/bin/SodaSuite +16 -8
- data/lib/Soda.rb +17 -9
- data/lib/SodaSuiteSummary.rb +14 -10
- data/lib/SodaTestCheck.rb +19 -20
- data/lib/SodaUtils.rb +37 -21
- data/lib/SodaXML.rb +20 -19
- data/lib/sodainfo.rb +1 -1
- metadata +4 -18
data/bin/SodaSuite
CHANGED
@@ -34,11 +34,12 @@ require 'rubygems'
|
|
34
34
|
require 'Soda'
|
35
35
|
require 'sodainfo'
|
36
36
|
require 'getoptlong'
|
37
|
-
require 'libxml'
|
38
37
|
require 'watir'
|
39
38
|
require 'SodaReportSummery'
|
40
39
|
require 'SodaSuiteSummary'
|
41
40
|
require 'pp'
|
41
|
+
require 'rexml/document'
|
42
|
+
include REXML
|
42
43
|
|
43
44
|
###############################################################################
|
44
45
|
# SodaSuite -- Class
|
@@ -370,21 +371,26 @@ end
|
|
370
371
|
def ReadConfigFile(configfile)
|
371
372
|
parser = nil
|
372
373
|
doc = nil
|
374
|
+
fd = nil
|
373
375
|
data = {
|
374
376
|
"gvars" => {},
|
375
377
|
"cmdopts" => [],
|
376
378
|
"errorskip" => []
|
377
379
|
}
|
378
380
|
|
379
|
-
|
380
|
-
doc =
|
381
|
+
fd = File.new(configfile)
|
382
|
+
doc = REXML::Document.new(fd)
|
383
|
+
doc = doc.root
|
384
|
+
|
385
|
+
doc.elements.each do |node|
|
386
|
+
attrs = {}
|
387
|
+
node.attributes.each do |k,v|
|
388
|
+
attrs[k] = v
|
389
|
+
end
|
381
390
|
|
382
|
-
doc.root.each do |node|
|
383
|
-
attrs = node.attributes()
|
384
|
-
attrs = attrs.to_h()
|
385
391
|
name = attrs['name']
|
386
|
-
content = node.
|
387
|
-
case node.name
|
392
|
+
content = node.text
|
393
|
+
case (node.name)
|
388
394
|
when "errorskip"
|
389
395
|
data['errorskip'].push("#{attrs['type']}")
|
390
396
|
when "gvar"
|
@@ -399,6 +405,8 @@ def ReadConfigFile(configfile)
|
|
399
405
|
end
|
400
406
|
end
|
401
407
|
|
408
|
+
fd.close()
|
409
|
+
|
402
410
|
return data
|
403
411
|
end
|
404
412
|
|
data/lib/Soda.rb
CHANGED
@@ -60,6 +60,8 @@ require "fields/LiField"
|
|
60
60
|
require 'thread'
|
61
61
|
require 'date'
|
62
62
|
require 'pp'
|
63
|
+
require 'rexml/document'
|
64
|
+
include REXML
|
63
65
|
|
64
66
|
###############################################################################
|
65
67
|
# Soda -- Class
|
@@ -765,7 +767,7 @@ class Soda
|
|
765
767
|
# is_restart: true/false, tells us that this is a restart test.
|
766
768
|
#
|
767
769
|
# Results:
|
768
|
-
# on success returns a
|
770
|
+
# on success returns a XML DOM Document, or nil on error.
|
769
771
|
#
|
770
772
|
###############################################################################
|
771
773
|
def getScript(file, is_restart = false)
|
@@ -2872,6 +2874,7 @@ JSCode
|
|
2872
2874
|
hostname = hostname.chomp()
|
2873
2875
|
|
2874
2876
|
suites.each do |s|
|
2877
|
+
print "SUITE: #{s}\n"
|
2875
2878
|
base_suite_name = File.basename(s)
|
2876
2879
|
if (results.key?(base_suite_name))
|
2877
2880
|
suite_dup_id = 1
|
@@ -2945,14 +2948,15 @@ JSCode
|
|
2945
2948
|
result = {}
|
2946
2949
|
tests = []
|
2947
2950
|
suite_name = File.basename(suitefile, ".xml")
|
2948
|
-
|
2951
|
+
|
2952
|
+
print "Running Suite: #{suitefile}\n"
|
2953
|
+
|
2949
2954
|
begin
|
2950
|
-
|
2951
|
-
|
2952
|
-
doc =
|
2953
|
-
doc = doc.root()
|
2955
|
+
fd = File.new(suitefile)
|
2956
|
+
doc = REXML::Document.new(fd)
|
2957
|
+
doc = doc.root
|
2954
2958
|
|
2955
|
-
doc.each do |node|
|
2959
|
+
doc.elements.each do |node|
|
2956
2960
|
next if (node.name =~ /text/i)
|
2957
2961
|
next if (node.name =~ /comment/i)
|
2958
2962
|
|
@@ -2961,8 +2965,10 @@ JSCode
|
|
2961
2965
|
" in suite file: '#{suitefile}'!"
|
2962
2966
|
end
|
2963
2967
|
|
2964
|
-
attrs =
|
2965
|
-
|
2968
|
+
attrs = {}
|
2969
|
+
node.attributes.each do |k,v|
|
2970
|
+
attrs[k] = "#{v}"
|
2971
|
+
end
|
2966
2972
|
|
2967
2973
|
if (attrs.key?('file'))
|
2968
2974
|
tests.push(attrs['file'])
|
@@ -2974,6 +2980,8 @@ JSCode
|
|
2974
2980
|
end
|
2975
2981
|
end
|
2976
2982
|
end
|
2983
|
+
|
2984
|
+
fd.close()
|
2977
2985
|
rescue Exception => e
|
2978
2986
|
SodaUtils.PrintSoda(e.message, SodaUtils::ERROR)
|
2979
2987
|
err_hash = {
|
data/lib/SodaSuiteSummary.rb
CHANGED
@@ -31,9 +31,10 @@
|
|
31
31
|
require 'rubygems'
|
32
32
|
require 'getoptlong'
|
33
33
|
require 'date'
|
34
|
-
require 'libxml'
|
35
34
|
require 'pp'
|
36
35
|
require 'SodaReportSummery'
|
36
|
+
require 'rexml/document'
|
37
|
+
include REXML
|
37
38
|
|
38
39
|
$HTML_HEADER = <<HTML
|
39
40
|
<html>
|
@@ -688,7 +689,7 @@ def GetTestInfo(kids)
|
|
688
689
|
next if (kid.name =~ /text/i)
|
689
690
|
name = kid.name
|
690
691
|
name = name.gsub("_", " ")
|
691
|
-
test_info[name] = kid.
|
692
|
+
test_info[name] = kid.text
|
692
693
|
end
|
693
694
|
|
694
695
|
return test_info
|
@@ -708,14 +709,15 @@ end
|
|
708
709
|
def GenerateReportData(files)
|
709
710
|
test_info = {}
|
710
711
|
test_info_list = []
|
712
|
+
fd = nil
|
711
713
|
|
712
714
|
files.each do |f|
|
713
715
|
print "(*)Reading XML file: #{f}\n"
|
714
716
|
|
715
717
|
begin
|
716
|
-
|
717
|
-
|
718
|
-
doc =
|
718
|
+
fd = File.new(f)
|
719
|
+
doc = REXML::Document.new(fd)
|
720
|
+
doc = doc.root
|
719
721
|
rescue Exception => e
|
720
722
|
print "(!)Error: Failed trying to parse XML file: '#{f}'!\n"
|
721
723
|
print "--)Exception: #{e.message}\n"
|
@@ -725,22 +727,22 @@ def GenerateReportData(files)
|
|
725
727
|
end
|
726
728
|
|
727
729
|
suites = []
|
728
|
-
doc.
|
730
|
+
doc.elements.each do |suite|
|
729
731
|
next if (suite.name !~ /suite/)
|
730
732
|
suites.push(suite)
|
731
733
|
end
|
732
734
|
|
733
735
|
suites.each do |suite|
|
734
736
|
tmp_hash = {'tests' => []}
|
735
|
-
suite.
|
737
|
+
suite.elements.each do |kid|
|
736
738
|
case (kid.name)
|
737
739
|
when "suitefile"
|
738
|
-
tmp_hash['suitefile'] = kid.
|
740
|
+
tmp_hash['suitefile'] = kid.text
|
739
741
|
when "test"
|
740
|
-
tmp_test_data = GetTestInfo(kid.
|
742
|
+
tmp_test_data = GetTestInfo(kid.elements)
|
741
743
|
tmp_hash['tests'].push(tmp_test_data)
|
742
744
|
else
|
743
|
-
tmp_hash[kid.name] = kid.
|
745
|
+
tmp_hash[kid.name] = kid.text
|
744
746
|
end # end case #
|
745
747
|
end
|
746
748
|
|
@@ -752,6 +754,8 @@ def GenerateReportData(files)
|
|
752
754
|
print "(*)Finished.\n"
|
753
755
|
end
|
754
756
|
|
757
|
+
fd.close()
|
758
|
+
|
755
759
|
return test_info
|
756
760
|
end
|
757
761
|
private :GenerateReportData
|
data/lib/SodaTestCheck.rb
CHANGED
@@ -31,7 +31,6 @@
|
|
31
31
|
require 'rubygems'
|
32
32
|
require 'getoptlong'
|
33
33
|
require 'digest/md5'
|
34
|
-
require 'libxml'
|
35
34
|
require 'SodaXML'
|
36
35
|
require 'SodaUtils'
|
37
36
|
|
@@ -111,19 +110,20 @@ class SodaTestCheck
|
|
111
110
|
parser = nil
|
112
111
|
doc = nil
|
113
112
|
kids = nil
|
113
|
+
fd = nil
|
114
114
|
|
115
115
|
begin
|
116
|
-
|
117
|
-
|
118
|
-
doc =
|
116
|
+
fd = File.new(@SODA_ELEMENTS_FILE)
|
117
|
+
doc = REXML::Document.new(fd)
|
118
|
+
doc = doc.root
|
119
119
|
rescue Exception => e
|
120
120
|
doc = nil
|
121
|
-
@report.ReportException(e,
|
121
|
+
@report.ReportException(e, @sodatest)
|
122
122
|
ensure
|
123
123
|
end
|
124
124
|
|
125
125
|
return nil if (doc == nil)
|
126
|
-
return doc
|
126
|
+
return doc
|
127
127
|
end
|
128
128
|
###############################################################################
|
129
129
|
# ElementsXMLToData -- method
|
@@ -140,49 +140,48 @@ class SodaTestCheck
|
|
140
140
|
elements = {}
|
141
141
|
kids = nil
|
142
142
|
|
143
|
-
if (!node.
|
143
|
+
if (!node.has_elements?)
|
144
144
|
return {}
|
145
145
|
end
|
146
146
|
|
147
|
-
kids = node.
|
147
|
+
kids = node.elements()
|
148
148
|
kids.each do |kid|
|
149
|
-
next if ( (kid.name == "text")
|
150
|
-
|
149
|
+
next if ( (kid.name == "text") )
|
151
150
|
elements[kid.name] = Hash.new()
|
152
151
|
elements[kid.name]['accessor_attributes'] = []
|
153
152
|
elements[kid.name]['soda_attributes'] = []
|
154
153
|
|
155
|
-
elems = kid.
|
154
|
+
elems = kid.elements()
|
156
155
|
elems.each do |e|
|
157
156
|
case (e.name)
|
158
157
|
when "accessor_attributes"
|
159
|
-
access_kids = e.
|
158
|
+
access_kids = e.elements()
|
160
159
|
access_kids.each do |access|
|
161
160
|
next if (access.name == "text")
|
162
|
-
elements[kid.name]["accessor_attributes"].push(access.
|
161
|
+
elements[kid.name]["accessor_attributes"].push(access.text)
|
163
162
|
end
|
164
163
|
when "soda_attributes"
|
165
|
-
access_kids = e.
|
164
|
+
access_kids = e.elements()
|
166
165
|
access_kids.each do |access|
|
167
166
|
next if (access.name == "text")
|
168
167
|
|
169
168
|
if (access.name =~ /accessor/)
|
170
169
|
elements[kid.name]["soda_attributes"].push(
|
171
|
-
access.
|
170
|
+
access.text)
|
172
171
|
end
|
173
172
|
|
174
|
-
if (access.
|
175
|
-
access_kids = access.
|
173
|
+
if (access.has_elements?)
|
174
|
+
access_kids = access.elements()
|
176
175
|
tmp_hash = {}
|
177
176
|
tmp_hash[access.name] = []
|
178
177
|
access_kids.each do |access_kid|
|
179
178
|
next if (access_kid.name == "text")
|
180
|
-
tmp_hash[access.name].push(access_kid.
|
179
|
+
tmp_hash[access.name].push(access_kid.text)
|
181
180
|
end
|
182
181
|
elements[kid.name]["soda_attributes"].push(tmp_hash)
|
183
182
|
else
|
184
183
|
elements[kid.name]["soda_attributes"].push(
|
185
|
-
access.
|
184
|
+
access.text)
|
186
185
|
end
|
187
186
|
end
|
188
187
|
end
|
@@ -234,7 +233,7 @@ class SodaTestCheck
|
|
234
233
|
#
|
235
234
|
###############################################################################
|
236
235
|
def CheckTest(sodadata, supported)
|
237
|
-
|
236
|
+
|
238
237
|
sodadata.each do |test_hash|
|
239
238
|
if (!test_hash.key?('do'))
|
240
239
|
@report.ReportFailure("Failed to find expected test do "+
|
data/lib/SodaUtils.rb
CHANGED
@@ -31,8 +31,9 @@
|
|
31
31
|
require 'rbconfig'
|
32
32
|
require 'time'
|
33
33
|
require 'rubygems'
|
34
|
-
require 'libxml'
|
35
34
|
require 'uri'
|
35
|
+
require 'rexml/document'
|
36
|
+
include REXML
|
36
37
|
|
37
38
|
###############################################################################
|
38
39
|
# SodaUtils -- Module
|
@@ -105,11 +106,13 @@ JS
|
|
105
106
|
def SodaUtils.GetOsType
|
106
107
|
os = ""
|
107
108
|
|
108
|
-
if Config::CONFIG['host_os'] =~ /mswin/i
|
109
|
+
if (Config::CONFIG['host_os'] =~ /mswin/i)
|
109
110
|
os = "WINDOWS"
|
110
|
-
elsif Config::CONFIG['host_os'] =~ /
|
111
|
+
elsif (Config::CONFIG['host_os'] =~ /mingw32/i)
|
112
|
+
os = "WINDOWS"
|
113
|
+
elsif (Config::CONFIG['host_os'] =~ /linux/i)
|
111
114
|
os = "LINUX"
|
112
|
-
elsif Config::CONFIG['host_os'] =~ /darwin/i
|
115
|
+
elsif (Config::CONFIG['host_os'] =~ /darwin/i)
|
113
116
|
os = "OSX"
|
114
117
|
else
|
115
118
|
os = Config::CONFIG['host_os'];
|
@@ -345,10 +348,12 @@ def SodaUtils.ParseBlockFile(block_file)
|
|
345
348
|
error = false
|
346
349
|
data = []
|
347
350
|
doc = nil
|
351
|
+
fd = nil
|
348
352
|
|
349
353
|
begin
|
350
|
-
|
351
|
-
doc =
|
354
|
+
fd = File.new(block_file)
|
355
|
+
doc = REXML::Document.new(fd)
|
356
|
+
doc = doc.root
|
352
357
|
rescue Exception => e
|
353
358
|
error = true
|
354
359
|
data = []
|
@@ -360,17 +365,18 @@ def SodaUtils.ParseBlockFile(block_file)
|
|
360
365
|
end
|
361
366
|
end
|
362
367
|
|
363
|
-
doc.
|
368
|
+
doc.elements.each do |node|
|
364
369
|
hash = Hash.new
|
365
370
|
|
366
371
|
if (node.name != "block")
|
367
372
|
next
|
368
373
|
end
|
369
374
|
|
370
|
-
|
371
|
-
hash[child.name] =
|
375
|
+
node.elements.each do |child|
|
376
|
+
hash[child.name] = child.text
|
372
377
|
end
|
373
378
|
|
379
|
+
|
374
380
|
if (hash['testfile'].empty?)
|
375
381
|
next
|
376
382
|
end
|
@@ -378,6 +384,8 @@ def SodaUtils.ParseBlockFile(block_file)
|
|
378
384
|
data.push(hash)
|
379
385
|
end
|
380
386
|
|
387
|
+
fd.close() if (fd != nil)
|
388
|
+
|
381
389
|
return data
|
382
390
|
end
|
383
391
|
|
@@ -397,10 +405,12 @@ def SodaUtils.ParseWhiteFile(white_file)
|
|
397
405
|
error = false
|
398
406
|
data = []
|
399
407
|
doc = nil
|
408
|
+
fd = nil
|
400
409
|
|
401
410
|
begin
|
402
|
-
|
403
|
-
doc =
|
411
|
+
fd = File.new(white_file)
|
412
|
+
doc = REXML::Document.new(fd)
|
413
|
+
doc = doc.root
|
404
414
|
rescue Exception => e
|
405
415
|
error = true
|
406
416
|
data = []
|
@@ -412,20 +422,22 @@ def SodaUtils.ParseWhiteFile(white_file)
|
|
412
422
|
end
|
413
423
|
end
|
414
424
|
|
415
|
-
doc.
|
425
|
+
doc.elements.each do |node|
|
416
426
|
hash = Hash.new
|
417
427
|
|
418
428
|
if (node.name != "white")
|
419
429
|
next
|
420
430
|
end
|
421
431
|
|
422
|
-
|
423
|
-
hash[child.name] =
|
432
|
+
node.elements.each do |child|
|
433
|
+
hash[child.name] = child.text
|
424
434
|
end
|
425
435
|
|
426
436
|
data.push(hash)
|
427
437
|
end
|
428
438
|
|
439
|
+
fd.close() if (fd != nil)
|
440
|
+
|
429
441
|
return data
|
430
442
|
end
|
431
443
|
|
@@ -663,21 +675,25 @@ end
|
|
663
675
|
def SodaUtils.ReadSodaConfig(configfile)
|
664
676
|
parser = nil
|
665
677
|
doc = nil
|
678
|
+
fd = nil
|
666
679
|
data = {
|
667
680
|
"gvars" => {},
|
668
681
|
"cmdopts" => [],
|
669
682
|
"errorskip" => []
|
670
683
|
}
|
671
684
|
|
672
|
-
|
673
|
-
doc =
|
685
|
+
fd = File.new(white_file)
|
686
|
+
doc = REXML::Document.new(fd)
|
687
|
+
doc = doc.root
|
688
|
+
doc.elements.each do |node|
|
689
|
+
attrs = {}
|
690
|
+
node.attributes.each do |k,v|
|
691
|
+
attrs[k] = "#{v}"
|
692
|
+
end
|
674
693
|
|
675
|
-
doc.root.each do |node|
|
676
|
-
attrs = node.attributes()
|
677
|
-
attrs = attrs.to_h()
|
678
694
|
name = attrs['name']
|
679
|
-
content = node.
|
680
|
-
case node.name
|
695
|
+
content = node.text
|
696
|
+
case (node.name)
|
681
697
|
when "errorskip"
|
682
698
|
data['errorskip'].push("#{attrs['type']}")
|
683
699
|
when "gvar"
|
data/lib/SodaXML.rb
CHANGED
@@ -28,9 +28,9 @@
|
|
28
28
|
###############################################################################
|
29
29
|
# Needed Ruby libs:
|
30
30
|
###############################################################################
|
31
|
-
require '
|
32
|
-
require 'libxml'
|
31
|
+
require 'rexml/document'
|
33
32
|
require 'SodaUtils'
|
33
|
+
include REXML
|
34
34
|
|
35
35
|
###############################################################################
|
36
36
|
# SodaXML -- Class
|
@@ -57,32 +57,32 @@ class SodaXML
|
|
57
57
|
###############################################################################
|
58
58
|
def processChildren(node)
|
59
59
|
children = []
|
60
|
-
|
61
|
-
|
60
|
+
|
61
|
+
node.elements.each do |child|
|
62
62
|
if (child.name == 'text')
|
63
63
|
next
|
64
64
|
end
|
65
65
|
|
66
66
|
cur = Hash.new()
|
67
|
-
cur['line_number'] =
|
67
|
+
cur['line_number'] = 0
|
68
68
|
cur['do'] = "#{child.name}"
|
69
69
|
|
70
|
-
case child.name
|
70
|
+
case (child.name)
|
71
71
|
when /javascript/i
|
72
|
-
cur['content'] = child.
|
72
|
+
cur['content'] = child.text
|
73
73
|
when /ruby/i
|
74
|
-
cur['content'] = child.
|
74
|
+
cur['content'] = child.text
|
75
75
|
when /comment/i
|
76
|
-
cur['content'] = child.
|
76
|
+
cur['content'] = child.text
|
77
77
|
when /whitelist/i
|
78
|
-
cur['content'] = child.
|
78
|
+
cur['content'] = child.text
|
79
79
|
end
|
80
80
|
|
81
|
-
child.attributes.each do |
|
82
|
-
cur[
|
81
|
+
child.attributes.each do |k,v|
|
82
|
+
cur[k] = "#{v}"
|
83
83
|
end
|
84
84
|
|
85
|
-
if child.
|
85
|
+
if child.has_elements?()
|
86
86
|
cur['children'] = self.processChildren(child)
|
87
87
|
end
|
88
88
|
|
@@ -107,16 +107,17 @@ class SodaXML
|
|
107
107
|
data = nil
|
108
108
|
parser = nil
|
109
109
|
doc = nil
|
110
|
-
|
110
|
+
fd = nil
|
111
|
+
|
111
112
|
begin
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
113
|
+
fd = File.new(file)
|
114
|
+
doc = REXML::Document.new(fd)
|
115
|
+
data = processChildren(doc.root)
|
116
|
+
fd.close()
|
116
117
|
rescue Exception => e
|
117
118
|
$curSoda.rep.log("Failed to parse XML file: \"#{file}\"!\n",
|
118
119
|
SodaUtils::ERROR)
|
119
|
-
$curSoda.rep.ReportException(e,
|
120
|
+
$curSoda.rep.ReportException(e, file)
|
120
121
|
|
121
122
|
data = nil
|
122
123
|
ensure
|
data/lib/sodainfo.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 9
|
10
|
+
version: 1.3.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Trampus Richmond
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: firewatir
|
@@ -33,20 +33,6 @@ dependencies:
|
|
33
33
|
version: 1.8.0
|
34
34
|
type: :runtime
|
35
35
|
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: libxml-ruby
|
38
|
-
prerelease: false
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 3
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
48
|
-
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
36
|
description: This is a wrapper around the watir api for web testing.
|
51
37
|
email: trichmond@sugarcrm.com
|
52
38
|
executables:
|