Class Raven::JUnitTask
In: lib/raven/java_tasks.rb
Parent: JavacTask

The JUnit task runs all your test cases located in src/test/java or the build_path that you can set. JUnit inherits from the JavacTask so it accepts every configuration that JavacTask accepts. In addition you can provide an array containing your test classes (default pattern is **/Test*.java).

Methods

Public Instance methods

[Source]

     # File lib/raven/java_tasks.rb, line 96
 96:       def execute
 97:         @build_path = ["src/test/java"] unless @build_path
 98:         super
 99:         unless @test_classes
100:           tests = @build_path.collect { |d| Dir.glob("#{d}/**/Test*.java").collect { |sd| sd[d.size+1..-1] } }
101:           @test_classes = tests.flatten.collect { |d| d.gsub('/', '.')[0..-6] }
102:         end
103:         failures = false
104:         @test_classes.flatten.each do |tc|
105:           puts "Running test #{tc}"
106:           result = `java -classpath "#{@classpath.join(CP_SEP)}" junit.textui.TestRunner #{tc}`
107:           puts result
108:           failures = true if /FAILURES/ =~ result || /ERRORS/ =~ result
109:         end
110:         if failures
111:           puts "There were failures!"
112:           exit(1)
113:         end
114:       end

[Source]

     # File lib/raven/java_tasks.rb, line 116
116:       def test_classes
117:         @test_classes ||= []
118:       end

[Source]

     # File lib/raven/java_tasks.rb, line 120
120:       def test_classes=(c)
121:         @test_classes = [c]
122:       end

[Validate]