com.webmbt.plugin
Class PluginAncestor

java.lang.Object
  extended by com.webmbt.plugin.PluginAncestor
All Implemented Interfaces:
MScriptInterface
Direct Known Subclasses:
AndroidPlugin, ConcurrentPlugin, DataGenPlugin, iOSAppPlugin, JavaAppPlugin, RemoteCommandPlugin, SeqOutPlugin, ServicePlugin, WebPluginAncestor

public abstract class PluginAncestor
extends java.lang.Object
implements MScriptInterface

Abstract class, ancestor of all MBT plugins.

Author:
yxl01

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.webmbt.plugin.MScriptInterface
MScriptInterface.MSCRIPT_METHOD
 
Constructor Summary
PluginAncestor()
           
 
Method Summary
 boolean addException(com.webmbt.MBTException.Level level_p, java.lang.String message_p, java.lang.String location_p)
          adds a failure / exception to the current executing script/trigger.
abstract  void close()
          INTERNAL USE ONLY.
 com.webmbt.ScriptDesc getCurScript()
          INTERNAL USE ONLY.
 java.lang.String getData(java.lang.String dataSetFieldName_p)
          DataSet and field name: setID:fieldName.
 java.lang.String getData(java.lang.String dataSetID_p, java.lang.String fieldName_p)
          retrieve the data field.
 com.webmbt.mscript.DataManager getDataMgr()
          INTERNAL USE ONLY.
 void getDataSetRowNum(java.lang.String dataSetType_p, java.lang.String dataSetID_p)
          advance the data set or var to the next row.
 java.lang.String[] getInitParams()
          INTERNAL USE ONLY.
 java.lang.String[] getMethodList()
          INTERNAL USE ONLY.
 MScriptInterface getMScriptAPI()
          INTERNAL USE ONLY.
static java.lang.String[] getMScriptMethodList(java.lang.Class class_p, java.lang.Class antnClass_p)
          returns a list of methods declared and inheritted that have the annotation tagged (if supplied).
 java.lang.String[] getNativeMethod(java.lang.Class class_p)
          returns the list of methods provided by the class_p.
 java.lang.Object getNativePluginObj()
          returns the plugin native driver object, e.g.
 java.lang.Object getPathVar(java.lang.String varName_p)
           
abstract  java.lang.String getPluginID()
          INTERNAL USE ONLY.
 MbtScriptExecutor getScriptExecutor()
          INTERNAL USE ONLY.
 java.lang.Object getVar(java.lang.String varName_p)
           
 boolean initialize(MbtScriptExecutor scriptExecutor_p)
          INTERNAL USE ONLY.
abstract  boolean isError(java.lang.Exception e_p)
          INTERNAL USE ONLY.
 boolean isReady()
           
 void next(java.lang.String dataSetType_p, java.lang.String dataSetID_p)
          advance the data set or var to the next row.
 void registerVarChangeListener(com.webmbt.mscript.VarChangeListener listener_p)
          INTERNAL USE ONLY.
 java.lang.String replaceEscapeChar(java.lang.String in_p)
          replaces some escape chars with internal chars, e.g.
 void rewind(java.lang.String dataSetType_p, java.lang.String dataSetID_p)
          rewinds the data set or var.
 void setData(java.lang.String dataSetID_p, java.lang.String fieldName_p, java.lang.String value_p)
           
 void setInitParams(java.lang.String[] paramList_p)
          INTERNAL USE ONLY.
 void setPathVar(java.lang.String varName_p, java.lang.String value_p)
           
 void setReady()
           
 void setVar(java.lang.String varName_p, java.lang.String value_p)
           
 java.lang.String snapScreen(long snapTime_p)
          INTERNAL USE ONLY.
abstract  java.lang.String snapScreen(java.lang.String fileName_p)
          INTERNAL USE ONLY.
abstract  void start()
          INTERNAL USE ONLY.
 java.lang.String uiLocatorMap(java.lang.String locator_p)
          resolve the UI locator mapping using the dataset specified in the locator string
abstract  java.lang.String waitForPageToLoad()
          INTERNAL USE ONLY.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginAncestor

public PluginAncestor()
Method Detail

setInitParams

public void setInitParams(java.lang.String[] paramList_p)
                   throws java.lang.Exception
INTERNAL USE ONLY.

Parameters:
paramList_p -
Throws:
java.lang.Exception

getInitParams

public java.lang.String[] getInitParams()
INTERNAL USE ONLY.

Returns:

getPluginID

public abstract java.lang.String getPluginID()
INTERNAL USE ONLY. Returns the unique ID assigned to the plugin. This ID is not governed, that is each plugin can make up its own plugin id and as long as no other plugins currently registered/configured has the same ID, the id is good.

Returns:

isReady

public boolean isReady()

setReady

public void setReady()

getCurScript

public com.webmbt.ScriptDesc getCurScript()
INTERNAL USE ONLY.


getScriptExecutor

public MbtScriptExecutor getScriptExecutor()
INTERNAL USE ONLY.

Returns:

registerVarChangeListener

public void registerVarChangeListener(com.webmbt.mscript.VarChangeListener listener_p)
INTERNAL USE ONLY. register change listener to monitor the var changes.


initialize

public boolean initialize(MbtScriptExecutor scriptExecutor_p)
                   throws java.lang.Exception
INTERNAL USE ONLY. gets called at the mbt execution startup to initialize the plugin.

