![]() |
T-Plan Robot Enterprise
2.2.1 Doc
Collection Java API Specification |
23/11/10 |
Enhanced scripting capabilities. Java syntax is much more
complex and allows constructions which are not possible with the
limited proprietary scripting language.
Ability to leverage functionality delivered by third party Java libraries in the test code, for example loading of test data from external sources like relational DB (via JDBC), Excel sheets and CSV files (via Java Excel API, JDBC Excel driver or jXLS) or XML (e.g. using JAXP).
Customization. As the API provide interfaces to T-Plan Robot Enterprise internal components like the remote desktop client or scripting engine, it is possible to customize the tool behavior.
Easy integration with other test frameworks through Java native APIs and third party libraries.
Ability to design test scripts through integrated
development
environments (IDE) like NetBeans or Eclipse. These tools are much
more sofisticated in terms of helping programmers to create Java code
in an efficient manner. The Build Instructions
document describes how to set up a project with IDE.
DefaultJavaTestScript
class as is described in its documentation. The class provides a number
of convenience methods accessing functionality provided by the commands
of the proprietary scripting language. JavaTestScript
interface. Though this is sufficient for T-Plan Robot Enterprise to
execute such a test script, you won't have direct access to the
functional methods defined in the DefaultJavaTestScript
class. A workaround is to create an instance of this class with
the test() method empty and then call its methods from
your code. See the class documentation for an example.DefaultJavaTestScript
and DefaultJavaTestScriptConverter
documentation.CommandHandler
interface which defines the command syntax and what is to be done when
the command is compiled or executed. Map of available command handlers
is maintained by the script manager (see below). Be aware that Java
test scripts call internally methods of the command handlers and adding
of a command to the proprietary language will make it available through
the Java API as well (using the generic runScriptCommand()
method of the Java test script). As command handlers are in fact
plugins, it is very easy to add new commands to the language without
having to rebuild the whole product from the source code.JavaTestScriptInterpret
while the proprietary scripting language ones instantiate the ProprietaryTestScriptInterpret
class. A test script interpret is a class which defines:TestScriptInterpret
interface. This makes it eventually possible to implement a custom
interpret and
make T-Plan Robot Enterprise support another language. ScriptingContext
interface which defines keys to all objects which may appear in the
context as well as many convenience get- methods for the most
frequently accessed
ones.addCommandListener()
and addScriptListener() allow to register for various
events fired during the test script life cycle. See the ScriptManager
interface for more information.rfb://localhost:5901
will instantiate the RfbClientImpl
class. Knowing the protocol and the corresponding implementing class
allows you to cast the client reference to the protocol interface and
take advantage of the specific flags and settings to customize its
behavior (in this case settings defined by the RfbClient
interface).getClient() method).
If a script gets executed while a connection to a client already
exists, the method provides access to the client. Otherwise it returns
null until a connection is established through the Connect command.T-Plan Robot Enterprise recognizes the Java format and accepts .java files as regular test scripts
both through CLI (-r option) and GUI. As the Java source
code needs to be compiled to the .class
format first, the tool requires a Java
Development Kit (JDK) to handle it. If you run T-Plan Robot Enterprise
through a Java Runtime Environment
(JRE), the tool will report an error because JRE is a limited
version of Java and does not include the necessary Java Compiler binary
javac.
Test scripts can be also executed as standalone Java programs
through
the main() method. See the DefaultJavaTestScript
class documentation for more information and an example.
DefaultJavaTestScript
class documentation for details and example.