coba-testrunner 0.0.3 → 0.0.4
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/bin/coba +41 -1
- data/lib/coba-testrunner.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: afb7ac3f42557a11bd2cd0991fc9cae25f56e673
|
|
4
|
+
data.tar.gz: 1cf8f79db27018400d8c414da3618687b16cdcdc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d59a7cc50270cea429a71b7fb492942e0c8d78088ec423c9249684bcc9172bd33ddd5a770fcef0ab59a0d5447ee2162af753df44516953e5a9931254a1ee86a
|
|
7
|
+
data.tar.gz: a6159541a9e39e601c67e42dbfce952a6274be7f2cee0111b1c8c9ee262e3245ec6d6dfd8d8362f71f607538a9a9ec172661bad728f07ca3b052fc31824c52bb
|
data/bin/coba
CHANGED
|
@@ -50,7 +50,7 @@ class Coba < Thor
|
|
|
50
50
|
# Array loop
|
|
51
51
|
arrayOfBrowser = Array.new
|
|
52
52
|
|
|
53
|
-
if browser
|
|
53
|
+
if browser === nil
|
|
54
54
|
browser = config['browsers']
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -146,6 +146,46 @@ class Coba < Thor
|
|
|
146
146
|
dir = File.dirname(File.expand_path(__FILE__))
|
|
147
147
|
FileUtils.copy_entry dir+"/../lib/template/", Dir.pwd+"/"
|
|
148
148
|
end
|
|
149
|
+
|
|
150
|
+
desc "split file chunk", "Split big testcase into some little file"
|
|
151
|
+
long_desc <<-LONGDESC
|
|
152
|
+
coba split will split big testcase file into several file so you can test it chunck by chunk
|
|
153
|
+
chunk is testcase length
|
|
154
|
+
|
|
155
|
+
ex :\n
|
|
156
|
+
> $./coba split 128
|
|
157
|
+
LONGDESC
|
|
158
|
+
def split(file, chunk)
|
|
159
|
+
puts "Spliting file"
|
|
160
|
+
|
|
161
|
+
if File.exist?(file)
|
|
162
|
+
testFile = File.read(file)
|
|
163
|
+
else
|
|
164
|
+
raise "File #{file} doesn't exist"
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
testCases = JSON.parse(testFile)
|
|
168
|
+
puts "Test Cases Count : #{testCases.length}"
|
|
169
|
+
|
|
170
|
+
count = testCases.length / chunk.to_f
|
|
171
|
+
count = count.ceil
|
|
172
|
+
|
|
173
|
+
chunkTestCases = []
|
|
174
|
+
testCases.each.with_index(1) do |testCase,testIndex|
|
|
175
|
+
chunkTestCases << testCase
|
|
176
|
+
if (testIndex % chunk.to_i) === 0 || testIndex === testCases.length
|
|
177
|
+
filename = File.basename(file,".json")
|
|
178
|
+
number = (testIndex / chunk.to_f).ceil
|
|
179
|
+
puts "Compiling Test Cases : #{number} of #{count}"
|
|
180
|
+
File.open("#{Dir.pwd}/#{filename}-#{number.to_i}-of-#{count}.json","w") do |f|
|
|
181
|
+
f.write(JSON.pretty_generate chunkTestCases)
|
|
182
|
+
end
|
|
183
|
+
chunkTestCases = []
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
puts "Spliting file finished"
|
|
187
|
+
end
|
|
188
|
+
|
|
149
189
|
end
|
|
150
190
|
|
|
151
191
|
Coba.start(ARGV)
|
data/lib/coba-testrunner.rb
CHANGED
|
@@ -41,6 +41,10 @@ class TestRunner
|
|
|
41
41
|
def start(testCase=nil)
|
|
42
42
|
@testCase = testCase
|
|
43
43
|
|
|
44
|
+
if(@config['overrideConfig'] === true)
|
|
45
|
+
@config = overrideConfig(@config,@testCase)
|
|
46
|
+
end
|
|
47
|
+
|
|
44
48
|
beforeExecution
|
|
45
49
|
|
|
46
50
|
loadUrl(@config['startingUrl'])
|
|
@@ -60,6 +64,10 @@ class TestRunner
|
|
|
60
64
|
end
|
|
61
65
|
|
|
62
66
|
private #Private method dibawah
|
|
67
|
+
def overrideConfig(config,testCases)
|
|
68
|
+
config['startingUrl'] = testCases['testCases']['startingUrl'];
|
|
69
|
+
return config;
|
|
70
|
+
end
|
|
63
71
|
def logTime(index,start,finish)
|
|
64
72
|
@time[index] = Hash.new
|
|
65
73
|
@time[index]['start'] = start
|
|
@@ -72,9 +80,9 @@ class TestRunner
|
|
|
72
80
|
|
|
73
81
|
start = Time.new
|
|
74
82
|
|
|
75
|
-
if @config['before'] and File.exist?(@config['before']) and url
|
|
83
|
+
if @config['before'] and File.exist?(@config['before']) and !url.nil?
|
|
76
84
|
@driver.navigate.to url
|
|
77
|
-
elsif url
|
|
85
|
+
elsif !url.nil?
|
|
78
86
|
@driver.get url
|
|
79
87
|
end
|
|
80
88
|
|