public class PlainTextInterpret extends AbstractTestScriptInterpret
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
BACKUP_FILE_SUFFIX
TYPE_JAVA, TYPE_PROPRIETARY, TYPE_UNKNOWN
Constructor and Description |
---|
PlainTextInterpret() |
Modifier and Type | Method and Description |
---|---|
boolean |
compile(ScriptingContext customContext)
Compile source code of the test script.
|
int |
execute(ScriptingContext customContext)
Execute the test script.
|
String |
getDescription()
Get plugin description to be displayed in the GUI.
|
String |
getDisplayName()
Get short plugin name to be displayed in the GUI.
|
StyledDocument |
getDocument()
Get the styled document holding source code of the test script.
|
String[] |
getSupportedFileExtensions()
Get typical file extensions that should be handled by a particular
implementation of a test script.
|
int |
getType()
Get the test script type.
|
String |
getTypeDescription()
Get the test script interpret type description.
|
String |
getUniqueId()
Get unique ID associated with the plugin.
|
boolean |
isPartialExecutionAllowed()
Indicate whether it is possible to execute just a part of the test script.
|
boolean |
isPartialExecutionAllowed(int start,
int end,
int[] range)
Indicate whether it is possible to execute the specified part of the test script.
|
boolean |
isSupportedTestScript()
Test whether the interpret is a supported script, i.e.
|
void |
resetSelection()
Reset selection for partial execution purposes.
|
void |
setSelection(int startOffset,
int endOffset)
Set the start and end offset for partial execution of a test script.
|
addChangeListener, applyVariablesToCommand, backUp, changedUpdate, checkDependencies, deleteBackup, deleteBackup, destroy, getBackup, getCode, getCompilationContext, getDate, getExecutionContext, getFileLastModified, getImplementedInterface, getLowestSupportedVersion, getMessageAfterInstall, getMessageBeforeInstall, getScriptManager, getSourceURI, getSupportContact, getUID, getURI, getVendorHomePage, getVendorName, getVersion, hasSource, insertUpdate, isDestroyed, isEditable, isExecuting, isManualStop, isModified, isPartiallyExecuting, isPause, isRunning, isStop, reload, removeChangeListener, removeUpdate, requiresRestart, save, save, save, setFileLastModified, setModified, setPause, setScriptManager, setScriptOwner, setSourceURI, setStop, setURI
public int getType()
TestScriptInterpret
public String getTypeDescription()
TestScriptInterpret
public String[] getSupportedFileExtensions()
TestScriptInterpret
TestScriptInterpretFactory
)
takes advantage of this method to create interpret instances for particular
test script files.new String[] { "java" }
.
If the method returns null, it means that there is no specific extension
for the script type handled by this class. The latter case applies for example
for the proprietary test script format which may be saved with any extension.public boolean compile(ScriptingContext customContext) throws InterpretErrorException
TestScriptInterpret
customContext
- customized context for this validation. If the argument
is null, the interpret is supposed to obtain a preinitialized context instance
from the script manager through ScriptManager.createDefaultContext()
.SyntaxErrorException
instances to the compilation context. The interpret is also supposed to fire
appropriate compilation script events through the associated script manager.
The context should be made available after compilation through
the TestScriptInterpret.getCompilationContext()
method.InterpretErrorException
- should be thrown on an internal error or
illegal interpret state. The exception message gets typically displayed
or otherwise reported to the user.public int execute(ScriptingContext customContext) throws InterpretErrorException
TestScriptInterpret
customContext
- customized context for this execution. If the argument
is null, the interpret is supposed to obtain a preinitialized context instance
from the script manager through ScriptManager.createDefaultContext()
.
The context should be made available after execution through
the TestScriptInterpret.getExecutionContext()
method.InterpretErrorException
- should be thrown on an internal error or
illegal interpret state. The exception message gets typically displayed
or otherwise reported to the user.public boolean isPartialExecutionAllowed()
TestScriptInterpret
Indicate whether it is possible to execute just a part of the test script. This is typically possible with scripting languages, such as the proprietary T-Plan Robot Enterprise one, where user can select part of the code in the editor and execute it. It is on the other hand not possible with test scripts written in Java.
Interprets returning true
should expect the calls of the
TestScriptInterpret.setSelection(int, int)
method. Interprets which do not support
this feature and return false
should throw an exception when
the method is called.
public void setSelection(int startOffset, int endOffset) throws IllegalStateException
TestScriptInterpret
TestScriptInterpret.getDocument()
method. Interprets which do not support partial executions (i.e. their
TestScriptInterpret.isPartialExecutionAllowed()
method returns false) should throw
an IllegalStateException
exception if this method gets called.startOffset
- start offset indicating position in the test script
document to start the execution from.endOffset
- end offset in the test script where execution should be finished.IllegalStateException
- if the method gets called even though the TestScriptInterpret.isPartialExecutionAllowed()
method returns false to indicate that this mode is not supported.public void resetSelection() throws IllegalStateException
TestScriptInterpret
TestScriptInterpret.isPartialExecutionAllowed()
method returns false) should throw
an IllegalStateException
exception if this method gets called.IllegalStateException
- if the method gets called even though the TestScriptInterpret.isPartialExecutionAllowed()
method returns false to indicate that this mode is not supported.public StyledDocument getDocument()
TestScriptInterpret
public String getDisplayName()
Plugin
public String getDescription()
Plugin
public String getUniqueId()
Plugin
Get unique ID associated with the plugin. The plugin manager uses the ID together with the version string to identify whether a plugin is already installed and whether a newer version of the same plugin is available.
The unique ID in fact identifies a particular plugin delivered by a particular vendor. Plugin developers are recommended to choose an ID and keep it constant for all versions of one particular plugin. The ID is never displayed in the GUI so it doesn't have to be a readable text. To avoid conflicts with other vendors it is recommended to elaborate vendor or author name and feature description into the ID, for example "custom RFB client implemented by John Doe".
public boolean isSupportedTestScript()
TestScriptInterpret
isSupportedTestScript
in interface TestScriptInterpret
isSupportedTestScript
in class AbstractTestScriptInterpret
public boolean isPartialExecutionAllowed(int start, int end, int[] range)
TestScriptInterpret
start
- selection start offsetend
- selection end offsetrange
- this is an optional output array (length >= 2) where the
interpret may specify the start and end elements that will be executed for the given
selection specified by [start, end]. These