Jagger is providing set of services to simplify custom code development.
Services allow to access Jagger internal components with small effort. What services exist you can find under link: Implementations of Jagger services
All custom listeners have access to Jagger services. But list of available services can be different for different types of listeners.
Please see table below to find what services can be used in what listeners.
if (environment.equals(JaggerPlace.TEST_LISTENER)){
metricService = new DefaultMetricService(sessionId, taskId, context);
sessionInfoService = new DefaultSessionInfoService(context);
}
if (environment.equals(JaggerPlace.TEST_GROUP_LISTENER)){
metricService = new DefaultMetricService(sessionId, taskId, context);
sessionInfoService = new DefaultSessionInfoService(context);
}
if (environment.equals(JaggerPlace.TEST_SUITE_LISTENER)){
metricService = new EmptyMetricService(JaggerPlace.TEST_SUITE_LISTENER);
sessionInfoService = new DefaultSessionInfoService(context);
}
if (environment.equals(JaggerPlace.TEST_GROUP_DECISION_MAKER_LISTENER)){
metricService = new EmptyMetricService(JaggerPlace.TEST_GROUP_DECISION_MAKER_LISTENER);
sessionInfoService = new DefaultSessionInfoService(context);
}
if (environment.equals(JaggerPlace.INVOCATION_LISTENER)){
metricService = new DefaultMetricService(sessionId, taskId, context);
sessionInfoService = new EmptySessionInfoService(JaggerPlace.INVOCATION_LISTENER);
}
If you will try to use unavailable service in some listener - nothing will happen and warning will be logged
Example of services usage in listeners are available in maven archetype-examples or here:
Custom listener examples code