java.lang.Object | |||
↳ | TestCase | ||
↳ | com.google.gwt.junit.client.GWTTestCase | ||
↳ | com.google.gwt.benchmarks.client.Benchmark |
A type of GWTTestCase
which specifically
records performance results. Benchmarks
have additional functionality
above and beyond GWT's JUnit support for standard TestCases
.
In a single JUnit
run, the results of all executed benchmarks
are collected and stored in an XML report viewable with the
benchmarkViewer
.
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. All of your test method parameters
must be annotated with a Range
annotation such as RangeField
or RangeEnum
.
For example,
public void testArrayListRemoves(
@RangeEnum(Position.class) Position where,
@RangeField("insertRemoveRange") Integer size) { ...
}
time limits
on the maximum
duration of each permutation of a benchmark method. With this feature, you
can supply very high upper bounds on your ranges (such as Integer.MAX_VALUE),
which future-proofs your benchmarks against faster hardware. Setup
and Teardown
methods which separate
test overhead from the actual work being benchmarked. The timings of these
lifecycle methods are excluded from test results.
Please note that Benchmarks
do not currently support asynchronous
testing mode. Calling
delayTestFinish(int)
or
finishTest()
will result in
an UnsupportedOperationException.
AllocBenchmark
is an example of a basic benchmark that doesn't
take advantage of most of benchmarking's advanced features.
{@example com.google.gwt.examples.benchmarks.AllocBenchmark}
ArrayListBenchmark
is a more sophisticated example of
benchmarking. It demonstrates the use of Setup
and Teardown
test methods, parameterized test methods, and time limits.
{@example com.google.gwt.examples.benchmarks.ArrayListBenchmark}
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Benchmark.BenchmarkStrategy | The JUnitShell.Strategy used for benchmarking. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | REPORT_PATH | The name of the system property that specifies the location where benchmark reports are both written to and read from. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.junit.client.GWTTestCase
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates the test strategy to use (see
getStrategy() ). | |||||||||||
Runs the test via the
BenchmarkShell
environment. | |||||||||||
Benchmarks do not support asynchronous mode.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.junit.client.GWTTestCase
| |||||||||||
From class
java.lang.Object
|
The name of the system property that specifies the location where benchmark
reports are both written to and read from. Its value is
com.google.gwt.junit.reportPath
.
If this system property is not set, the path defaults to the user's current
working directory.
Creates the test strategy to use (see getStrategy()
).
Runs the test via the BenchmarkShell
environment. Do not override or call this method.
Throwable |
---|
Benchmarks do not support asynchronous mode.