public class Test extends AbstractTestSemantics implements java.io.Serializable
Test
instances which can then be used
to wrap(java.lang.Object)
other Jython objects.
To The Grinder, a test is a unit of work against which statistics are recorded. Tests are uniquely defined by a test number and may also have a description. Scripts can report many different types of thing against the same test, The Grinder will aggregate the results.
Creating a Test
will automatically update The
Grinder console with the test number and the description. If
two Tests
are created with the same number but a
different description, the console will show the first
description.
Modifier and Type | Class and Description |
---|---|
static interface |
Test.InstrumentationFilter
Selective instrumentation.
|
Constructor and Description |
---|
Test(int number,
java.lang.String description)
Creates a new
Test instance. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDescription()
Get the test description.
|
int |
getNumber()
Get the test number.
|
void |
record(java.lang.Object target)
Instrument the supplied
target object. |
void |
record(java.lang.Object target,
Test.InstrumentationFilter filter)
Version of
record that allows selective
instrumentation of an object. |
java.lang.Object |
wrap(java.lang.Object target)
Creates a proxy script object that has the same interface as
the passed object.
|
compareTo, equals, hashCode, toString
public Test(int number, java.lang.String description)
Test
instance.number
- Test number.description
- Test description.public final int getNumber()
public final java.lang.String getDescription()
getDescription
in interface Test
public final java.lang.Object wrap(java.lang.Object target) throws NotWrappableTypeException
Test
statistics. This method can be called many
times, for many different targets.target
- Object to wrap.NotWrappableTypeException
- If the target object could not be
wrapped.public final void record(java.lang.Object target) throws NonInstrumentableTypeException
target
object. Subsequent calls to target
will be recorded against the statistics for this Test
.target
- Object to instrument.NonInstrumentableTypeException
- If target
could not be instrumented.public final void record(java.lang.Object target, Test.InstrumentationFilter filter) throws NonInstrumentableTypeException
record
that allows selective
instrumentation of an object.
The instrumenter will pass candidate items for instrumentation to the
supplied filter
. Only items for which the filter returns true
will be instrumented.
The type of item passed to the filter depends upon the instrumenter, and in
turn this depends on the type of target
. For example, the Java DCR
instrumenter will pass Method
s to the filter.
Some instrumenters, including the Jython instrumenter, do not support
selective instrumentation. If an instrumenter can handle the target
, but does not support selective instrumentation, this method will throw
NonInstrumentableTypeException
. The non-selective version of
record(Object)
should be used instead.
target
- Object to instrument.filter
- Filter that selects the parts of target
to instrument.NonInstrumentableTypeException
- If target
could not be instrumented.