3 new revisions:
Revision: 09855249be4c
Author: Pekka Klärck
Date: Sun Jan 1 13:38:22 2012
Log: handle logging of succesfull imports in Importer
http://code.google.com/p/robotframework/source/detail?r=09855249be4c
Revision: 78ed1e47eac8
Author: Pekka Klärck
Date: Sun Jan 1 15:02:56 2012
Log: Logging where librarie and listeners were imported is now taken
care b...
http://code.google.com/p/robotframework/source/detail?r=78ed1e47eac8
Revision: 82f2be7aa181
Author: Pekka Klärck
Date: Sun Jan 1 15:03:52 2012
Log: Fixed tests after changing how library and listener source is
syslogge...
http://code.google.com/p/robotframework/source/detail?r=82f2be7aa181
==============================================================================
Revision: 09855249be4c
Author: Pekka Klärck
Date: Sun Jan 1 13:38:22 2012
Log: handle logging of succesfull imports in Importer
http://code.google.com/p/robotframework/source/detail?r=09855249be4c
Modified:
/src/robot/utils/importer.py
/utest/utils/test_importer_util.py
=======================================
--- /src/robot/utils/importer.py Fri Dec 23 10:42:38 2011
+++ /src/robot/utils/importer.py Sun Jan 1 13:38:22 2012
@@ -38,8 +38,9 @@
class Importer(object):
_import_path_endings = ('.py', '.java', '.class', '/', os.sep)
- def __init__(self, type=None):
+ def __init__(self, type=None, logger=None):
self._type = type or ''
+ self._logger = logger
def import_module_by_path(self, path):
"""Import a Python module or Java class using a file system path.
@@ -59,6 +60,7 @@
except DataError, err:
self._raise_import_failed(path, err)
else:
+ self._log_import_succeeded(item, item.__name__, path)
return item
def _verify_import_path(self, path):
@@ -84,8 +86,8 @@
return module_dir, module_name
def _raise_import_failed(self, name, error):
- type = '%s ' % self._type if self._type else ''
- msg = "Importing %s'%s' failed: %s" % (type, name, error.message)
+ import_type = '%s ' % self._type if self._type else ''
+ msg = "Importing %s'%s' failed: %s" % (import_type, name,
error.message)
if not error.details:
raise DataError(msg)
msg = [msg, '', error.details]
@@ -95,6 +97,14 @@
msg.extend(self._get_items_in('CLASSPATH', classpath))
raise DataError('\n'.join(msg))
+ def _log_import_succeeded(self, item, name, source):
+ if self._logger:
+ import_type = '%s ' % self._type if self._type else ''
+ item_type = 'module' if inspect.ismodule(item) else 'class'
+ location = ("'%s'" % source) if source else 'unknown location'
+ self._logger.info("Imported %s%s '%s' from %s."
+ % (import_type, item_type, name, location))
+
def _get_items_in(self, type, items):
yield '\n%s:' % type
for item in items:
@@ -121,7 +131,8 @@
except DataError, err:
self._raise_import_failed(name, err)
else:
- return imported, source
+ self._log_import_succeeded(imported, name, source)
+ return imported
def _import_class_or_module(self, name):
if self._is_valid_import_path(name):
=======================================
--- /utest/utils/test_importer_util.py Fri Dec 23 11:10:10 2011
+++ /utest/utils/test_importer_util.py Sun Jan 1 13:38:22 2012
@@ -24,6 +24,22 @@
assert_equals(prefix, expected)
+class LoggerStub(object):
+
+ def __init__(self, remove_extension=False):
+ self.messages = []
+ self.remove_extension = remove_extension
+
+ def info(self, msg):
+ if self.remove_extension:
+ for ext in '$py.class', '.pyc', '.py':
+ msg = msg.replace(ext, '')
+ self.messages.append(msg)
+
+ def assert_message(self, msg):
+ assert_equals(self.messages, [msg])
+
+
class TestImportByPath(unittest.TestCase):
def setUp(self):
@@ -64,6 +80,18 @@
error = assert_raises(DataError, self._import_and_verify, path)
assert_prefix(error, "Importing '%s' failed: SyntaxError:" % path)
+ def test_logging_when_importing_module(self):
+ logger = LoggerStub()
+ path = join(LIBDIR, 'classes.py')
+ Importer('test library', logger).import_module_by_path(path)
+ logger.assert_message("Imported test library module 'classes'
from '%s'." % path)
+
+ def test_logging_when_importing_python_class(self):
+ logger = LoggerStub()
+ path = join(LIBDIR, 'ExampleLibrary.py')
+ Importer(logger=logger).import_module_by_path(path)
+ logger.assert_message("Imported class 'ExampleLibrary'
from '%s'." % path)
+
if sys.platform.startswith('java'):
def test_java_class(self):
@@ -77,6 +105,12 @@
"module, got <javapackage>." % path,
self._import, path)
+ def test_logging_when_importing_java_class(self):
+ logger = LoggerStub()
+ path = join(CURDIR, 'ImportByPath.java')
+ Importer('java', logger).import_module_by_path(path)
+ logger.assert_message("Imported java class 'ImportByPath'
from '%s'." % path)
+
def _create_file(self, name, attr=42, extra_content=''):
path = join(TESTDIR, name)
with open(path, 'w') as file:
@@ -199,14 +233,26 @@
finally:
os.remove(path)
+ def test_logging_when_importing_module(self):
+ logger = LoggerStub(remove_extension=True)
+ self._import_module('classes', 'test library', logger)
+ logger.assert_message("Imported test library module 'classes'
from '%s'."
+ % join(LIBDIR, 'classes'))
+
+ def test_logging_when_importing_python_class(self):
+ logger = LoggerStub(remove_extension=True)
+ self._import_class('ExampleLibrary', logger=logger)
+ logger.assert_message("Imported class 'ExampleLibrary' from '%s'."
+ % join(LIBDIR, 'ExampleLibrary'))
+
if sys.platform.startswith('java'):
def test_import_java_class(self):
- klass = self._import_class('ExampleJavaLibrary',
has_source=False)
+ klass = self._import_class('ExampleJavaLibrary')
assert_equals(klass().getCount(), 1)
def test_import_java_class_in_package(self):
- klass = self._import_class('javapkg.JavaPackageExample',
has_source=False)
+ klass = self._import_class('javapkg.JavaPackageExample')
assert_equals(klass().returnValue('xmas'), 'xmas')
def test_import_java_file_by_path(self):
@@ -222,23 +268,24 @@
"Expected class or module, got
<javapackage>.",
self._import, 'javapkg', 'test library')
- def _import_module(self, name, type=None, has_source=True):
- module = self._import(name, type, has_source)
+ def test_logging_when_importing_java_class(self):
+ logger = LoggerStub()
+ self._import_class('ExampleJavaLibrary', 'java', logger)
+ logger.assert_message("Imported java
class 'ExampleJavaLibrary' "
+ "from unknown location.")
+
+ def _import_module(self, name, type=None, logger=None):
+ module = self._import(name, type, logger)
assert_true(inspect.ismodule(module))
return module
- def _import_class(self, name, type=None, has_source=True):
- klass = self._import(name, type, has_source)
+ def _import_class(self, name, type=None, logger=None):
+ klass = self._import(name, type, logger)
assert_true(inspect.isclass(klass))
return klass
- def _import(self, name, type=None, has_source=True):
- item, source = Importer(type).import_class_or_module(name)
- if has_source:
- assert_true(isabs(source))
- else:
- assert_true(source is None)
- return item
+ def _import(self, name, type=None, logger=None):
+ return Importer(type, logger).import_class_or_module(name)
if __name__ == '__main__':
==============================================================================
Revision: 78ed1e47eac8
Author: Pekka Klärck
Date: Sun Jan 1 15:02:56 2012
Log: Logging where librarie and listeners were imported is now taken
care by Importer and nobody else needs source for anything.
http://code.google.com/p/robotframework/source/detail?r=78ed1e47eac8
Modified:
/src/robot/output/listeners.py
/src/robot/running/importer.py
/src/robot/running/testlibraries.py
=======================================
--- /src/robot/output/listeners.py Fri Dec 23 10:41:19 2011
+++ /src/robot/output/listeners.py Sun Jan 1 15:02:56 2012
@@ -217,14 +217,12 @@
self.is_java = utils.is_jython and isinstance(listener, Object)
def _import_listener(self, name, args):
- importer = utils.Importer('listener')
- listener, source =
importer.import_class_or_module(os.path.normpath(name))
+ importer = utils.Importer('listener', logger=LOGGER)
+ listener = importer.import_class_or_module(os.path.normpath(name))
if not inspect.ismodule(listener):
listener = listener(*args)
elif args:
raise DataError("Listeners implemented as modules do not take
arguments")
- LOGGER.info("Imported listener '%s' with arguments %s (source %s)"
- % (name, utils.seq2str2(args), source))
return listener
def _get_version(self, listener):
=======================================
--- /src/robot/running/importer.py Wed Dec 21 12:01:33 2011
+++ /src/robot/running/importer.py Sun Jan 1 15:02:56 2012
@@ -55,10 +55,10 @@
lib.create_handlers()
self._library_cache[key] = lib
libtype = lib.__class__.__name__.replace('Library', '').lower()[1:]
- LOGGER.info("Imported library '%s' with arguments %s (version %s, "
- "%s type, %s scope, %d keywords, source %s)"
- % (name, utils.seq2str2(positional), lib.version,
libtype,
- lib.scope.lower(), len(lib), lib.source))
+ LOGGER.info("Imported library '%s' with arguments %s "
+ "(version %s, %s type, %s scope, %d keywords)"
+ % (name, utils.seq2str2(positional), lib.version,
+ libtype, lib.scope.lower(), len(lib)))
if not lib:
LOGGER.warn("Imported library '%s' contains no keywords" %
name)
return lib
=======================================
--- /src/robot/running/testlibraries.py Fri Dec 23 10:26:59 2011
+++ /src/robot/running/testlibraries.py Sun Jan 1 15:02:56 2012
@@ -33,10 +33,10 @@
def TestLibrary(name, args=None, variables=None, create_handlers=True):
with OutputCapturer(library_import=True):
- importer = utils.Importer('test library')
- libcode, source = importer.import_class_or_module(name)
+ importer = utils.Importer('test library', logger=LOGGER)
+ libcode = importer.import_class_or_module(name)
libclass = _get_lib_class(libcode)
- lib = libclass(libcode, source, name, args or [], variables)
+ lib = libclass(libcode, name, args or [], variables)
if create_handlers:
lib.create_handlers()
return lib
@@ -89,10 +89,9 @@
_log_failure = LOGGER.info
_log_failure_details = LOGGER.debug
- def __init__(self, libcode, source, name, args, variables):
+ def __init__(self, libcode, name, args, variables):
if os.path.exists(name):
name =
os.path.splitext(os.path.basename(os.path.abspath(name)))[0]
- self.source = source
self.version = self._get_version(libcode)
self.name = name
self.orig_name = name # Stores original name also after copying
@@ -321,8 +320,8 @@
class _DynamicLibrary(_BaseTestLibrary):
_log_failure = LOGGER.warn
- def __init__(self, libcode, source, name, args, variables=None):
- _BaseTestLibrary.__init__(self, libcode, source, name, args,
variables)
+ def __init__(self, libcode, name, args, variables=None):
+ _BaseTestLibrary.__init__(self, libcode, name, args, variables)
self._get_kw_doc = \
_DynamicMethod(libcode, 'get_keyword_documentation',
default='')
self._get_kw_args = \
==============================================================================
Revision: 82f2be7aa181
Author: Pekka Klärck
Date: Sun Jan 1 15:03:52 2012
Log: Fixed tests after changing how library and listener source is
syslogged.
http://code.google.com/p/robotframework/source/detail?r=82f2be7aa181
Modified:
/atest/robot/output/listener_interface/importing_listeners.txt
/atest/robot/output/listener_interface/listener_resource.txt
/atest/robot/output/listener_interface/old_importing_listeners.txt
/atest/robot/test_libraries/java_library_imports_with_args.txt
/atest/robot/test_libraries/libraries_extending_existing_classes.txt
/atest/robot/test_libraries/library_import_from_archive.txt
/atest/robot/test_libraries/library_imports.txt
/atest/robot/test_libraries/module_library.txt
=======================================
--- /atest/robot/output/listener_interface/importing_listeners.txt Wed Apr
14 05:51:53 2010
+++ /atest/robot/output/listener_interface/importing_listeners.txt Sun Jan
1 15:03:52 2012
@@ -1,55 +1,72 @@
*** Settings ***
-Suite Setup Run Tests --listener ListenAll --listener
listeners.ListenSome --listener module_listener --listener
listeners.WithArgs:value --listener listeners.WithArgs:a1:a2 --listener
${LISTENERS}${/}ListenAll.py:${TEMPDIR}${/}${ALL_FILE2} --listener
listeners.WithArgs --listener listeners.WithArgs:1:2:3 --listener
JavaListener --listener JavaListenerWithArgs:Hello:world --listener
JavaListenerWithArgs --listener JavaListenerWithArgs:b:a:r --listener
NonExistingListener misc${/}pass_and_fail.html
+Suite Setup Run Tests With Listeners
Suite Teardown Remove Listener Files
Force Tags regression
Default Tags pybot jybot
Resource listener_resource.txt
+Test Template Listener Import Message Should Be In Syslog
*** Test Cases ***
Python Class Listener From Module With Same Name
- Listener Import Message Should Be In Syslog ListenAll [ ] ListenAll
+ class ListenAll ListenAll
Python Class Listener From A Module With Different Name
- Listener Import Message Should Be In Syslog listeners.ListenSome [
] listeners
+ class listeners.ListenSome listeners
Python Module Listener
- Listener Import Message Should Be In Syslog module_listener [ ]
module_listener
+ module module_listener module_listener
Listener With Arguments
- Listener Import Message Should Be In Syslog listeners.WithArgs [
value ] listeners
- Listener Import Message Should Be In Syslog listeners.WithArgs [ a1
| a2 ] listeners
- Check Listener File ${ARGS_FILE} I got arguments 'value'
and 'default' I got arguments 'a1' and 'a2'
+ class listeners.WithArgs listeners 4
+ [Teardown] Check Listener File ${ARGS_FILE}
+ ... I got arguments 'value' and 'default' I got arguments 'a1'
and 'a2'
Listener With Path
- ${expected args} = Set Variable If ${TEMPDIR.count(':')}
${TEMPDIR[0]} | ${TEMPDIR[2:]}${/}${ALL_FILE2} ${TEMPDIR}${/}${ALL_FILE2}
- Listener Import Message Should Be In Syslog
${LISTENERS}${/}ListenAll.py [ ${expected args} ] ListenAll
- File Should Exist ${TEMPDIR}${/}${ALL_FILE2}
+ class ${LISTENERS}${/}ListenAll.py ListenAll
+ [Teardown] File Should Exist ${TEMPDIR}${/}${ALL_FILE2}
Listener With Wrong Number Of Arguments
- Check Syslog contains Taking listener 'listeners.WithArgs' into use
failed: TypeError: __init__() takes at least 2 arguments (1 given)
- Check Syslog contains Taking listener 'listeners.WithArgs:1:2:3' into
use failed: TypeError: __init__()
+ [Template] Check Syslog Contains
+ Taking listener 'listeners.WithArgs' into use failed: TypeError:
__init__() takes at least 2 arguments (1 given)
+ Taking listener 'listeners.WithArgs:1:2:3' into use failed: TypeError:
__init__()
Non Existing Listener
- Check Syslog contains Taking listener 'NonExistingListener' into use
failed: Importing listener 'NonExistingListener' failed: ImportError:
+ [Template] Check Syslog Contains
+ Taking listener 'NonExistingListener' into use failed: Importing
listener 'NonExistingListener' failed: ImportError:
Java Listener
[Tags] jybot
- Listener Import Message Should Be In Syslog JavaListener [ ]
+ class JavaListener
Java Listener With Arguments
[Tags] jybot
- Listener Import Message Should Be In Syslog JavaListenerWithArgs [
Hello | world ]
- Check Listener File ${JAVA_ARGS_FILE} I got arguments 'Hello'
and 'world'
+ class JavaListenerWithArgs count=3
+ [Teardown] Check Listener File ${JAVA_ARGS_FILE}
+ ... I got arguments 'Hello' and 'world'
Java Listener With Wrong Number Of Arguments
[Tags] jybot
- Check Syslog contains Taking listener 'JavaListenerWithArgs' into use
failed: TypeError: JavaListenerWithArgs(): expected 2 args; got 0
- Check Syslog contains Taking listener 'JavaListenerWithArgs:b:a:r'
into use failed: TypeError: JavaListenerWithArgs(): expected 2 args; got 3
+ [Template] Check Syslog Contains
+ Taking listener 'JavaListenerWithArgs' into use failed: TypeError:
JavaListenerWithArgs(): expected 2 args; got 0
+ Taking listener 'JavaListenerWithArgs:b:a:r' into use failed:
TypeError: JavaListenerWithArgs(): expected 2 args; got 3
+
*** Keywords ***
-Listener Import Message Should Be In Syslog
- [Arguments] ${name} ${args} ${source}=<unknown>
- ${module_path} = Join Path ${LISTENERS} ${source}
- ${source} = Set Variable If '${source}' != '<unknown>'
${module_path} <unknown>
- Check Syslog Contains Imported listener '${name}' with arguments
${args} (source ${source}
-
+
+Run Tests With Listeners
+ ${listeners} = Catenate
+ ... --listener ListenAll
+ ... --listener listeners.ListenSome
+ ... --listener module_listener
+ ... --listener listeners.WithArgs:value
+ ... --listener listeners.WithArgs:a1:a2
+ ... --listener
${LISTENERS}${/}ListenAll.py:${TEMPDIR}${/}${ALL_FILE2}
+ ... --listener listeners.WithArgs
+ ... --listener listeners.WithArgs:1:2:3
+ ... --listener JavaListener
+ ... --listener JavaListenerWithArgs:Hello:world
+ ... --listener JavaListenerWithArgs
+ ... --listener JavaListenerWithArgs:b:a:r
+ ... --listener NonExistingListener
+ Run Tests ${listeners} misc/pass_and_fail.html
+
=======================================
--- /atest/robot/output/listener_interface/listener_resource.txt Tue Jul 12
02:22:53 2011
+++ /atest/robot/output/listener_interface/listener_resource.txt Sun Jan 1
15:03:52 2012
@@ -16,6 +16,15 @@
${LISTENERS} ${CURDIR}${/}..${/}..${/}..${/}testresources${/}listeners
*** Keywords ***
+
+Listener Import Message Should Be In Syslog
+ [Arguments] ${type} ${name or path} ${source}= ${count}=1
+ ${name or path} = Normalize Path ${name or path}
+ ${module_path} = Join Path ${LISTENERS} ${source}
+ ${location} = Set Variable If '${source}' '${module_path}
unknown location.
+ ${syslog} = Get syslog
+ Should Contain X Times ${syslog} Imported listener
${type} '${name or path}' from ${location} ${count}
+
Remove Listener Files
Remove Files ${TEMPDIR}${/}${ALL_FILE} ${TEMPDIR}${/}${SOME_FILE}
${JAVATEMPDIR}${/}${JAVA_FILE} ${TEMPDIR}${/}${ARGS_FILE}
${TEMPDIR}${/}${ALL_FILE2} ${TEMPDIR}${/}${MODULE_FILE}
${JAVATEMPDIR}${/}${JAVA_ARGS_FILE}
... ${TEMPDIR}${/}${ATTR_TYPE_FILE}
${JAVATEMPDIR}${/}${JAVA_ATTR_TYPE_FILE}
=======================================
--- /atest/robot/output/listener_interface/old_importing_listeners.txt Wed
Apr 14 05:51:53 2010
+++ /atest/robot/output/listener_interface/old_importing_listeners.txt Sun
Jan 1 15:03:52 2012
@@ -1,55 +1,71 @@
*** Settings ***
-Suite Setup Run Tests --listener OldListenAll --listener
old_listeners.ListenSome --listener old_module_listener --listener
old_listeners.WithArgs:value --listener old_listeners.WithArgs:a1:a2
--listener ${LISTENERS}${/}OldListenAll.py:${TEMPDIR}${/}${ALL_FILE2}
--listener old_listeners.WithArgs --listener old_listeners.WithArgs:1:2:3
--listener OldJavaListener --listener OldJavaListenerWithArgs:Hello:world
--listener OldJavaListenerWithArgs --listener OldJavaListenerWithArgs:b:a:r
--listener NonExistingListener misc${/}pass_and_fail.html
+Suite Setup Run Tests With Listeners
Suite Teardown Remove Listener Files
Force Tags regression
Default Tags pybot jybot
Resource listener_resource.txt
+Test Template Listener Import Message Should Be In Syslog
*** Test Cases ***
Python Class Listener From Module With Same Name
- Listener Import Message Should Be In Syslog OldListenAll [ ]
OldListenAll
+ class OldListenAll OldListenAll
Python Class Listener From A Module With Different Name
- Listener Import Message Should Be In Syslog old_listeners.ListenSome
[ ] old_listeners
+ class old_listeners.ListenSome old_listeners
Python Module Listener
- Listener Import Message Should Be In Syslog old_module_listener [ ]
old_module_listener
+ module old_module_listener old_module_listener
Listener With Arguments
- Listener Import Message Should Be In Syslog old_listeners.WithArgs [
value ] old_listeners
- Listener Import Message Should Be In Syslog old_listeners.WithArgs [
a1 | a2 ] old_listeners
- Check Listener File ${ARGS_FILE} I got arguments 'value'
and 'default' I got arguments 'a1' and 'a2'
+ class old_listeners.WithArgs old_listeners 4
+ [Teardown] Check Listener File ${ARGS_FILE}
+ ... I got arguments 'value' and 'default' I got arguments 'a1'
and 'a2'
Listener With Path
- ${expected args} = Set Variable If ${TEMPDIR.count(':')}
${TEMPDIR[0]} | ${TEMPDIR[2:]}${/}${ALL_FILE2} ${TEMPDIR}${/}${ALL_FILE2}
- Listener Import Message Should Be In Syslog
${LISTENERS}${/}OldListenAll.py [ ${expected args} ] OldListenAll
- File Should Exist ${TEMPDIR}${/}${ALL_FILE2}
+ class ${LISTENERS}${/}OldListenAll.py OldListenAll
+ [Teardown] File Should Exist ${TEMPDIR}${/}${ALL_FILE2}
Listener With Wrong Number Of Arguments
- Check Syslog contains Taking listener 'old_listeners.WithArgs' into
use failed: TypeError: __init__() takes at least 2 arguments (1 given)
- Check Syslog contains Taking listener 'old_listeners.WithArgs:1:2:3'
into use failed: TypeError: __init__()
+ [Template] Check Syslog contains
+ Taking listener 'old_listeners.WithArgs' into use failed: TypeError:
__init__() takes at least 2 arguments (1 given)
+ Taking listener 'old_listeners.WithArgs:1:2:3' into use failed:
TypeError: __init__()
Non Existing Listener
- Check Syslog contains Taking listener 'NonExistingListener' into use
failed: Importing listener 'NonExistingListener' failed: ImportError:
+ [Template] Check Syslog contains
+ Taking listener 'NonExistingListener' into use failed: Importing
listener 'NonExistingListener' failed: ImportError:
Java Listener
[Tags] jybot
- Listener Import Message Should Be In Syslog OldJavaListener [ ]
+ class OldJavaListener
Java Listener With Arguments
[Tags] jybot
- Listener Import Message Should Be In Syslog OldJavaListenerWithArgs
[ Hello | world ]
- Check Listener File ${JAVA_ARGS_FILE} I got arguments 'Hello'
and 'world'
+ class OldJavaListenerWithArgs count=3
+ [Teardown] Check Listener File ${JAVA_ARGS_FILE}
+ ... I got arguments 'Hello' and 'world'
Java Listener With Wrong Number Of Arguments
[Tags] jybot
- Check Syslog contains Taking listener 'OldJavaListenerWithArgs' into
use failed: TypeError: OldJavaListenerWithArgs(): expected 2 args; got 0
- Check Syslog contains Taking listener 'OldJavaListenerWithArgs:b:a:r'
into use failed: TypeError: OldJavaListenerWithArgs(): expected 2 args; got
3
+ [Template] Check Syslog contains
+ Taking listener 'OldJavaListenerWithArgs' into use failed: TypeError:
OldJavaListenerWithArgs(): expected 2 args; got 0
+ Taking listener 'OldJavaListenerWithArgs:b:a:r' into use failed:
TypeError: OldJavaListenerWithArgs(): expected 2 args; got 3
+
*** Keywords ***
-Listener Import Message Should Be In Syslog
- [Arguments] ${name} ${args} ${source}=<unknown>
- ${module_path} = Join Path ${LISTENERS} ${source}
- ${source} = Set Variable If '${source}' != '<unknown>'
${module_path} <unknown>
- Check Syslog Contains Imported listener '${name}' with arguments
${args} (source ${source}
-
+
+Run Tests With Listeners
+ ${listeners} = Catenate
+ ... --listener OldListenAll
+ ... --listener old_listeners.ListenSome
+ ... --listener old_module_listener
+ ... --listener old_listeners.WithArgs:value
+ ... --listener old_listeners.WithArgs:a1:a2
+ ... --listener
${LISTENERS}${/}OldListenAll.py:${TEMPDIR}${/}${ALL_FILE2}
+ ... --listener old_listeners.WithArgs
+ ... --listener old_listeners.WithArgs:1:2:3
+ ... --listener OldJavaListener
+ ... --listener OldJavaListenerWithArgs:Hello:world
+ ... --listener OldJavaListenerWithArgs
+ ... --listener OldJavaListenerWithArgs:b:a:r
+ ... --listener NonExistingListener
+ Run Tests ${listeners} misc/pass_and_fail.html
=======================================
--- /atest/robot/test_libraries/java_library_imports_with_args.txt Thu Jul
15 02:32:31 2010
+++ /atest/robot/test_libraries/java_library_imports_with_args.txt Sun Jan
1 15:03:52 2012
@@ -40,6 +40,7 @@
[Arguments] ${lib} @{params}
Check Test Case ${TEST NAME}
${par} = Catenate SEPARATOR=${SPACE}|${SPACE} @{params}
+ Check Syslog Contains Imported test library class '${lib}' from
unknown location.
Check Syslog Contains Imported library '${lib}' with arguments [
${par} ]
Library import should have failed
=======================================
--- /atest/robot/test_libraries/libraries_extending_existing_classes.txt
Wed Sep 28 23:48:26 2011
+++ /atest/robot/test_libraries/libraries_extending_existing_classes.txt
Sun Jan 1 15:03:52 2012
@@ -18,8 +18,7 @@
Check Test Case Keyword In Python Class Using Method From Parent Class
Message Of Importing Library Should Be In Syslog
- ${lib path} = Join Path ${CURDIR}/../../
testresources/testlibs/ExtendPythonLib
- Check Syslog Contains Imported library 'ExtendPythonLib' with
arguments [ ] (version <unknown>, class type, testcase scope, 30 keywords,
source ${lib path}
+ Check Syslog Contains Imported library 'ExtendPythonLib' with
arguments [ ] (version <unknown>, class type, testcase scope, 30 keywords)
Keyword From Java Class Extended By Python Class
[Tags] jybot
@@ -39,7 +38,7 @@
Message Of Importing Library Extending Java Class Should Be In Syslog
[Tags] jybot
- Check Syslog Contains Imported library 'extendingjava.ExtendJavaLib'
with arguments [ ] (version <unknown>, class type, global scope, 24 keywords
+ Check Syslog Contains Imported library 'extendingjava.ExtendJavaLib'
with arguments [ ] (version <unknown>, class type, global scope, 24
keywords)
Using Methods From Java Parents Should Not Create Handlers Starting With
Super__
[Documentation] At least in Jython 2.2, when a class implemented in
python inherits a java class, and the python class uses a method from the
java class, the python instance ends up having an attribute
super__methodname, where methodname is the method from parent class. We
don't want to create keywords from these, even though they are real methods.
=======================================
--- /atest/robot/test_libraries/library_import_from_archive.txt Wed May 12
06:45:51 2010
+++ /atest/robot/test_libraries/library_import_from_archive.txt Sun Jan 1
15:03:52 2012
@@ -7,13 +7,12 @@
*** Test Cases ***
Python Library From A Zip File
Check Test Case Python Library From a Zip File
- Check Syslog Contains Imported library 'ZipLib' with arguments [ ]
(version <unknown>, class type, testcase scope, 1 keywords, source
${TESTLIBPATH}${/}ziplib.zip${/}ZipLib.py)
+ Check Syslog Contains Imported library 'ZipLib' with arguments [ ]
(version <unknown>, class type, testcase scope, 1 keywords)
Java Library From A Jar File
[Tags] jybot
Check Test Case Java Library From a Jar File
- ${expected path} = Set Variable If "${STANDALONE JYTHON}" == "NO"
${TESTLIBPATH}${/}JarLib.jar <unknown>
- Check Syslog Contains Imported library 'org.robotframework.JarLib'
with arguments [ ] (version <unknown>, class type, testcase scope, 1
keywords, source ${expected path})
+ Check Syslog Contains Imported library 'org.robotframework.JarLib'
with arguments [ ] (version <unknown>, class type, testcase scope, 1
keywords)
*** Keywords ***
My Setup
=======================================
--- /atest/robot/test_libraries/library_imports.txt Tue Dec 20 14:41:34 2011
+++ /atest/robot/test_libraries/library_imports.txt Sun Jan 1 15:03:52 2012
@@ -3,10 +3,11 @@
Force Tags regression
Default Tags pybot jybot
Resource atest_resource.txt
+Suite Setup Run Tests ${EMPTY}
test_libraries/library_import_normal.txt
+
*** Test Cases ***
Normal Library Import
- Run Tests ${EMPTY} test_libraries/library_import_normal.txt
Check Test Case ${TESTNAME}
Library Import With Spaces In Name
@@ -14,16 +15,20 @@
Check Log Message ${test.kws[0].messages[0]} It works!
Check Log Message ${test.kws[1].messages[0]} It really workz!!
+Importing Library Class Should Have Been Syslogged
+ ${base} = Normalize Path ${CURDIR}/../../testresources/testlibs
+ Check Syslog Contains Imported test library class 'ExampleLibrary'
+ ... from '${base}${/}ExampleLibrary
+ ${path} = Normalize Path
${CURDIR}/../../testresources/testlibs/libmodule
+ Check Syslog Contains Imported test library module 'libmodule'
+ ... from '${base}${/}libmodule
+
Number Of Keywords In Imported Library Is Reported In Syslog
- ${testlibs path} = Normalize Path
${CURDIR}/../../testresources/testlibs/
- ${ex lib module} = Normalize Path ${testlibs path}/ExampleLibrary
- Check Syslog Contains | INFO \ | Imported library 'ExampleLibrary'
with arguments [ ] (version <unknown>, class type, testcase scope, 28
keywords, source ${ex lib module}
- ${lib class module} = Join Path ${testlibs path} libmodule
- Check Syslog Contains | INFO \ | Imported
library 'libmodule.LibClass1' with arguments [ ] (version <unknown>, class
type, testcase scope, 1 keywords, source ${lib class module}
+ Check Syslog Contains | INFO \ | Imported library 'ExampleLibrary'
with arguments [ ] (version <unknown>, class type, testcase scope, 28
keywords)
+ Check Syslog Contains | INFO \ | Imported
library 'libmodule.LibClass1' with arguments [ ] (version <unknown>, class
type, testcase scope, 1 keywords)
Warning Should Be Written To Syslog If Library Contains No Keywords
- ${lib module path} = Join Path ${CURDIR}/../../
testresources/testlibs/libmodule
- Check Syslog Contains | INFO \ | Imported library 'libmodule' with
arguments [ ] (version <unknown>, module type, global scope, 0 keywords,
source ${lib module path}
+ Check Syslog Contains | INFO \ | Imported library 'libmodule' with
arguments [ ] (version <unknown>, module type, global scope, 0 keywords)
Check Syslog Contains | WARN \ | Imported library 'libmodule'
contains no keywords
Importing Python Class From Module
=======================================
--- /atest/robot/test_libraries/module_library.txt Wed May 25 12:15:31 2011
+++ /atest/robot/test_libraries/module_library.txt Sun Jan 1 15:03:52 2012
@@ -44,7 +44,7 @@
Check Test Case ${TESTNAME} 2
Check Test Case ${TESTNAME} 3
Check Test Case ${TESTNAME} 4
- Keyword should not have been added join
+ Keyword should not have been added join
Keyword should not have been added not_in_all
Class Method Assigned To Module Variable
@@ -63,8 +63,11 @@
Check Test Case ${TESTNAME}
Module Library Scope Should Be Global
- ${lib module path} = Join Path ${CURDIR}/../../
testresources/testlibs/module_library
- Check Syslog Contains Imported library 'module_library' with
arguments [ ] (version test, module type, global scope, 12 keywords, source
${lib module path}
+ Check Syslog Contains Imported library 'module_library' with
arguments [ ] (version test, module type, global scope, 12 keywords)
+
+Importing Module Should Have Been Syslogged
+ ${path} = Normalize Path
${CURDIR}/../../testresources/testlibs/module_library
+ Check Syslog Contains Imported test library module 'module_library'
from '${path}
***Keywords***