Parameters:
mbtControl_p - MbtControl object.
Returns:
true if this plugin has any handlers defined and instantiated. Flase if this plugin will not be used at all by this app or the user does not have valid license to use this plugin.
Throws:
java.lang.Exception

getMethodList

public java.lang.String[] getMethodList()
INTERNAL USE ONLY.

Returns:

start

public abstract void start()
                    throws java.lang.Exception
INTERNAL USE ONLY. This usually involves starting up AUT (app under testing).

Throws:
java.lang.Exception

close

public abstract void close()
INTERNAL USE ONLY. closes the AUT, disconnect from the external resource e.g. session to Selenium server, closing watij IE object, etc.

Throws:
java.lang.Exception

getDataMgr

public com.webmbt.mscript.DataManager getDataMgr()
INTERNAL USE ONLY. returns the data manager object.


snapScreen

public java.lang.String snapScreen(long snapTime_p)
                            throws java.lang.Exception
INTERNAL USE ONLY. takes a snapshot of the current screen of AUT and returns the file name of the image (png).

Parameters:
snapTime_p - timestamp in millis to be appended to the file name.
Returns:
Throws:
java.lang.Exception

snapScreen

public abstract java.lang.String snapScreen(java.lang.String fileName_p)
                                     throws java.lang.Exception
INTERNAL USE ONLY. snap the current testing app browser under testing (AUT) and save the screen in png into the file passed in.

Throws:
java.lang.Exception

getMScriptAPI

public MScriptInterface getMScriptAPI()
INTERNAL USE ONLY. returns the mScript API implementation object. For example for Selenium plugin, it returns the Selenium session object.

Returns:
Object or null if this plugin does not support mScript dynamic method call.

isError

public abstract boolean isError(java.lang.Exception e_p)
INTERNAL USE ONLY. returns true if the exception passed in is an error. returns false if the exception is an application exception and thus should not stop the MBT execution.

Parameters:
e_p -
Returns:

waitForPageToLoad

public abstract java.lang.String waitForPageToLoad()
                                            throws java.lang.Exception
INTERNAL USE ONLY. wait until the page is completely loaded.

Throws:
java.lang.Exception

getVar

public java.lang.Object getVar(java.lang.String varName_p)
                        throws com.webmbt.MBTException
Throws:
com.webmbt.MBTException

getPathVar

public java.lang.Object getPathVar(java.lang.String varName_p)
                            throws com.webmbt.MBTException
Throws:
com.webmbt.MBTException

setVar

public void setVar(java.lang.String varName_p,
                   java.lang.String value_p)
            throws java.lang.Exception
Throws:
java.lang.Exception

setPathVar

public void setPathVar(java.lang.String varName_p,
                       java.lang.String value_p)
                throws java.lang.Exception
Throws:
java.lang.Exception

getData

public java.lang.String getData(java.lang.String dataSetFieldName_p)
                         throws java.lang.Exception
DataSet and field name: setID:fieldName.

Throws:
java.lang.Exception

getData

public java.lang.String getData(java.lang.String dataSetID_p,
                                java.lang.String fieldName_p)
                         throws com.webmbt.MBTException
retrieve the data field.

Throws:
com.webmbt.MBTException

setData

public void setData(java.lang.String dataSetID_p,
                    java.lang.String fieldName_p,
                    java.lang.String value_p)
             throws java.lang.Exception
Throws:
java.lang.Exception

next

public void next(java.lang.String dataSetType_p,
                 java.lang.String dataSetID_p)
advance the data set or var to the next row.


getDataSetRowNum

public void getDataSetRowNum(java.lang.String dataSetType_p,
                             java.lang.String dataSetID_p)
                      throws java.lang.Exception
advance the data set or var to the next row.

Throws:
java.lang.Exception

rewind

public void rewind(java.lang.String dataSetType_p,
                   java.lang.String dataSetID_p)
rewinds the data set or var.


getMScriptMethodList

public static java.lang.String[] getMScriptMethodList(java.lang.Class class_p,
                                                      java.lang.Class antnClass_p)
returns a list of methods declared and inheritted that have the annotation tagged (if supplied). This is used to get the mScript functions served by the plugin.

Parameters:
class_p -
antnClass_p -
Returns:

getNativePluginObj

public java.lang.Object getNativePluginObj()
returns the plugin native driver object, e.g. selenium returns selenium session object.

Returns:

getNativeMethod

public java.lang.String[] getNativeMethod(java.lang.Class class_p)
returns the list of methods provided by the class_p.

Parameters:
class_p -
Returns:

replaceEscapeChar

public java.lang.String replaceEscapeChar(java.lang.String in_p)
replaces some escape chars with internal chars, e.g. \t to char(tab).

Parameters:
in_p -
Returns:

uiLocatorMap

public java.lang.String uiLocatorMap(java.lang.String locator_p)
                              throws com.webmbt.MBTException
resolve the UI locator mapping using the dataset specified in the locator string

Throws:
com.webmbt.MBTException

addException

public boolean addException(com.webmbt.MBTException.Level level_p,
                            java.lang.String message_p,
                            java.lang.String location_p)
adds a failure / exception to the current executing script/trigger.

Parameters:
level_p - exception level
message_p - exception message
location_p - exception location, to be appended to the exception message to form the complete exception message
Returns:
true if exception is logged successfully, false if there is no scriptObj to log this exception to.


Copyright © 2008. All Rights Reserved.