How to simply add new Keywords by Plugins
Maveryx supports codeless keyword-driven tests written in Excel spreadsheets, comma-separated (CSV), and XML files.
The keyword-driven framework has an extension plugin mechanism to add new (custom) keywords and new keywords supported file types.
To add a new keyword, you have to create:
1) a Java class that implements the action/keyword;
2) a configuration file (Plugin.xml);
In the java source code, you have to first import the relevant libraries:
The Java class shall also implement the CustomCommandInterface:
It is necessary to implement both isSupported(ActionCommand testAction) and run(ActionCommand testAction) methods.
The isSupported(ActionCommand testAction) method shall return true if the action/keyword is supported.
The run(ActionCommand testAction) method shall implement the action/keyword.
The method run(ActionCommand testAction) shall implement the action/keyword.
The plugin configuration file shall have the following structure:
Plugin: the root element shall consist of the following properties:
1) id, a string label/ID for the plugin;
2) name, a string label/ID for the plugin;
3) version, the version of the plugin;
4) provider-name, the plugin author.
Also, the Plugin element shall contain at least one extension element.
Extension: this element contains the extensions and shall consist of the following property:
1) point: this is the class to be extended (“com.maveryx.keydriven.TestActionManager”).
The Extension element shall contain at least one customCommand element too.
CustomCommand: this element identifies the extension and shall consist of the following property:
1) class: the class that implements the new action/keyword.
The extension/plugin shall be deployed as a Jar file into the directory MAVERYX_HOME/bin/plugin.
The file Plugin.xml shall be packed into the root of the jar file.