GWT supports test methods that have parameters. GWT will execute each
benchmark method multiple times in order to exhaustively test all the possible
combinations of parameter values. For each parameter that your test method
accepts, it should document it with the annotation,
@gwt.benchmark.param
.
The syntax for gwt.benchmark.param is
<param name> = <Iterable>
. For example,
@gwt.benchmark.param where = java.util.Arrays.asList(
new Position[] { Position.BEGIN, Position.END, Position.VARIED } )
@gwt.benchmark.param size -limit = insertRemoveRange
public void testArrayListRemoves(Position where, Integer size) { ... }
In this example, the annotated function is executed with all the possible
permutations of Position = (BEGIN, END, and VARIED)
and
insertRemoveRange = IntRange( 64, Integer.MAX_VALUE, "*", 2 )
.
This particular example also demonstrates how GWT can automatically limit
the number of executions of your test. Your final parameter (in this example,
size) can optionally be decorated with -limit to indicate to GWT that
it should stop executing additional permutations of the test when the
execution time becomes too long (over 1000ms). So, in this example,
for each value of Position
, testArrayListRemoves
will be executed for increasing values of size
(beginning with
64 and increasing in steps of 2), until either it reaches
Integer.MAX_VALUE
or the execution time for the last
permutation is > 1000ms.