This is what the documentation states:
The most common way to use variables in Robot Framework test data is using the scalar variable syntax like ${var}. When this syntax is used, the variable name is replaced with its value as-is. Most of the time variable values are strings, but variables can contain any object, including numbers, lists, dictionaries, or even custom objects.
The example below illustrates the usage of scalar variables. Assuming that the variables ${GREET} and ${NAME} are available and assigned to strings Hello and world, respectively, both the example test cases are equivalent.
*** Test Cases ***
Constants
Log Hello
Log Hello, world!!
Variables
Log ${GREET}
Log ${GREET}, ${NAME}!!
When a scalar variable is used alone without any text or other variables around it, like in ${GREET} above, the variable is replaced with its value as-is and the value can be any object. If the variable is not used alone, like ${GREER}, ${NAME}!! above, its value is first converted into a string and then concatenated with the other data.
So according to this, my usage of the remote library, should provide the object as-is:
List Int32 Conversion
TESTLIB.ListInt32 ParameterType ${LIST_INT32} # Simple test ignoring return value
${converted_list}= TESTLIB.ListInt32 ParameterType ${LIST_INT32} # Test with return value
Lists Should Be Equal ${converted_list} ${LIST_INT32} # Compare return value with argument
But instead, I receive a string, which produces this fault on my remote library server:
Unable to cast object=[1, 2, 3] (typeSystem.String) for List<> conversion.
When hopping into the debugger, I clearly see, that the provided argument is a string, and it would fail execution, since all arguments are type checked.
When attempting to replicate this with simple python xml rpc client I get different results:
def execute_keyword(uri, keyword, *args):
with xmlrpc.client.ServerProxy(uri, encoding='UTF-8', use_builtin_types=True, verbose=True) as proxy:
print(proxy)
try:
print(proxy.run_keyword(keyword, *args))
except xmlrpc.client.Fault as err:
print(err)
func_name = f'ListInt32 ParameterType'
execute_keyword('http://localhost:8270/Testcenter/RobotFramework/Test/KeywordLibrary/TestKeywords', func_name, [intList])
It returns the expected result (the executed keyword):
<ServerProxy for localhost:8270/Testcenter/RobotFramework/Test/KeywordLibrary/TestKeywords>
send: b'POST /Testcenter/RobotFramework/Test/KeywordLibrary/TestKeywords HTTP/1.1
Host: localhost:8270
Accept-Encoding: gzip
Content-Type: text/xml
User-Agent: Python-xmlrpc/3.11
Content-Length: 442
'
send: b"<?xml version='1.0' encoding='UTF-8'?>\n<methodCall>\n<methodName>run_keyword</methodName>\n<params>\n<param>\n<value><string>ListInt32 ParameterType</string></value>\n</param>\n<param>\n<value><array><data>\n<value><array><data>\n<value><int>1</int></value>\n<value><int>2</int></value>\n<value><int>3</int></value>\n<value><int>4</int></value>\n<value><int>5</int></value>\n</data></array></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK
'
header: Content-Length: 1593
header: Content-Type: text/xml
header: Server: Microsoft-HTTPAPI/2.0
header: Date: Tue, 19 Sep 2023 09:13:31 GMT
body: b'<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>status</name>
<value>
<string>PASS</string>
</value>
</member>
<member>
<name>error</name>
<value>
<string />
</value>
</member>
<member>
<name>traceback</name>
<value>
<string />
</value>
</member>
<member>
<name>output</name>
<value>
<string>*DEBUG:1695114811790* KeywordManager Keyword invocation: ListInt32_ParameterType(list=System.Collections.Generic.List`1[System.Int32]) ...
[0]=1
[1]=2
[2]=3
[3]=4
[4]=5
</string>
</value>
</member>
<member>
<name>return</name>
<value>
<array>
<data>
<value>
'
body: b' <i4>1</i4>
</value>
<value>
<i4>2</i4>
</value>
<value>
<i4>3</i4>
</value>
<value>
<i4>4</i4>
</value>
<value>
<i4>5</i4>
</value>
</data>
</array>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>'
{'status': 'PASS', 'error': '', 'traceback': '', 'output': '*DEBUG:1695114811790* KeywordManager Keyword invocation: ListInt32_ParameterType(list=System.Collections.Generic.List`1[System.Int32]) ...\n[0]=1\n[1]=2\n[2]=3\n[3]=4\n[4]=5\n', 'return': [1, 2, 3, 4, 5]}