Forum Discussion

chaitu430's avatar
chaitu430
Occasional Contributor
7 years ago

Issue with Project and TestSuite Listeners in old style plugins

Hi All,

 

I am using SoapUI 5.3.0 and created a plugin to perform some functionality. I am facing an issue adding the required listener to trigger the action.

 

- Adding the TestRunListener invokes listenerClass successfully when running tests either from the TestCaseEditor window or the Launch TestRunner  window ( or TestRunner.bat) - Working as expected and triggered for each TestCase

- The TestSuiteListener (overriding beforeRun) and ProjectRunListener invokes listenerClass  successfully when running tests from the TestSuiteEditor window (pressing green play icon and for each TestSuite) but does not work when tests are ran using Launch TestRunner  window (or TestRunner.bat). 

 

Listeners.xml configuration 

 

<tns:soapui-listeners xmlns:tns="http://eviware.com/soapui/config">
<tns:listener id="SoapUIProjectPropertiesConfigListener" listenerClass="test.listeners.SoapUIProjectPropertiesConfigListener"
listenerInterface="com.eviware.soapui.model.testsuite.TestSuiteRunListener" singleton="true"/>
</tns:soapui-listeners>

 Listener class

 

package test.listeners

import com.eviware.soapui.SoapUI
import com.eviware.soapui.model.support.TestSuiteRunListenerAdapter
import com.eviware.soapui.model.testsuite.TestSuiteRunContext
import com.eviware.soapui.model.testsuite.TestSuiteRunner

class SoapUIProjectPropertiesConfigListener extends TestSuiteRunListenerAdapter
{
@Override
void beforeRun(TestSuiteRunner testSuiteRunner, TestSuiteRunContext testSuiteRunContext) {
SoapUI.log("Hi there")
}
}

Is this a known issue or problem with my configuration ?

 

Your help is appreciated. Thank you

 

Krish

  • Hi,

     

    I finally managed to find the root cause. 

     

    - TestSuiteRunListener will only be invoked when we run all or more than one test case under a TestSuite. When testing my code, I selected only one test case under a TestSuite which caused the system to skip the listener action

    - Similarly, ProjectRunListener will be invoked when we run all or more than one the TestSuites under a project 

     

    Thanks for your time looking into this

     

    Regards,

    Krishna

  • JHunt's avatar
    JHunt
    Community Hero

    Hi, I'll have a look but before I do, can you confirm for me this an Open Source feature? If it is, it's one I haven't used yet.

  • chaitu430's avatar
    chaitu430
    Occasional Contributor

    Hi,

     

    I finally managed to find the root cause. 

     

    - TestSuiteRunListener will only be invoked when we run all or more than one test case under a TestSuite. When testing my code, I selected only one test case under a TestSuite which caused the system to skip the listener action

    - Similarly, ProjectRunListener will be invoked when we run all or more than one the TestSuites under a project 

     

    Thanks for your time looking into this

     

    Regards,

    Krishna