flaky 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/flake +19 -4
- data/lib/flaky.rb +3 -2
- data/lib/flaky/run/from_file.rb +58 -0
- data/readme.md +1 -0
- data/release_notes.md +6 -0
- data/todo.md +6 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 814d8119a05329833700427fea7887b139bc28c4
|
4
|
+
data.tar.gz: 0eab2db86f250b57daac494f77146d9de5e336bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf645eb730fa486416d96b69c5db0b6869c375f4fcda4a7997aeb6f5e1acf64c7b3ae7a7b51ed4b5d72455e5fe8766e030da16200d81f126a1934d4c560d5097
|
7
|
+
data.tar.gz: f678c427c7eed2cbcc2e6d40b6adc601ed043220ccdba65df29e80d6e004698f3c9768dc7238cc8550b3afa0e20e4597ed66789df86450644d2581691771864f
|
data/bin/flake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
-
|
3
|
+
require File.expand_path '../../lib/flaky', __FILE__
|
4
4
|
usage_string = <<-'MSG'
|
5
5
|
flake [count] ios[test_name]
|
6
6
|
|
@@ -10,12 +10,24 @@ flake 1 ios[sign_in]
|
|
10
10
|
flake 3 ios
|
11
11
|
Run all iOS tests up to 3 times
|
12
12
|
If one run passes or 3 runs fail, then we move onto the next test.
|
13
|
+
|
14
|
+
flake 3 ios files.txt
|
15
|
+
Run select iOS tests in files.txt up to 3 times
|
16
|
+
If one run passes or 3 runs fail, then we move onto the next test.
|
13
17
|
MSG
|
14
18
|
|
15
19
|
if ARGV && ARGV.length === 1 && ARGV.first === 'auth'
|
16
|
-
require File.expand_path '../../lib/flaky', __FILE__
|
17
20
|
Flaky::AppleScript.beat_security_agent
|
18
21
|
exit
|
22
|
+
elsif ARGV && ARGV.length === 3
|
23
|
+
# rake 3 ios files.txt
|
24
|
+
count = ARGV.first
|
25
|
+
os = ARGV[1]
|
26
|
+
file = ARGV.last
|
27
|
+
raise 'File must end in .txt' unless File.extname(ARGV.last).downcase == '.txt'
|
28
|
+
puts "Running select #{os} tests from file #{file} #{count}x"
|
29
|
+
Flaky.run_from_file count: count, os: os, file: file
|
30
|
+
exit
|
19
31
|
else
|
20
32
|
unless ARGV && ARGV.length === 2
|
21
33
|
puts usage_string
|
@@ -30,8 +42,9 @@ require File.expand_path '../../lib/flaky', __FILE__
|
|
30
42
|
|
31
43
|
count = ARGV.first
|
32
44
|
|
33
|
-
|
34
|
-
|
45
|
+
last = ARGV.last
|
46
|
+
single_test_match = last.match(/(.+)\[(.*)\]$/)
|
47
|
+
all_tests_match = last.match(/(.+)$/)
|
35
48
|
|
36
49
|
if single_test_match
|
37
50
|
# we're not using full, however we have to capture it anyway.
|
@@ -39,10 +52,12 @@ if single_test_match
|
|
39
52
|
name = File.basename test_name, '.*'
|
40
53
|
puts "Running #{name} #{count}x"
|
41
54
|
Flaky.run_one_test count: count, os: os, name: test_name
|
55
|
+
exit
|
42
56
|
elsif all_tests_match
|
43
57
|
os = all_tests_match.to_a.last
|
44
58
|
puts "Running all #{os} tests #{count}x"
|
45
59
|
Flaky.run_all_tests count: count, os: os
|
60
|
+
exit
|
46
61
|
else
|
47
62
|
puts usage_string
|
48
63
|
exit
|
data/lib/flaky.rb
CHANGED
@@ -9,8 +9,8 @@ require 'posix/spawn' # http://rubygems.org/gems/posix-spawn
|
|
9
9
|
require 'digest/md5'
|
10
10
|
|
11
11
|
module Flaky
|
12
|
-
VERSION = '0.0.
|
13
|
-
DATE = '2013-
|
12
|
+
VERSION = '0.0.15' unless defined? ::Flaky::VERSION
|
13
|
+
DATE = '2013-12-05' unless defined? ::Flaky::DATE
|
14
14
|
|
15
15
|
# https://github.com/appium/ruby_lib/blob/0e203d76610abd519ba9d2fe9c14b50c94df5bbd/lib/appium_lib.rb#L24
|
16
16
|
def self.add_to_path file, path=false
|
@@ -30,5 +30,6 @@ module Flaky
|
|
30
30
|
require 'flaky/run'
|
31
31
|
|
32
32
|
require 'flaky/run/all_tests'
|
33
|
+
require 'flaky/run/from_file'
|
33
34
|
require 'flaky/run/one_test'
|
34
35
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Flaky
|
3
|
+
def self.run_from_file opts={}
|
4
|
+
raise 'Must pass :count, :os, and :file' unless opts && opts[:count] && opts[:os] && opts[:file]
|
5
|
+
|
6
|
+
count = opts[:count].to_i
|
7
|
+
os = opts[:os]
|
8
|
+
file = opts[:file]
|
9
|
+
|
10
|
+
raise ':count must be an int' unless count.kind_of?(Integer)
|
11
|
+
raise ':os must be a string' unless os.kind_of?(String)
|
12
|
+
raise ':file must be a string' unless file.kind_of?(String)
|
13
|
+
|
14
|
+
raise "#{file} doesn't exist" unless File.exists? file
|
15
|
+
tests = File.readlines(file).map { |line| File.basename(line.chomp, '.*') }
|
16
|
+
resolved_paths = []
|
17
|
+
# Convert file names into full paths
|
18
|
+
current_dir = Dir.pwd
|
19
|
+
Dir.glob(File.join current_dir, 'appium', os, 'specs', '**/*.rb') do |test_file|
|
20
|
+
if tests.include? File.basename(test_file, '.*')
|
21
|
+
resolved_paths << File.expand_path(test_file)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
if tests.length != resolved_paths.length
|
26
|
+
missing_tests = []
|
27
|
+
tests.each do |test|
|
28
|
+
missing_tests << test unless File.exists? test
|
29
|
+
end
|
30
|
+
raise "Missing tests #{missing_tests}"
|
31
|
+
end
|
32
|
+
|
33
|
+
flaky = Flaky::Run.new
|
34
|
+
appium = Appium.new
|
35
|
+
|
36
|
+
raise "Rakefile doesn't exist in #{current_dir}" unless File.exists?(File.join(current_dir, 'Rakefile'))
|
37
|
+
|
38
|
+
resolved_paths.each do |test_file|
|
39
|
+
file = test_file
|
40
|
+
name = File.basename file, '.*'
|
41
|
+
|
42
|
+
raise "#{test_file} does not exist." if file.empty?
|
43
|
+
|
44
|
+
test_name = file.sub(current_dir + '/appium/', '')
|
45
|
+
test_name = File.join(File.dirname(test_name), File.basename(test_name, '.*'))
|
46
|
+
|
47
|
+
count.times do
|
48
|
+
appium.start
|
49
|
+
run_cmd = "cd #{current_dir}; rake #{os.downcase}['#{name}']"
|
50
|
+
passed = flaky.execute run_cmd: run_cmd, test_name: test_name, appium: appium
|
51
|
+
break if passed # move onto the next test after one successful run
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
appium.stop
|
56
|
+
flaky.report
|
57
|
+
end
|
58
|
+
end # module Flaky
|
data/readme.md
CHANGED
data/release_notes.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
#### v0.0.14 2013-11-22
|
2
|
+
|
3
|
+
- [6f21c6f](https://github.com/appium/flaky/commit/6f21c6fb899628a41e5e98e2a837e376222edf5c) Release 0.0.14
|
4
|
+
- [0cf4855](https://github.com/appium/flaky/commit/0cf485536c066b85951f3ed4317ad593db8c3bf6) Fix crash on nil log
|
5
|
+
|
6
|
+
|
1
7
|
#### v0.0.13 2013-11-12
|
2
8
|
|
3
9
|
- [33fdc42](https://github.com/appium/flaky/commit/33fdc424ccf7534c13897a7c5bc1d6e7991bfa4e) Release 0.0.13
|
data/todo.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
#### To Do
|
2
2
|
|
3
|
-
- Save appium server log after each test.
|
4
3
|
- Save execution time for each test. (this may already be in the minitest logs)
|
5
4
|
- Save overall execution time.
|
6
|
-
- Fix test numbering. 01, 02, etc.
|
5
|
+
- Fix test numbering. 01, 02, etc.
|
6
|
+
- Better ways to format test names
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
lines.split("\n").each { |l| puts File.basename(l.split(',').first) }; nil
|
10
|
+
```
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flaky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- code@bootstraponline.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic_duration
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/flaky/reset_android.rb
|
90
90
|
- lib/flaky/run.rb
|
91
91
|
- lib/flaky/run/all_tests.rb
|
92
|
+
- lib/flaky/run/from_file.rb
|
92
93
|
- lib/flaky/run/one_test.rb
|
93
94
|
- readme.md
|
94
95
|
- release_notes.md
|