cancel
Showing results for 
Search instead for 
Did you mean: 

[Plugin] MockTestRunner listener

New Contributor

[Plugin] MockTestRunner listener

Hi,

I need to add a listener to be triggered when a single step is being executed from it's panel, to be executed before the TestStep.

When the step is a SOAP step, I have been able to add it using the SubmitListenerAdaptader. But I couldn't find how to implement a listener to be triggered when (e.g.) GroovyTestSteps or a JDBCTestSteps are being executed.

Runner class: com.eviware.soapui.impl.wsdl.panels.support.MockTestRunner

Context class: com.eviware.soapui.impl.wsdl.panels.support.MockTestRunContext

6 REPLIES 6
Highlighted
Community Hero

Re: [Plugin] MockTestRunner listener

@mmestre,

Are you using Open Source edition?


Regards,
Rao.
Community Hero

Re: [Plugin] MockTestRunner listener

Some time ago, wrote an extension for Open Source.
https://github.com/nmrao/soapuiExtensions

Can you please take a look at it and implement what you needed, possibly nothing is available for Mock services though.


Regards,
Rao.
New Contributor

Re: [Plugin] MockTestRunner listener

Hi Rao.

Yes, I'm using SoapUI OS.

New Contributor

Re: [Plugin] MockTestRunner listener

@nmrao 

I've just read the plugin. It's an excellent idea. Congrats for it.

 

Almost there, but I still can't trigger the listener when a groovy is being executed from it's panel. This is because, as you can see at your custom-listeners.xml, you are using the following listeners that run on the step execution at desktop panel:

com.eviware.soapui.impl.wsdl.submit.RequestFilter:

It's triggered when a Soap Test Step is executed, but not when the Step is JDBC or Groovy.

com.eviware.soapui.model.iface.SubmitListener:

As you can see in the "All Known Implementing Classes:" in the javadoc, it's implemented by the JDBC TestStep but not by the Groovy Test Step, so, it's listeners is being triggered when a JDBC is executed in it's own panel, but not when a Groovy is executed that way.

 

"possibly nothing is available for Mock services though."

But this issue is not related to Mock services but with the MockTestRunner, the runner created when a step is executed directly from it's own panel on the SoapUI desktop application.

 

Community Hero

Re: [Plugin] MockTestRunner listener

@mmestre,

Groovy Script test step is different from SOAP / REST / HTTP / JDBC request steps and that only executes some  business logic and mostly does not call external systems like the others. That's why listener have no control for the same.

Would you mind posting your actual use case? That probably help me to understand the case better.



Regards,
Rao.
New Contributor

Re: [Plugin] MockTestRunner listener

I developed a listener that, on runtime, copies the custom properties from different project levels to the running context.

 

Example: If in the custom properties of the Project I have a property called "mailAddress" with the value "project address", then when I call the property from a request using ${mailAddress} when running it will be converted to the text "project address" without needing to point to the project using ${project#mailAddress}.

Also, if I put a custom property with the same name in a TestSuite or a TestCase, when running the same request it will get the value from the "most specific" level (first it will use the value from the TestCase, if it doesn't have the property it will use the value from the TestSuite, if it doesn't have the property it will search it in the project or in the global properties).

 

This is very useful to change the values of the tests without modifying the requests.

I have it working with every runner, with the exception of the runner created when running a Groovy Script from it's desktop panel play button. Thanks to you, this is the only one that doesn't have the property created on it's context.

 

Can you help me implementing the listener in that last runner? Thank you.