Class: Buildr::JUnit::Report
Overview
Instance Attribute Summary collapse
-
#frames ⇒ Object
True (default) to produce a report using frames, false to produce a single-page report.
-
#params ⇒ Object
readonly
Parameters passed to the Ant JUnitReport task.
-
#style_dir ⇒ Object
Directory for the report style (defaults to using the internal style).
-
#target ⇒ Object
Target directory for generated report.
Instance Method Summary collapse
-
#generate(projects, target = @target.to_s) ⇒ Object
:call-seq: generate(projects, target?).
-
#initialize ⇒ Report
constructor
A new instance of Report.
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
143 144 145 146 147 |
# File 'lib/buildr/java/tests.rb', line 143 def initialize @params = {} @frames = true @target = 'reports/junit' end |
Instance Attribute Details
#frames ⇒ Object
True (default) to produce a report using frames, false to produce a single-page report.
137 138 139 |
# File 'lib/buildr/java/tests.rb', line 137 def frames @frames end |
#params ⇒ Object (readonly)
Parameters passed to the Ant JUnitReport task.
135 136 137 |
# File 'lib/buildr/java/tests.rb', line 135 def params @params end |
#style_dir ⇒ Object
Directory for the report style (defaults to using the internal style).
139 140 141 |
# File 'lib/buildr/java/tests.rb', line 139 def style_dir @style_dir end |
#target ⇒ Object
Target directory for generated report.
141 142 143 |
# File 'lib/buildr/java/tests.rb', line 141 def target @target end |
Instance Method Details
#generate(projects, target = @target.to_s) ⇒ Object
:call-seq:
generate(projects, target?)
Generates a JUnit report for these projects (must run JUnit tests first) into the target directory. You can specify a target, or let it pick the default one from the target attribute.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/buildr/java/tests.rb', line 155 def generate(projects, target = @target.to_s) html_in = File.join(target, 'html') rm_rf html_in ; mkpath html_in Buildr.ant('junit-report') do |ant| ant.taskdef :name=>'junitreport', :classname=>'org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator', :classpath=>Buildr.artifacts(JUnit.ant_taskdef).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR) ant.junitreport :todir=>target do projects.select { |project| project.test.framework == :junit }. map { |project| project.test.report_to.to_s }.select { |path| File.exist?(path) }. each { |path| ant.fileset(:dir=>path) { ant.include :name=>'TEST-*.xml' } } = { :format=>frames ? 'frames' : 'noframes' } [:styledir] = style_dir if style_dir ant.report .merge(:todir=>html_in) do params.each { |key, value| ant.param :name=>key, :expression=>value } end end end end |