@ListenerConfiguration

Applies to ReadyAPI 3.9, last modified on July 16, 2021

@ListenerConfiguration creates an event listener which reacts to an event.

This can be used to do almost anything you want, based on something else occurring. For example automatic reporting on failed tests, saving results to a database, performing tasks related to project creation, and so on.

The annotated class must implement one of the supported listener interfaces .

Sample Listener

package com.smartbear.ready.plugin.template.listeners;

import com.eviware.soapui.model.support.TestRunListenerAdapter;
import com.eviware.soapui.model.testsuite.TestCaseRunContext;
import com.eviware.soapui.model.testsuite.TestCaseRunner;
import com.eviware.soapui.plugins.ListenerConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ListenerConfiguration
public class SampleJavaListener extends TestRunListenerAdapter {

private final static Logger logger = LoggerFactory.getLogger( SampleJavaListener.class );

@Override
public void beforeRun(TestCaseRunner testRunner, TestCaseRunContext runContext) {
logger.info("Test " + testRunner.getTestCase().getName() + " starting...");
}

@Override
public void afterRun(TestCaseRunner testRunner, TestCaseRunContext runContext) {
logger.info("Test " + testRunner.getTestCase().getName() + " stopping...");
}
}
Highlight search results