Interface to TestPlugin The TestRuntime is event based and handles events by TestPlugins. TestPlugins should be stateless. All state should be held in TestRuntime variables. Dependencies between plugins are expressed by "features". A "feature" is identified by a String value. For example "grailsApplication". A plugin can require or provide features. A TestRuntime instance is requested with an array of required features. The TestRuntimeFactory contains a registry of all plugins and does the dependency resolution to find out what plugins should be added to the runtime and what the order is. The order based on dependencies is the most significant. Plugins with the same dependency order are sorted by the "getOrdinal()" value (highest value comes first). It's possible to override "features" by providing a plugin with a higher ordinal value than another plugin. The overriding plugin might have to provide all of the features of the other plugin when the plugin provides several features. Custom plugins can be registered to the single TestRuntimeFactory in static initializer blocks of the test class. The plugin class can also implement TestEventInterceptor. In that case the instance will be also registered as an event interceptor.
Type Params | Return Type | Name and description |
---|---|---|
|
void |
close(TestRuntime runtime) this method is called when the state of the given runtime should be cleaned. |
|
int |
getOrdinal() Priority order of the plugin default value is 0 |
|
java.lang.String[] |
getProvidedFeatures() @return array of provided features |
|
java.lang.String[] |
getRequiredFeatures() @return array of required features |
|
void |
onTestEvent(TestEvent event) this method gets called for all events that occur in the TestRuntime |
this method is called when the state of the given runtime should be cleaned.
runtime
- that is to be closedPriority order of the plugin default value is 0