My previous post showed you how to create a custom TestStep in soapUI harboring some of many extension mechanisms available. My main gripe with the post after it was done was how hard it was to distribute the actual plugin; a bunch of files that all had to be saved to different folders to get it all working correctly. This bothered me to the extent that I sat down and created support for a simple plugin file format in soapUI allowing you to package up your extensions/listeners/factories/resources into one file which you conveniently can drop in a "plugins" folder under the soapUI bin folder. Let's have a quick look at the format and how the EmailTestStep is packaged with it.
The Plugin File Format
The format is simple - it's basically a jar file containing the classes that are needed for the plugin together with a number of configuration files that would otherwise have to be dropped into the file system:
- META-INF/factories.xml : should contain all factory definitions
- META-INF/listeners.xml : should contain all custom listeners
- META-INF/actions.xml : should contain all custom actions
Any images/icons required by your plugin can be put in here as well which make them available to the UISupport.createImageIcon( path ) method.
The EmailTestStep Plugin
The EmailTestStep plugin thus contains the following files:
- META-INF/factories.xml : the emailteststep-factories.xml file
- META-INF/actions.xml : the emailteststep-actions.xml file
- email.png - the icon used for the TestStep
If we drop this jar (named emailteststep-plugin.jar) in the soapUIbinplugins folder the plugin will be picked up just as before, which you can see in the soapUI log:
- Wed Feb 01 22:47:29 CET 2012:INFO:Adding plugin from [C:workspacesoapui-pro-4.0.2-maintenancepluginsemailteststep-plugin.jar]
- Wed Feb 01 22:47:29 CET 2012:INFO:Adding factory [class soapui.demo.teststeps.email.EMailTestStepFactory]
- Wed Feb 01 22:47:29 CET 2012:INFO:Adding factory [class soapui.demo.teststeps.email.EMailTestStepPanelBuilderFactory]
Building this jar file from a corresponding eclipse project was straight forward. Here is the project layout:
(The "Referenced Libraries" folder contains all libraries in the soapUIlib and soapUIbin folders)
Exporting the plugin as a jar file from within eclipse (Use the FileExport...) option will create the jar seen at the bottom of the above screenshot, ready to be deployed in your soapUI installation.
That's it! Be sure to download the latest nightly build to get the above plugin-support and download the emailteststep-plugin.jar and save it to a <soapUI>binplugins folder before you start soapUI - that's all that's needed to start using this new TestStep.
As always, Thank you for your time!