Class: Buildr::TestNG
- Inherits:
-
Buildr::TestFramework::Java
- Object
- Buildr::TestFramework::Base
- Buildr::TestFramework::Java
- Buildr::TestNG
- Defined in:
- lib/buildr/java/tests.rb
Overview
TestNG test framework. To use in your project:
test.using :testng
Support the following options:
-
:properties – Hash of properties passed to the test suite.
-
:java_args – Arguments passed to the JVM.
Constant Summary collapse
- VERSION =
'5.10'
Instance Attribute Summary
Attributes inherited from Buildr::TestFramework::Base
Class Method Summary collapse
Instance Method Summary collapse
-
#run(tests, dependencies) ⇒ Object
:nodoc:.
-
#tests(dependencies) ⇒ Object
:nodoc:.
Methods inherited from Buildr::TestFramework::Java
Methods inherited from Buildr::TestFramework::Base
applies_to?, #dependencies, #initialize, to_sym
Constructor Details
This class inherits a constructor from Buildr::TestFramework::Base
Class Method Details
.dependencies ⇒ Object
296 297 298 |
# File 'lib/buildr/java/tests.rb', line 296 def dependencies ["org.testng:testng:jar:jdk15:#{version}"]+ JMock.dependencies end |
Instance Method Details
#run(tests, dependencies) ⇒ Object
:nodoc:
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/buildr/java/tests.rb', line 314 def run(tests, dependencies) #:nodoc: cmd_args = [ 'org.testng.TestNG', '-log', '2', '-sourcedir', task.compile.sources.join(';'), '-suitename', task.project.id ] cmd_args << '-d' << task.report_to.to_s # run all tests in the same suite cmd_args << '-testclass' << tests = { :properties=>[:properties], :java_args=>[:java_args], :classpath=>dependencies, :name => "TestNG in #{task.send(:project).name}" } begin Java::Commands.java cmd_args, return tests rescue # testng-failed.xml contains the list of failed tests *only* report = File.read(File.join(task.report_to.to_s, 'testng-failed.xml')) failed = report.scan(/<class name="(.*?)">/im).flatten error "TestNG regexp returned unexpected failed tests #{failed.inspect}" unless (failed - tests).empty? # return the list of passed tests return tests - failed end end |
#tests(dependencies) ⇒ Object
:nodoc:
308 309 310 311 312 |
# File 'lib/buildr/java/tests.rb', line 308 def tests(dependencies) #:nodoc: filter_classes(dependencies, :class_annotations => %w{org.testng.annotations.Test}, :method_annotations => %w{org.testng.annotations.Test}) end |