java_test()rule is used to define a set of
.javafiles that contain tests to run via JUnit.
The short name for this build target.
java_library(), all of the
.javafiles specified by the
srcsargument will be compiled when this rule is built. In addition, all of the corresponding
.classfiles that are built by this rule will be passed as arguments to JUnit when this rule is run as a test.
.classfiles that are passed to JUnit that do not have any methods annotated with
@Testare considered failed tests, so make sure that only test case classes are specified as
srcs. This is frequently done by specifying
A list of labels to be applied to these tests. These labels are arbitrary text strings and have no meaning within buck itself. They can, however, have meaning for you as a test author (e.g.,
fast). A label can be used to filter or include a specific test rule when executing
Java language level for compiling. Corresponds to the
Bytecode target level for compiling. Corresponds to the
java_library(). Must include JUnit (version 4.7 or later) as a dependency for JUnit tests. Must include TestNG (version 6.2 or later) and hamcrest as a dependencies for TestNG tests.
Specifies which test framework to use. The currently supported options are 'junit' and 'testng'.
If set to
True, the test(s) in this rule are run separately from all other tests. (This is useful for integration tests which access a physical device or other limited resource.)
If unset, the test(s) in this rule in parallel with all other tests.
Controls whether tests will all be run in the same process or a process will be started for each set of tests in a class. (This is mainly useful when porting Java tests to Buck from Apache Ant which allows JUnit tasks to set a
fork="yes"property. It should not be used for new tests since it encourages tests to not cleanup after themselves and increases the tests' computational resources and running time.)
- All tests will run in the same process.
- A process will be started for each test class in which all tests of that test class will run.
If set specifies the maximum amount of time (in milliseconds) in which all of the tests in this rule should complete. This overrides the default
rule_timeoutif any has been specified in
Log level for messages from the source under test that buck will output to std out.
Value must be a valid
std_out_log_level, but for std err.
Whether or not to build and link against
cxx_librarydependencies when testing.
EXPERIMENTAL. List of cxx_libraries to build, if use_cxx_libraries is true. This can be useful if some dependencies are Android-only and won't build on the default platform.
A list of organizational contacts for this test. These could be individuals who you would contact in the event of a test failure or other issue with the test.
contacts = [ 'Joe Sixpack', 'Erika Mustermann' ]
Runtime arguments to the JVM running the tests.
A map of environment names and values to set when running the test.
List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their
exported_depsattributes. For more information, see visibility.