Testing with Gradle Java Plugin: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 18: Line 18:
test {
test {
   useJUnit()
   useJUnit()
    maxHeapSize = '1G'
  maxHeapSize = '1G'
}
}
</syntaxhighlight>
</syntaxhighlight>

Revision as of 22:03, 23 November 2018

External

Internal

Overview

Testing is performed by the "test" task (implemented by Test), which automatically detects and executes all unit tests in the test source set and generates a report once test execution is complete. JUnit and TestNG are both supported.

Configuring the "test" Task

Use a script block in build.gradle:

test {
   useJUnit()
   maxHeapSize = '1G'
}

Passing System Properties to Tests

test {
   ...
   systemProperty 'rootDir', "${rootDir}"
   ...
}

Also see Maven Surefire Configuration Example.

TODO

TODO process https://docs.gradle.org/current/userguide/java_testing.html