- An improved PluginLoader that loads plugins into their own ClassLoader - allowing plugins to have 3rd party dependencies that don't collide with other plugins or SoapUI itself
- An annotation-based extension mechanism for creating plugin classes (no more XML...)
- An integrated PluginManager that allows you to install/uninstall/upgrade plugins via the UI
- A plugin-repository hosted by SmartBear to which you can submit your own plugins so anyone can download them via the PluginManager
- A maven archetype for easily creating new plugin projects using either java or groovy as the development language
Let's create a simple plugin to illustrate some of these steps.
As you hopefully know - SoapUI is a desktop tool for all aspects of API Testing that you'll need to download and install from smartbear.com. Creating plugins is simplified by having a java/groovy development environment, for example Intellij or eclipse. You'll also need maven for the actual building of the plugins. I won't dive any more into this since I expect you to have all this sorted out already :-)
Creating a simple search plugin
The maven archetype will generate the basic plugin project for you; open a command-prompt in a folder where you want to create the plugin project and type the following:
mvn archetype:generate -DarchetypeGroupId=com.smartbear.maven.archetypes -DarchetypeArtifactId=soapui-plugin-archetype -Dmaven.repo.remote=http://www.eviware.com/repository/maven2
This will download and install the maven archetype and start generation of the plugin project. You will be prompted for a number of properties - set these as follows:
maven will do some work and generate the default project for you - you should see something in the line of the following in your command-prompt:
Now go into the created "my-soapui-plugin" directory and run "mvn install" from the command-line - this will build the plugin and package it for installation - you will get something like the following:
Let's install this plugin in SoapUI 5.1 - start SoapUI and open the PluginManager from the main toolbar:
Select the "Load plugin from file..." button at the bottom of the PluginManager dialog and navigate to the generated plugin in the target folder of the plugin project:
Press "Open" and the plugin should get installed:
Close the Plugin Manager and right-click on any open project in your SoapUI workspace (this is where the default plugin action is installed) - you'll see the plugin action at the bottom of the menu:
Presto - that was easy! Your first SoapUI Plugin is installed and running - and you didn't write one line of code!
Customizing the plugin to do a search in our project
Although it works - the plugin currently doesn't do much (it just shows a hello message). Let's improve the plugin to actually do something useful - search and open a list of matching items in the selected project.
Open the project in your java development environment (i'll leave the details of that to you...) and navigate to the PluginAction.java file that was generated via the maven archetype:
You can see the default implementation of the perform method - it just shows a "Hello from..." message in a popup window.
Now comes the hard part - knowing your way around the SoapUI object model and APIs - have a look at The SoapUI Object Model to get an introduction and pointers to relevant javadocs.
What we'll do is change the perform method to first prompt for a search string, then do a recursive search through all items in the select project to find those with a matching name (using the specified search string as a regular-expression) - and finally display the results in a ModelItemListDesktopPanel:
As you can see, I've also brushed up some of the metadata in the constructor - and the generated PluginConfig.java file has been updated accordingly:
together with updated metadata in the pom;
<name>SoapUI Search Plugin</name>
Now when we build and install the plugin (uninstall the previous version first in the Plugin Manager) - we get the following item in the popup menu:
which prompts as follows when selected:
and uses the specified regular-expression to find items in the selected project and display them:
Double-clicking an item in this window opens the corresponding desktop panel for editing. Marvellous!
That's all there was to it - the plugin is ready to by submitted to the plugin repository and spread to thousands of SoapUI users out there.
The above plugin is available on GitHub - feel free to fork and improve it, ask questions or just use it.
And as always - I'm looking forward to hearing from you.