Forum Discussion

alaily's avatar
alaily
New Contributor
11 years ago

Plugin EventListener (SoapUI 5.1)

Hi all,

i created a plugin for Soapui Pro 5.1 using Maven with type "listener" and language "java". I could load the plugin over Plugin Manager. The event listener has the standard template, it should write in SoapUI log when a test case executed and stopped.


package com.deutschebahn.TestListener;

import com.eviware.soapui.SoapUI;
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;

@ListenerConfiguration
public class PluginListener extends TestRunListenerAdapter {

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

@Override
public void afterRun(TestCaseRunner testRunner, TestCaseRunContext runContext) {
SoapUI.log("Test " + testRunner.getTestCase().getName() + " stopping...");
}
}


But when I start the some test cases, it doesn't write anything in log.

How can the listener be triggered and should it be registered anyway?

Thanks
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    Hi,
    if you are a pro user (with a valid license), you should post in the "SoapUI Pro Support" Forum to get direct support from SmartBear
  • alaily's avatar
    alaily
    New Contributor
    I dont know why, but I cannot post in Pro Forum. I've contacted the support to activate my account for that board, but still waiting. But I think, this Plugin should also work with free version.

    Thus thanks for any idea!
  • Hi all,

    I'm sorry about the slow reply on this; it's a confirmed bug for all annotated listener and will be fixed in the upcoming Ready API release - and also possibly in an upcoming SoapUI Pro maintenance release, although I don't know when that is planned.

    You can hack around this by initializing statically in your plugin:

    static
    {
    final SoapUIListenerRegistry registry =SoapUI.getSoapUICore().getListenerRegistry();
    registry.addListener(TestRunListener.class, <yourlistenerclass>, null);
    }

    Hope this helps - sorry about this mistake on our side!

    best regards,

    /Ole
    SmartBear Software