Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Jubula » Static functions in Jubula - HowTo
Static functions in Jubula - HowTo [message #1793227] Wed, 01 August 2018 19:54
Milos Hroudny is currently offline Milos HroudnyFriend
Messages: 17
Registered: June 2017
Junior Member
For many tests are standard tools contained in toolkits sufficient. Anyway it can be handy to use also other than standard pre-defined Jubula functions. We can simply call static functions from Java libraries.
Since the version 8.2.2 Jubula provides the category of modules "Invoke Method" which includes both external method calls and AUT static function calls. We can consider all standard Java functions as AUT static functions. Modules for calling the AUT methods are available in the toolkit unbound_modules_concrete_[8.5], in the path Actions(basic)→InvokeMethod. For calling Java static functions that are available in Java we use <ub_rfl_invoke> and < ub_rfl_invokeAndStore> modules. From module names is there clear that one type of module we use for procedures and another one in case of functions.
If we are working with any Java technology, there is the java.lang package available. This package contains a number of static functions in different libraries. The easiest to use is the Math library.
Let's say that we want to use the static function "Abs". We can create a user defined module <AbsValue> that contains the <ub_rfl_invokeAndStore> module reference configured following way:
VARIABLE_NAME: FunctionResult
FULLY_QUALIFIED_CLASS: java.lang.Math
METHOD_NAME: abs
METHOD_SIGNATURE: java.lang.Integer
METHOD_ARGUMENTS: =ARGUMENT
METHOD_ARGUMENT_SEPARATOR: ''
TIMEOUT_IN_MS: 1000
When applying <AbsValue> module, we configure only the parameter ARGUMENT, e.g. by the value '-555'.
Notice: The method signature (METHOD_SIGNATURE) parameter contains a comma-separated list of parameters. As parameters in the signature of the method must be used wrapper classes, e.g. java.lang.String, java.lang.Number and the like, eventhough the method actually works with simple data types. The actual parameters we write to the METHOD_ARGUMENTS field and we separate them by the character specified in the METHOD_ARGUMENT_SEPARATOR field. It does not necessarily have to be a comma, but it must be a character that does not appear in any of the arguments.
The name of the variable containing the result of the function is "FunctionResult" in this case. We use the variable in the following processing according to our need.
Previous Topic:Testing GUI in different languages - HowTo
Next Topic:Tree Table input text in specific cells?
Goto Forum:
  


Current Time: Thu Sep 20 08:50:08 GMT 2018

Powered by FUDForum. Page generated in 0.02399 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top