learn-test 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/learn_test/dependencies/ant.rb +14 -6
- data/lib/learn_test/dependencies/java.rb +5 -1
- data/lib/learn_test/dependency.rb +4 -0
- data/lib/learn_test/runner.rb +2 -2
- data/lib/learn_test/strategies/java_junit.rb +36 -19
- data/lib/learn_test/strategies/mocha.rb +7 -2
- data/lib/learn_test/version.rb +1 -1
- 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: 4d8e6eb7a48f5fe1b9c4506cd41db28f23ca8a09
|
4
|
+
data.tar.gz: 8b43a51699975858494ef64ef0a282e4422ccb31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 180f0bf382c18299922e7797e6b63c27d0a919619ad8da028ae481dc2bec04aeb9cea14677fd85b22eb2d9fdab42da225fd5b9821c7b816d587a4423c1b1d610
|
7
|
+
data.tar.gz: f5874d0523b0a31bfdf2326ed5972e4d675b6e833bbef53213f5d523225e59b825edc135214c65caaf45d6a69dde8e478988c66cd56f27d4ef30a3694ae59841
|
@@ -2,15 +2,23 @@ module LearnTest
|
|
2
2
|
module Dependencies
|
3
3
|
class Ant < LearnTest::Dependency
|
4
4
|
def missing?
|
5
|
-
|
5
|
+
if win?
|
6
|
+
`where ant`.empty?
|
7
|
+
else
|
8
|
+
`which ant`.empty?
|
9
|
+
end
|
6
10
|
end
|
7
11
|
|
8
12
|
def install
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
if win? || !mac?
|
14
|
+
die('Please install Ant.')
|
15
|
+
else
|
16
|
+
puts('Checking for homebrew...'.green)
|
17
|
+
die('You must have Homebrew installed') unless brew_installed?
|
18
|
+
puts('Updating brew...'.green)
|
19
|
+
print_installing('ant')
|
20
|
+
run_install('brew install ant')
|
21
|
+
end
|
14
22
|
end
|
15
23
|
|
16
24
|
private
|
data/lib/learn_test/runner.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module LearnTest
|
2
2
|
class Runner
|
3
3
|
attr_reader :repo, :options
|
4
|
-
SERVICE_URL = 'http://
|
4
|
+
SERVICE_URL = 'http://ironbroker-v2.flatironschool.com'
|
5
5
|
|
6
6
|
def initialize(repo, options = {})
|
7
7
|
@repo = repo
|
@@ -41,8 +41,8 @@ module LearnTest
|
|
41
41
|
|
42
42
|
def strategies
|
43
43
|
[
|
44
|
-
LearnTest::Strategies::Rspec,
|
45
44
|
LearnTest::Strategies::Jasmine,
|
45
|
+
LearnTest::Strategies::Rspec,
|
46
46
|
LearnTest::Strategies::Karma,
|
47
47
|
LearnTest::Strategies::Protractor,
|
48
48
|
LearnTest::Strategies::JavaJunit,
|
@@ -18,6 +18,7 @@ module LearnTest
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def run
|
21
|
+
clean_old_results
|
21
22
|
run_ant
|
22
23
|
make_json
|
23
24
|
end
|
@@ -46,8 +47,16 @@ module LearnTest
|
|
46
47
|
|
47
48
|
private
|
48
49
|
|
50
|
+
def clean_old_results
|
51
|
+
if Dir.entries(lab_dir).any? { |f| f == 'junit' }
|
52
|
+
system("rm -rf #{lab_dir}/junit")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
49
56
|
def run_ant
|
50
|
-
|
57
|
+
javacs_dir = Dir.entries('.').detect { |f| !!f.match(/javacs/) }
|
58
|
+
|
59
|
+
system("ant clean -buildfile #{javacs_dir}/build.xml && ant build -buildfile #{javacs_dir}/build.xml && ant test -buildfile #{javacs_dir}/build.xml")
|
51
60
|
end
|
52
61
|
|
53
62
|
def test_path
|
@@ -55,28 +64,36 @@ module LearnTest
|
|
55
64
|
end
|
56
65
|
|
57
66
|
def lab_dir
|
58
|
-
@lab_dir ||= Dir.entries('.').detect {|f| f.match(/^javacs\-lab\d+$/)}
|
67
|
+
@lab_dir ||= Dir.entries('.').detect { |f| f.match(/^javacs\-lab\d+$/) }
|
59
68
|
end
|
60
69
|
|
61
70
|
def make_json
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
71
|
+
if File.exists?(test_path)
|
72
|
+
test_xml_files.each do |f|
|
73
|
+
parsed = JSON.parse(Crack::XML.parse(File.read(f)).to_json)['testsuite']
|
74
|
+
next if !parsed
|
75
|
+
|
76
|
+
if parsed['testcase']
|
77
|
+
parsed['testcase'].each do |test_case|
|
78
|
+
results[:build][:test_suite][0][:formatted_output] << test_case
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
test_count = parsed['tests'].to_i
|
83
|
+
skipped_count = parsed['skipped'].to_i
|
84
|
+
error_count = parsed['errors'].to_i
|
85
|
+
failure_count = parsed['failures'].to_i
|
86
|
+
duration = parsed['time'].to_f
|
87
|
+
|
88
|
+
results[:examples] += test_count
|
89
|
+
results[:passing_count] += (test_count - skipped_count - error_count - failure_count)
|
90
|
+
results[:failure_count] += (error_count + failure_count)
|
91
|
+
results[:build][:test_suite][0][:duration] = duration
|
68
92
|
end
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
failure_count = parsed['failures'].to_i
|
74
|
-
duration = parsed['time'].to_f
|
75
|
-
|
76
|
-
results[:examples] += test_count
|
77
|
-
results[:passing_count] += (test_count - skipped_count - error_count - failure_count)
|
78
|
-
results[:failure_count] += (error_count + failure_count)
|
79
|
-
results[:build][:test_suite][0][:duration] = duration
|
93
|
+
else
|
94
|
+
results[:examples] = 1
|
95
|
+
results[:failure_count] = 1
|
96
|
+
results[:passing_count] = 0
|
80
97
|
end
|
81
98
|
|
82
99
|
if runner.keep_results?
|
@@ -29,8 +29,7 @@ module LearnTest
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def run
|
32
|
-
|
33
|
-
run_install('npm install mocha-multi')
|
32
|
+
install_mocha_multi
|
34
33
|
run_mocha
|
35
34
|
end
|
36
35
|
|
@@ -65,6 +64,12 @@ module LearnTest
|
|
65
64
|
def run_mocha
|
66
65
|
system("multi='json=.results.json spec=-' node_modules/mocha/bin/mocha test -R mocha-multi")
|
67
66
|
end
|
67
|
+
|
68
|
+
def install_mocha_multi
|
69
|
+
if !File.exists?('node_modules/mocha-multi')
|
70
|
+
run_install('npm install mocha-multi')
|
71
|
+
end
|
72
|
+
end
|
68
73
|
end
|
69
74
|
end
|
70
75
|
end
|
data/lib/learn_test/version.rb
CHANGED