Listeners main page
You can implement different types of listeners (Listener) depending on your requirements.
Approach for implementation will be always the same like described below.
To add custom listener (f.e. test suite listener) you need to do -
- Create class which extends ServicesAware and implements interface Provider<T>
public class ProviderOfTestSuiteListener extends ServicesAware implements Provider<TestSuiteListener> {
- Create bean in XML file with some id
<!-- begin: following section is used for docu generation - listener usage -->
<bean id="listenerTestSuite" class="${package}.listener.ProviderOfTestSuiteListener"/>
<!-- end: following section is used for docu generation - listener usage -->
- Add listeners-test-suite of type listener-test-suite-ref to test-suite block
in your configuration XML file and set id of listener to attribute ref. <!-- begin: following section is used for docu generation - test suite listener usage -->
<!-- Custom test suite listener will be executed on test suite start and stop -->
<listeners-test-suite>
<listener-test-suite xsi:type="listener-test-suite-ref" ref="listenerTestSuite"/>
</listeners-test-suite>
<!-- end: following section is used for docu generation - test suite listener usage -->
Note:
- full examples of the code are available in maven archetype-examples or here: Custom listener examples code
- instead of ${package} write the name of your package