This is an old revision of the document!
Writing Custom Plugins
There are two reasons you may want to develop your own plugins: adding custom functions to mScript or extend TestOptimal functionality, for example to test other types of applications.
Add custom function to mScript:
- create a java class by inheriting from an existing plugin which you will be using to run your model: com.webmbt.plugin.SeleniumPlugin or com.webmbt.HtmlunitPlugin.
- add your function to the new plugin java class and add the following like right above each of the functions:
@MSCRIPT_METHOD
- all functions must have string parameters, but can return String, String[], int or boolean.
- compile the java class, copy the .class file or .jar file to /build/ folder.
- define the plugin in Help/Config
- restart TestOptimal server.
Create a new plugin (to extend TestOptimal functionality):
- create a java class by inheriting from com.webmbt.PluginAncestor.
- implement a few methods required by PluginAncestor class.
- create your own methods you need to drive your application/process.
- compile and deploy the java class
- define the plugin in Help/Config
- restart TestOptimal server.