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:

  1. 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.
  2. add your function to the new plugin java class and add the following like right above each of the functions:
  @MSCRIPT_METHOD
  1. all functions must have string parameters, but can return String, String[], int or boolean.
  2. compile the java class, copy the .class file or .jar file to /build/ folder.
  3. define the plugin in Help/Config
  4. restart TestOptimal server.

Create a new plugin (to extend TestOptimal functionality):

  1. create a java class by inheriting from com.webmbt.PluginAncestor.
  2. implement a few methods required by PluginAncestor class.
  3. create your own methods you need to drive your application/process.
  4. compile and deploy the java class
  5. define the plugin in Help/Config
  6. restart TestOptimal server.