|
T-Plan Robot Enterprise 3.2 Build No. 3.2-20121217.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface TestScriptInterpret
Generic test script interface. It describes methods of a test script written in a particular language.
T-Plan Robot Enterprise, (C) 2009-2012 T-Plan Limited. All rights reserved.
| Field Summary | |
|---|---|
static int |
TYPE_JAVA
|
static int |
TYPE_PROPRIETARY
|
static int |
TYPE_UNKNOWN
|
| Method Summary | |
|---|---|
boolean |
compile(ScriptingContext customContext)
Compile source code of the test script. |
void |
destroy()
Clean up method. |
int |
execute(ScriptingContext customContext)
Execute the test script. |
ScriptingContext |
getCompilationContext()
Get context from the last compilation. |
StyledDocument |
getDocument()
Get the styled document holding source code of the test script. |
ScriptingContext |
getExecutionContext()
Get context from the last execution. |
long |
getFileLastModified()
Get the last modification time (in millis) of the file that the interpret owns. |
ScriptManager |
getScriptManager()
Get the script manager associated with this test interpret instance. |
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. |
URI |
getURI()
Get test script source code URI. |
boolean |
hasSource()
Find out if the interpret has access to the source code. |
boolean |
isEditable(String extension)
Find out if a test script file of the given extension is a text one (source code) and can be edited in the script editor. |
boolean |
isExecuting()
|
boolean |
isManualStop()
|
boolean |
isModified()
Find out if the script is modified or not. |
boolean |
isPartialExecutionAllowed()
Indicate whether it is possible to execute just a part of the test script. |
boolean |
isPartialExecutionAllowed(int start,
int end,
int[] outRange)
Indicate whether it is possible to execute the specified part of the test script. |
boolean |
isPartiallyExecuting()
|
boolean |
isPause()
|
boolean |
isStop()
|
boolean |
isSupportedTestScript()
|
void |
reload()
Reload the content from the URI set through the setURI(java.net.URI, boolean) method. |
void |
resetSelection()
Reset selection for partial execution purposes. |
void |
setFileLastModified(long time)
Set the last modification time (in millis) of the file that the interpret owns. |
void |
setModified(boolean modified)
Indicate that the test script has been modified. |
void |
setPause(Object source,
boolean pause,
String reason)
|
void |
setScriptManager(ScriptManager sm)
Set the script manager associated with this test script interpret. |
void |
setScriptOwner(ScriptOwner owner)
|
void |
setSelection(int startOffset,
int endOffset)
Set the start and end offset for partial execution of a test script. |
void |
setStop(Object source,
boolean stop,
boolean isManual,
String manualStopJustification)
Request to stop the script execution. |
void |
setURI(URI uri,
boolean load)
Set the test script URI. |
| Field Detail |
|---|
static final int TYPE_UNKNOWN
static final int TYPE_PROPRIETARY
static final int TYPE_JAVA
| Method Detail |
|---|
int getType()
getType in interface ScriptTypeProviderString getTypeDescription()
String[] getSupportedFileExtensions()
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.boolean isEditable(String extension)
URI getURI()
void setURI(URI uri,
boolean load)
throws IOException
load argument is true, the interpret
should load content from the URI to the document. A value of false is
usually used in "Save As" operations where the URI changes for the
current document content. Saving of the file is however not performed by
this method.
uri - test script URI.load - whether to open the URI in the current document (see getDocument()).
IOException - if the load parameter is true and loading of test script fails.
void reload()
throws IOException
setURI(java.net.URI, boolean) method.
IOException - on an I/O error.long getFileLastModified()
void setFileLastModified(long time)
time - last time of saving of the script to the file.void setScriptManager(ScriptManager sm)
sm - ScriptManager getScriptManager()
boolean compile(ScriptingContext customContext)
throws InterpretErrorException
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 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.
int execute(ScriptingContext customContext)
throws InterpretErrorException
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 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.ScriptingContext getExecutionContext()
execute(ScriptingContext), the method should return null.
ScriptingContext getCompilationContext()
compile(ScriptingContext), the method should return null.
boolean isPartialExecutionAllowed()
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
setSelection(int, int) method. Interprets which do not support
this feature and return false should throw an exception when
the method is called.
boolean isPartialExecutionAllowed(int start,
int end,
int[] outRange)
start - selection start offsetend - selection end offsetoutRange - 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
void setSelection(int startOffset,
int endOffset)
throws IllegalStateException
getDocument()
method. Interprets which do not support partial executions (i.e. their
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 isPartialExecutionAllowed()
method returns false to indicate that this mode is not supported.
void resetSelection()
throws IllegalStateException
isPartialExecutionAllowed() method returns false) should throw
an IllegalStateException exception if this method gets called.
IllegalStateException - if the method gets called even though the isPartialExecutionAllowed()
method returns false to indicate that this mode is not supported.StyledDocument getDocument()
boolean isExecuting()
boolean isPartiallyExecuting()
boolean isStop()
boolean isManualStop()
void setStop(Object source,
boolean stop,
boolean isManual,
String manualStopJustification)
Request to stop the script execution. The method is not supposed to stop the automated task immediately. It is rather expected to set an internal "stop" flag. The interpret should periodically test the flag, for example between individual command calls, and stop the execution as soon as possible.
The method should not fire a stop event through the ScriptListener
interface. It should be rather fired when the execution is really stopped,
not when the request is made.
source - request source.stop - true stops (false doesn't really make sense).isManual - this is additional flag allowing to specify whether the
stop is manual, i.e. requested by the user either through GUI controls or
by pressing Ctrl+C in CLI. This information is saved to the context for
the benefit of report providers and doesn't affect the way the stop action
is carried out.manualStopJustification - optional string describing why or how the
script was stopped. It is used just for reporting purposes.boolean isPause()
void setPause(Object source,
boolean pause,
String reason)
void destroy()
void setModified(boolean modified)
modified - true sets the script status to modified, false to unmodified.boolean isModified()
boolean isSupportedTestScript()
void setScriptOwner(ScriptOwner owner)
boolean hasSource()
|
T-Plan Robot Enterprise 3.2 Build No. 3.2-20121217.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||