4 new revisions:
Revision: c4a3b4f365a2
Branch: default
Author: Pekka Klärck
Date: Sat Dec 14 23:01:53 2013 UTC
Log: Remote tests: Separate suite for binary results...
http://code.google.com/p/robotframework/source/detail?r=c4a3b4f365a2
Revision: 4dca6aa4ecde
Branch: default
Author: Pekka Klärck
Date: Sat Dec 14 23:02:55 2013 UTC
Log: remote tests: ooops, logging test didn't actually test log
messages
http://code.google.com/p/robotframework/source/detail?r=4dca6aa4ecde
Revision: 82a1c94623c6
Branch: default
Author: Pekka Klärck
Date: Sat Dec 14 23:04:36 2013 UTC
Log: remote tests: split remote server to separate module, cleanup
http://code.google.com/p/robotframework/source/detail?r=82a1c94623c6
Revision: 501881c44865
Branch: default
Author: Pekka Klärck
Date: Sun Dec 15 00:27:17 2013 UTC
Log: Remote tests: 1) register ports dynamically to avoid collisions,
2) re...
http://code.google.com/p/robotframework/source/detail?r=501881c44865
==============================================================================
Revision: c4a3b4f365a2
Branch: default
Author: Pekka Klärck
Date: Sat Dec 14 23:01:53 2013 UTC
Log: Remote tests: Separate suite for binary results
Update issue 1606
Test also binary in log messages, errors, and traceback.
http://code.google.com/p/robotframework/source/detail?r=c4a3b4f365a2
Added:
/atest/robot/standard_libraries/remote/binary_result.txt
/atest/testdata/standard_libraries/remote/binary_result.txt
/atest/testdata/standard_libraries/remote/binaryresult.py
=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/remote/binary_result.txt Sat Dec 14
23:01:53 2013 UTC
@@ -0,0 +1,19 @@
+*** Settings ***
+Suite Setup Run Remote Tests -v PORT:8273 binary_result.txt
binaryresult.py 8273
+Force Tags regression pybot jybot
+Resource remote_resource.txt
+
+*** Test Cases ***
+Returned
+ Check Test Case ${TESTNAME}
+
+Logged
+ ${tc} = Check Test Case ${TESTNAME}
+ Check Log Message ${tc.kws[0].msgs[0]} ${EMPTY}
+ Check Log Message ${tc.kws[1].msgs[0]} RF
+ Should Be Empty ${tc.kws[2].msgs}
+
+Failed
+ ${tc} = Check Test Case ${TESTNAME}
+ Check Log Message ${tc.kws[0].msgs[0]} Error: RF FAIL
+ Check Log Message ${tc.kws[0].msgs[1]} Traceback: RF DEBUG
=======================================
--- /dev/null
+++ /atest/testdata/standard_libraries/remote/binary_result.txt Sat Dec 14
23:01:53 2013 UTC
@@ -0,0 +1,32 @@
+*** Settings ***
+Library Remote 127.0.0.1:${PORT}
+Library String
+Suite Setup Set Log Level DEBUG
+
+*** Variables ***
+${PORT} 8270
+
+*** Test Cases ***
+Returned
+ [Template] Binary Should Be Returned Correctly
+ \x00\x01\x02 0 1 2
+ RF 82 70
+ ${EMPTY}
+
+Logged
+ [Template] Log Binary
+ 0 0 7
+ 82 70
+ @{EMPTY}
+
+Failed
+ [Documentation] FAIL Error: RF
+ Fail Binary 82 0 0 7 70
+
+
+*** Keywords ***
+Binary Should Be Returned Correctly
+ [Arguments] ${expected} @{ordinals}
+ ${result} = Return Binary @{ordinals}
+ Should Be Equal ${result} ${expected}
+ Should Be Byte String ${result}
=======================================
--- /dev/null
+++ /atest/testdata/standard_libraries/remote/binaryresult.py Sat Dec 14
23:01:53 2013 UTC
@@ -0,0 +1,35 @@
+import sys
+from xmlrpclib import Binary
+
+from remoteserver import RemoteServer
+
+
+class DirectResultRemoteServer(RemoteServer):
+
+ def run_keyword(self, name, args, kwargs=None):
+ return getattr(self.library, name)(*args, **(kwargs or {}))
+
+
+class BinaryResult(object):
+
+ def return_binary(self, *ordinals):
+ return self._result(return_=self._binary(ordinals))
+
+ def log_binary(self, *ordinals):
+ return self._result(output=self._binary(ordinals))
+
+ def fail_binary(self, *ordinals):
+ return self._result(error=self._binary(ordinals, 'Error: '),
+
traceback=self._binary(ordinals, 'Traceback: '))
+
+ def _binary(self, ordinals, extra=''):
+ return Binary(extra + ''.join(chr(int(o)) for o in ordinals))
+
+ def _result(self, return_='', output='', error='', traceback=''):
+ return {'status': 'PASS' if not error else 'FAIL',
+ 'return': return_, 'output': output,
+ 'error': error, 'traceback': traceback}
+
+
+if __name__ == '__main__':
+ DirectResultRemoteServer(BinaryResult(), *sys.argv[1:])
==============================================================================
Revision: 4dca6aa4ecde
Branch: default
Author: Pekka Klärck
Date: Sat Dec 14 23:02:55 2013 UTC
Log: remote tests: ooops, logging test didn't actually test log
messages
http://code.google.com/p/robotframework/source/detail?r=4dca6aa4ecde
Modified:
/atest/robot/standard_libraries/remote/simple_server.txt
/atest/testdata/standard_libraries/remote/simple_server.txt
=======================================
--- /atest/robot/standard_libraries/remote/simple_server.txt Thu Dec 12
22:02:00 2013 UTC
+++ /atest/robot/standard_libraries/remote/simple_server.txt Sat Dec 14
23:02:55 2013 UTC
@@ -17,4 +17,6 @@
Check Test Case ${TESTNAME}
Logging
- Check Test Case ${TESTNAME}
+ ${tc} = Check Test Case ${TESTNAME}
+ Check Log Message ${tc.kws[0].msgs[0]} I can has logz?
+ Check Log Message ${tc.kws[0].msgs[1]} Yezz!! DEBUG
=======================================
--- /atest/testdata/standard_libraries/remote/simple_server.txt Wed Dec 11
18:52:29 2013 UTC
+++ /atest/testdata/standard_libraries/remote/simple_server.txt Sat Dec 14
23:02:55 2013 UTC
@@ -1,6 +1,7 @@
*** Settings ***
Documentation Server has only get_kw_names and run_kw methods and
returns minimal result dictionary.
Library Remote
+Suite Setup Set Log Level DEBUG
*** Test Cases ***
Passing
==============================================================================
Revision: 82a1c94623c6
Branch: default
Author: Pekka Klärck
Date: Sat Dec 14 23:04:36 2013 UTC
Log: remote tests: split remote server to separate module, cleanup
http://code.google.com/p/robotframework/source/detail?r=82a1c94623c6
Added:
/atest/testdata/standard_libraries/remote/arguments.py
Modified:
/atest/robot/standard_libraries/remote/remote_resource.txt
/atest/robot/standard_libraries/remote/type_coersion.txt
/atest/testdata/standard_libraries/remote/remoteserver.py
/atest/testdata/standard_libraries/remote/type_coersion.txt
=======================================
--- /dev/null
+++ /atest/testdata/standard_libraries/remote/arguments.py Sat Dec 14
23:04:36 2013 UTC
@@ -0,0 +1,65 @@
+import sys
+from xmlrpclib import Binary
+
+from remoteserver import RemoteServer
+
+
+class Arguments(object):
+
+ def argument_should_be(self, argument, expected, binary=False):
+ if binary:
+ assert isinstance(argument, Binary), 'Non-binary argument'
+ argument = str(argument)
+ expected = eval(expected)
+ assert argument == expected, '%r != %r' % (argument, expected)
+
+ def kwarg_should_be(self, **kwargs):
+ self.argument_should_be(**kwargs)
+
+ def no_arguments(self):
+ return self._format_args()
+
+ def one_argument(self, arg):
+ return self._format_args(arg)
+
+ def two_arguments(self, arg1, arg2):
+ return self._format_args(arg1, arg2)
+
+ def five_arguments(self, arg1, arg2, arg3, arg4, arg5):
+ return self._format_args(arg1, arg2, arg3, arg4, arg5)
+
+ def arguments_with_default_values(self, arg1, arg2=2, arg3='3'):
+ return self._format_args(arg1, arg2, arg3)
+
+ def varargs(self, *args):
+ return self._format_args(*args)
+
+ def required_defaults_and_varargs(self, req, default='world',
*varargs):
+ return self._format_args(req, default, *varargs)
+
+ def kwargs(self, **kwargs):
+ return self._format_args(**kwargs)
+
+ def args_and_kwargs(self, arg1='default1', arg2='default2', **kwargs):
+ return self._format_args(arg1, arg2, **kwargs)
+
+ def varargs_and_kwargs(self, *varargs, **kwargs):
+ return self._format_args(*varargs, **kwargs)
+
+ def args_varargs_and_kwargs(self, arg1='default1', arg2='default2',
+ *varargs, **kwargs):
+ return self._format_args(arg1, arg2, *varargs, **kwargs)
+
+ def _format_args(self, *args, **kwargs):
+ args += tuple('%s:%s' % (k, self._type(v))
+ for k, v in sorted(kwargs.items()))
+ return ', '.join(self._type(a) for a in args)
+
+ def _type(self, arg):
+ if not isinstance(arg, basestring):
+ return '%s (%s)' % (arg, type(arg).__name__)
+ return arg
+
+
+if __name__ == '__main__':
+ RemoteServer(Arguments(), *sys.argv[1:])
=======================================
--- /atest/robot/standard_libraries/remote/remote_resource.txt Thu Dec 12
22:02:00 2013 UTC
+++ /atest/robot/standard_libraries/remote/remote_resource.txt Sat Dec 14
23:04:36 2013 UTC
@@ -3,7 +3,7 @@
*** Keywords ***
Run Remote Tests
- [Arguments] ${options} ${tests} ${server}=remoteserver.py
${port}=8270
+ [Arguments] ${options} ${tests} ${server}=arguments.py
${port}=8270
Start Remote Server ${server} ${port}
Run Tests ${options} standard_libraries/remote/${tests}
Stop Remote Server ${server}
=======================================
--- /atest/robot/standard_libraries/remote/type_coersion.txt Thu Dec 12
22:19:07 2013 UTC
+++ /atest/robot/standard_libraries/remote/type_coersion.txt Sat Dec 14
23:04:36 2013 UTC
@@ -48,6 +48,3 @@
Mapping
Check Test Case ${TESTNAME}
-
-Returned binary
- Check Test Case ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/remote/remoteserver.py Thu Dec 12
22:19:07 2013 UTC
+++ /atest/testdata/standard_libraries/remote/remoteserver.py Sat Dec 14
23:04:36 2013 UTC
@@ -1,7 +1,5 @@
-import sys
import inspect
from SimpleXMLRPCServer import SimpleXMLRPCServer
-from xmlrpclib import Binary
class RemoteServer(SimpleXMLRPCServer):
@@ -38,67 +36,3 @@
else:
return {'status': 'PASS',
'return': result if result is not None else ''}
-
-
-class Library(object):
-
- def argument_should_be(self, argument, expected, binary=False):
- if binary:
- assert isinstance(argument, Binary), 'Non-binary argument'
- argument = str(argument)
- expected = eval(expected)
- assert argument == expected, '%r != %r' % (argument, expected)
-
- def kwarg_should_be(self, **kwargs):
- self.argument_should_be(**kwargs)
-
- def return_binary(self, *ordinals):
- return Binary(''.join(chr(int(o)) for o in ordinals))
-
- def no_arguments(self):
- return self._format_args()
-
- def one_argument(self, arg):
- return self._format_args(arg)
-
- def two_arguments(self, arg1, arg2):
- return self._format_args(arg1, arg2)
-
- def five_arguments(self, arg1, arg2, arg3, arg4, arg5):
- return self._format_args(arg1, arg2, arg3, arg4, arg5)
-
- def arguments_with_default_values(self, arg1, arg2=2, arg3='3'):
- return self._format_args(arg1, arg2, arg3)
-
- def varargs(self, *args):
- return self._format_args(*args)
-
- def required_defaults_and_varargs(self, req, default='world',
*varargs):
- return self._format_args(req, default, *varargs)
-
- def kwargs(self, **kwargs):
- return self._format_args(**kwargs)
-
- def args_and_kwargs(self, arg1='default1', arg2='default2', **kwargs):
- return self._format_args(arg1, arg2, **kwargs)
-
- def varargs_and_kwargs(self, *varargs, **kwargs):
- return self._format_args(*varargs, **kwargs)
-
- def args_varargs_and_kwargs(self, arg1='default1', arg2='default2',
- *varargs, **kwargs):
- return self._format_args(arg1, arg2, *varargs, **kwargs)
-
- def _format_args(self, *args, **kwargs):
- args += tuple('%s:%s' % (k, self._type(v))
- for k, v in sorted(kwargs.items()))
- return ', '.join(self._type(a) for a in args)
-
- def _type(self, arg):
- if not isinstance(arg, basestring):
- return '%s (%s)' % (arg, type(arg).__name__)
- return arg
-
-
-if __name__ == '__main__':
- RemoteServer(Library(), *sys.argv[1:])
=======================================
--- /atest/testdata/standard_libraries/remote/type_coersion.txt Thu Dec 12
22:19:07 2013 UTC
+++ /atest/testdata/standard_libraries/remote/type_coersion.txt Sat Dec 14
23:04:36 2013 UTC
@@ -2,7 +2,6 @@
Test Template Argument Should Be Passed Correctly
Library Remote 127.0.0.1:${PORT}
Library Helper.py
-Library String
Variables variables.py
*** Variables ***
@@ -79,11 +78,6 @@
${MyMapping()} {}
${MyMapping(a='one', b=2, c=[None, True])} {'a': 'one', 'b':
2, 'c': ['', True]}
-Returned binary
- [Template] Binary Should Be Returned Correctly
- \x00\x01\x02 0 1 2
- RF 82 70
- ${EMPTY}
*** Keywords ***
Argument Should Be Passed Correctly
@@ -92,9 +86,3 @@
${argument} = Evaluate If String ${argument}
Argument Should Be ${argument} ${expected} ${binary}
Kwarg Should Be argument=${argument} expected=${expected}
binary=${binary}
-
-Binary Should Be Returned Correctly
- [Arguments] ${expected} @{ordinals}
- ${result} = Return Binary @{ordinals}
- Should Be Equal ${result} ${expected}
- Should Be Byte String ${result}
==============================================================================
Revision: 501881c44865
Branch: default
Author: Pekka Klärck
Date: Sun Dec 15 00:27:17 2013 UTC
Log: Remote tests: 1) register ports dynamically to avoid collisions,
2) redirect server output to file to avoid hanging due to filled output
buffers. this hopefully resolves problems on win ci.
http://code.google.com/p/robotframework/source/detail?r=501881c44865
Modified:
/atest/robot/standard_libraries/remote/arguments.txt
/atest/robot/standard_libraries/remote/binary_result.txt
/atest/robot/standard_libraries/remote/remote_resource.txt
/atest/robot/standard_libraries/remote/simple_server.txt
/atest/robot/standard_libraries/remote/type_coersion.txt
/atest/testdata/standard_libraries/remote/remoteserver.py
/atest/testdata/standard_libraries/remote/simple_server.txt
/atest/testdata/standard_libraries/remote/simpleserver.py
=======================================
--- /atest/robot/standard_libraries/remote/arguments.txt Thu Dec 12
22:02:00 2013 UTC
+++ /atest/robot/standard_libraries/remote/arguments.txt Sun Dec 15
00:27:17 2013 UTC
@@ -1,5 +1,5 @@
*** Settings ***
-Suite Setup Run Remote Tests -v PORT:8271 arguments.txt
port=8271
+Suite Setup Run Remote Tests arguments.txt arguments.py
Force Tags regression pybot jybot
Resource remote_resource.txt
=======================================
--- /atest/robot/standard_libraries/remote/binary_result.txt Sat Dec 14
23:01:53 2013 UTC
+++ /atest/robot/standard_libraries/remote/binary_result.txt Sun Dec 15
00:27:17 2013 UTC
@@ -1,5 +1,5 @@
*** Settings ***
-Suite Setup Run Remote Tests -v PORT:8273 binary_result.txt
binaryresult.py 8273
+Suite Setup Run Remote Tests binary_result.txt binaryresult.py
Force Tags regression pybot jybot
Resource remote_resource.txt
=======================================
--- /atest/robot/standard_libraries/remote/remote_resource.txt Sat Dec 14
23:04:36 2013 UTC
+++ /atest/robot/standard_libraries/remote/remote_resource.txt Sun Dec 15
00:27:17 2013 UTC
@@ -1,19 +1,26 @@
*** Settings ***
Resource atest_resource.txt
+*** Variables ***
+${PORT FILE} %{TEMPDIR}${/}remote_port.txt
+${STDOUT FILE} %{TEMPDIR}${/}remote_output.txt
+
*** Keywords ***
Run Remote Tests
- [Arguments] ${options} ${tests} ${server}=arguments.py
${port}=8270
- Start Remote Server ${server} ${port}
- Run Tests ${options} standard_libraries/remote/${tests}
+ [Arguments] ${tests} ${server}
+ ${port} = Start Remote Server ${server}
+ Run Tests --variable PORT:${port}
standard_libraries/remote/${tests}
Stop Remote Server ${server}
Start Remote Server
- [Arguments] ${server} ${port}
+ [Arguments] ${server} ${port}=0
+ Remove File ${PORT FILE}
${path} = Normalize Path
${DATADIR}/standard_libraries/remote/${server}
- Start Process python ${path} ${port} alias=${server}
stderr=STDOUT
- Sleep 0.1s Give process time to end if starting failed.
- Process Should Be Running handle=${server}
+ Start Process python ${path} ${port} ${PORT FILE}
+ ... alias=${server} stdout=${STDOUT FILE} stderr=STDOUT
+ Wait Until Created ${PORT FILE}
+ ${port} = Get File ${PORT FILE}
+ [Return] ${port}
Stop Remote Server
[Arguments] ${server}
=======================================
--- /atest/robot/standard_libraries/remote/simple_server.txt Sat Dec 14
23:02:55 2013 UTC
+++ /atest/robot/standard_libraries/remote/simple_server.txt Sun Dec 15
00:27:17 2013 UTC
@@ -1,5 +1,5 @@
*** Settings ***
-Suite Setup Run Remote Tests ${EMPTY} simple_server.txt
server=simpleserver.py
+Suite Setup Run Remote Tests simple_server.txt simpleserver.py
Force Tags regression pybot jybot
Resource remote_resource.txt
=======================================
--- /atest/robot/standard_libraries/remote/type_coersion.txt Sat Dec 14
23:04:36 2013 UTC
+++ /atest/robot/standard_libraries/remote/type_coersion.txt Sun Dec 15
00:27:17 2013 UTC
@@ -1,5 +1,5 @@
*** Settings ***
-Suite Setup Run Remote Tests -v PORT:8272 type_coersion.txt
port=8272
+Suite Setup Run Remote Tests type_coersion.txt arguments.py
Force Tags regression pybot jybot
Resource remote_resource.txt
=======================================
--- /atest/testdata/standard_libraries/remote/remoteserver.py Sat Dec 14
23:04:36 2013 UTC
+++ /atest/testdata/standard_libraries/remote/remoteserver.py Sun Dec 15
00:27:17 2013 UTC
@@ -1,15 +1,17 @@
import inspect
+import sys
from SimpleXMLRPCServer import SimpleXMLRPCServer
class RemoteServer(SimpleXMLRPCServer):
- def __init__(self, library, port=8270):
+ def __init__(self, library, port=8270, port_file=None):
SimpleXMLRPCServer.__init__(self, ('127.0.0.1', int(port)))
self.library = library
self.register_function(self.get_keyword_names)
self.register_function(self.get_keyword_arguments)
self.register_function(self.run_keyword)
+ announce_port(self.socket, port_file)
self.serve_forever()
def get_keyword_names(self):
@@ -36,3 +38,12 @@
else:
return {'status': 'PASS',
'return': result if result is not None else ''}
+
+
+def announce_port(socket, port_file=None):
+ port = socket.getsockname()[1]
+ sys.stdout.write('Remote server starting on port %s.\n' % port)
+ sys.stdout.flush()
+ if port_file:
+ with open(port_file, 'w') as f:
+ f.write(str(port))
=======================================
--- /atest/testdata/standard_libraries/remote/simple_server.txt Sat Dec 14
23:02:55 2013 UTC
+++ /atest/testdata/standard_libraries/remote/simple_server.txt Sun Dec 15
00:27:17 2013 UTC
@@ -1,8 +1,11 @@
*** Settings ***
Documentation Server has only get_kw_names and run_kw methods and
returns minimal result dictionary.
-Library Remote
+Library Remote 127.0.0.1:${PORT}
Suite Setup Set Log Level DEBUG
+*** Variables ***
+${PORT} 8270
+
*** Test Cases ***
Passing
Passing
=======================================
--- /atest/testdata/standard_libraries/remote/simpleserver.py Wed Dec 11
23:16:03 2013 UTC
+++ /atest/testdata/standard_libraries/remote/simpleserver.py Sun Dec 15
00:27:17 2013 UTC
@@ -1,15 +1,15 @@
import sys
from SimpleXMLRPCServer import SimpleXMLRPCServer
+from remoteserver import announce_port
class SimpleServer(SimpleXMLRPCServer):
- def __init__(self, port=8270):
+ def __init__(self, port=8270, port_file=None):
SimpleXMLRPCServer.__init__(self, ('127.0.0.1', int(port)))
self.register_function(self.get_keyword_names)
self.register_function(self.run_keyword)
- sys.stdout.write('Remote server starting on port %s.\n' % port)
- sys.stdout.flush()
+ announce_port(self.socket, port_file)
self.serve_forever()
def get_keyword_names(self):
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.