This is an old revision of the document!


Custom Plugins

Custom Plugins is used to extend TestOptimal functionality by implementing a set of mscript functions to be used in MScript.

To create a custom plugins, follow the steps below:

  • create a java class by inheriting from com.webmbt.plugin.PluginAncestor.java and implement the required class methods:
    • void close()
    • String getPluginID()
    • void init(ScxmlNode arg0, String[] arg1) throws Exception
    • void start() throws Exception
    • String snapScreen(String fileName_p) throws Exception
  • annotate the class with @TO_PLUGIN (rel. 4.6)
  • place custom plugin initialization logic in either the java methods:
    • init() - called prior to trigger MBT_Start
    • start() - called after trigger MBT_Start
  • add class methods to be exposed to MScript:
    • all MScript methods must be declared as public methods
    • all MScript methods must be annotated with @MSCRIPT_METHOD
  • optionally you can add all MScript methods to MScript code assist by defining them in a java properties file:
    • name properties file as CAPluginFuncplugin ID.properties
    • properties file must be placed in www/MbSvr/config folder
    • declare each MScript method with format of method name=method syntax@tooltip: tooltip text
  • Prior to rel. 4.6, custom plugin must be declared in config.properties with the format: PLUGIN_<plugin ID>=<plugin package>

Once you have the java class created, compile it and package the .class file into a jar file and copy the jar file to lib folder.

Restart of TestOptimal server is required to make the new plugin jar file or changes to the plugin jar file effective.