autotest-java 0.0.1 → 0.0.2
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/.document +5 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/autotest-java.gemspec +16 -5
- data/lib/autotest-java.rb +0 -0
- data/lib/autotest/discover.rb +5 -0
- data/lib/autotest/junit_to_testunit_formatter.rb +21 -0
- data/lib/autotest/maven.rb +73 -0
- data/test/autotest-java_test.rb +7 -0
- data/test/test_helper.rb +9 -0
- metadata +13 -5
data/.document
ADDED
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "autotest-java"
|
8
|
-
gem.summary = %Q{
|
8
|
+
gem.summary = %Q{run java tests with autotest}
|
9
9
|
gem.email = "darrinholst@gmail.com"
|
10
10
|
gem.homepage = "http://github.com/darrinholst/autotest-java"
|
11
11
|
gem.authors = ["Darrin Holst"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/autotest-java.gemspec
CHANGED
@@ -2,30 +2,41 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{autotest-java}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Darrin Holst"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-10}
|
10
10
|
s.email = %q{darrinholst@gmail.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
13
13
|
"README.textile"
|
14
14
|
]
|
15
15
|
s.files = [
|
16
|
-
".
|
16
|
+
".document",
|
17
|
+
".gitignore",
|
17
18
|
"LICENSE",
|
18
19
|
"README.textile",
|
19
20
|
"Rakefile",
|
20
21
|
"VERSION",
|
21
|
-
"autotest-java.gemspec"
|
22
|
+
"autotest-java.gemspec",
|
23
|
+
"lib/autotest-java.rb",
|
24
|
+
"lib/autotest/discover.rb",
|
25
|
+
"lib/autotest/junit_to_testunit_formatter.rb",
|
26
|
+
"lib/autotest/maven.rb",
|
27
|
+
"test/autotest-java_test.rb",
|
28
|
+
"test/test_helper.rb"
|
22
29
|
]
|
23
30
|
s.homepage = %q{http://github.com/darrinholst/autotest-java}
|
24
31
|
s.rdoc_options = ["--charset=UTF-8"]
|
25
32
|
s.require_paths = ["lib"]
|
26
33
|
s.rubyforge_project = %q{autotest-java}
|
27
34
|
s.rubygems_version = %q{1.3.5}
|
28
|
-
s.summary = %q{
|
35
|
+
s.summary = %q{run java tests with autotest}
|
36
|
+
s.test_files = [
|
37
|
+
"test/autotest-java_test.rb",
|
38
|
+
"test/test_helper.rb"
|
39
|
+
]
|
29
40
|
|
30
41
|
if s.respond_to? :specification_version then
|
31
42
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
$stdin.each_line do |l|
|
2
|
+
tests = failures = 0
|
3
|
+
|
4
|
+
match = /Tests run: (\d+), Failures: (\d+)/.match(l)
|
5
|
+
|
6
|
+
if(match)
|
7
|
+
tests, failures = match[1], match[2]
|
8
|
+
end
|
9
|
+
|
10
|
+
match = /OK \((\d+) tests\)/.match(l)
|
11
|
+
|
12
|
+
if(match)
|
13
|
+
tests = match[1]
|
14
|
+
end
|
15
|
+
|
16
|
+
if(tests.to_i > 0)
|
17
|
+
puts "#{tests} tests, 0 assertions, #{failures} failures, 0 errors" if tests.to_i > 0
|
18
|
+
else
|
19
|
+
puts l
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'autotest'
|
2
|
+
|
3
|
+
class Autotest::Maven < Autotest
|
4
|
+
attr_accessor :classpath
|
5
|
+
|
6
|
+
def initialize # :nodoc:
|
7
|
+
super
|
8
|
+
cache_classpath
|
9
|
+
add_mappings
|
10
|
+
|
11
|
+
self.failed_results_re = /^\d+\) (.*)\((.*)\)/
|
12
|
+
end
|
13
|
+
|
14
|
+
def make_test_cmd files_to_test
|
15
|
+
cmd = ""
|
16
|
+
classes = reorder(files_to_test).map{|k,v| file_to_class(k)}
|
17
|
+
|
18
|
+
unless(classes.empty?)
|
19
|
+
cmd = "#{java} -classpath \"#{classpath}\" #{test_runner} #{classes.join(' ')} | #{results_formatter}"
|
20
|
+
end
|
21
|
+
|
22
|
+
cmd
|
23
|
+
end
|
24
|
+
|
25
|
+
def extra_class_map
|
26
|
+
Hash[
|
27
|
+
*self.find_order.grep(/^target\/test-classes/).map { |f|
|
28
|
+
[path_to_classname(f), f]
|
29
|
+
}.flatten
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def path_to_classname(path)
|
34
|
+
path.gsub(/.*classes\//, '').gsub(/\.class/, '').gsub(/\//, '.')
|
35
|
+
end
|
36
|
+
|
37
|
+
def cache_classpath
|
38
|
+
puts "extracting classpath from the maven, please stand by"
|
39
|
+
result = `mvn -o dependency:build-classpath`
|
40
|
+
match = result.match(/.*\.jar/)
|
41
|
+
raise "Unable to glean classpath from #{result}" unless match
|
42
|
+
self.classpath = ['target/classes', 'target/test-classes', match[0]].join(File::PATH_SEPARATOR) if match
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_mappings
|
46
|
+
clear_mappings
|
47
|
+
|
48
|
+
add_mapping(/^target\/classes\/.*\.class$/) do |filename, match|
|
49
|
+
impl = File.basename(filename, '.class')
|
50
|
+
files_matching(/^target\/test-classes\/.*#{impl}Test\.class$/)
|
51
|
+
end
|
52
|
+
|
53
|
+
add_mapping(/^target\/test-classes\/.*Test.class$/) do |filename, match|
|
54
|
+
filename
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def java
|
59
|
+
"java"
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_runner
|
63
|
+
"org.junit.runner.JUnitCore"
|
64
|
+
end
|
65
|
+
|
66
|
+
def file_to_class(file)
|
67
|
+
file.gsub(/.*classes\//, '').gsub(/\.class/, '').gsub(/\//, '.')
|
68
|
+
end
|
69
|
+
|
70
|
+
def results_formatter
|
71
|
+
"ruby #{File.join(File.dirname(__FILE__), 'junit_to_testunit_formatter.rb')}"
|
72
|
+
end
|
73
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autotest-java
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darrin Holst
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-10 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -23,12 +23,19 @@ extra_rdoc_files:
|
|
23
23
|
- LICENSE
|
24
24
|
- README.textile
|
25
25
|
files:
|
26
|
+
- .document
|
26
27
|
- .gitignore
|
27
28
|
- LICENSE
|
28
29
|
- README.textile
|
29
30
|
- Rakefile
|
30
31
|
- VERSION
|
31
32
|
- autotest-java.gemspec
|
33
|
+
- lib/autotest-java.rb
|
34
|
+
- lib/autotest/discover.rb
|
35
|
+
- lib/autotest/junit_to_testunit_formatter.rb
|
36
|
+
- lib/autotest/maven.rb
|
37
|
+
- test/autotest-java_test.rb
|
38
|
+
- test/test_helper.rb
|
32
39
|
has_rdoc: true
|
33
40
|
homepage: http://github.com/darrinholst/autotest-java
|
34
41
|
licenses: []
|
@@ -56,6 +63,7 @@ rubyforge_project: autotest-java
|
|
56
63
|
rubygems_version: 1.3.5
|
57
64
|
signing_key:
|
58
65
|
specification_version: 3
|
59
|
-
summary:
|
60
|
-
test_files:
|
61
|
-
|
66
|
+
summary: run java tests with autotest
|
67
|
+
test_files:
|
68
|
+
- test/autotest-java_test.rb
|
69
|
+
- test/test_helper.rb
|