2 new revisions:

Revision: 8e50c5babd4c
Author:   Pekka Klärck
Date:     Fri Sep 23 02:49:55 2011
Log:      explicit tests for all listener methods failing
http://code.google.com/p/robotframework/source/detail?r=8e50c5babd4c

Revision: d27868951380
Author:   Pekka Klärck
Date:     Fri Sep 23 02:54:04 2011
Log: Listeners failing and logging are now tested on separate suites. Tests...
http://code.google.com/p/robotframework/source/detail?r=d27868951380

==============================================================================
Revision: 8e50c5babd4c
Author:   Pekka Klärck
Date:     Fri Sep 23 02:49:55 2011
Log:      explicit tests for all listener methods failing
http://code.google.com/p/robotframework/source/detail?r=8e50c5babd4c

Added:
 /atest/robot/output/listener_interface/listener_failing.txt
 /atest/testdata/output/listeners/failing_listener.py

=======================================
--- /dev/null
+++ /atest/robot/output/listener_interface/listener_failing.txt Fri Sep 23 02:49:55 2011
@@ -0,0 +1,30 @@
+*** Settings ***
+Suite Setup  Run Tests With Failing Listener
+Force Tags  regression  pybot  jybot
+Resource  listener_resource.txt
+
+*** Test Cases ***
+
+Failing listener does not break output file
+    Test statuses should be correct
+    Log and report should be created
+
+Listener errors are shown
+    :FOR  ${method}  IN  start_suite  end_suite  start_test  end_test
+    ...  start_keyword  end_keyword  log_message  message
+    ...  output_file  log_file  report_file  close
+ \ Check syslog matches regexp | ERROR | Calling listener method '${method}' of listener '.*' failed: ${method}
+
+
+*** Keywords ***
+Run Tests With Failing Listener
+ ${path} = Normalize Path ${DATADIR}/output/listeners/failing_listener.py + Run Tests --listener ${path} -l l.html -r r.html misc/pass_and_fail.html
+
+Test statuses should be correct
+    Check Test Case  Pass
+    Check Test Case  Fail
+
+Log and report should be created
+    File Should Not Be Empty  ${OUTDIR}/l.html
+    File Should Not Be Empty  ${OUTDIR}/r.html
=======================================
--- /dev/null
+++ /atest/testdata/output/listeners/failing_listener.py Fri Sep 23 02:49:55 2011
@@ -0,0 +1,17 @@
+ROBOT_LISTENER_API_VERSION = 2
+
+def get_listener_method(name):
+    def listener_method(*args):
+        if name in ['message', 'log_message']:
+            msg = args[0]
+            message = '%s: %s %s' % (name, msg['level'], msg['message'])
+        else:
+            message = name
+        raise AssertionError(message)
+    listener_method.__name__ = name
+    return listener_method
+
+for name in ['start_suite', 'end_suite', 'start_test', 'end_test',
+             'start_keyword', 'end_keyword', 'log_message', 'message',
+             'output_file', 'log_file', 'report_file', 'debug_file', 'close']:
+    globals()[name] = get_listener_method(name)

==============================================================================
Revision: d27868951380
Author:   Pekka Klärck
Date:     Fri Sep 23 02:54:04 2011
Log: Listeners failing and logging are now tested on separate suites. Tests related to them can thus be removed from listener_methods suite.
http://code.google.com/p/robotframework/source/detail?r=d27868951380

Modified:
 /atest/robot/output/listener_interface/listener_methods.txt
 /atest/testresources/listeners/listeners.py

=======================================
--- /atest/robot/output/listener_interface/listener_methods.txt Fri Sep 23 02:36:53 2011 +++ /atest/robot/output/listener_interface/listener_methods.txt Fri Sep 23 02:54:04 2011
@@ -51,21 +51,6 @@
     ...  2 tests total, 1 passed, 1 failed
     ...  Output (java): output.xml  The End
     Check Listener File  ${JAVA_FILE}  @{expected}
-
-Invalid Args For Listener Method
-    Calling listener failed  start_suite  TypeError: start_suite() takes
-
-Listener Method Raising Exception
-    Calling listener failed  end_suite  Here comes an exception!
-
-Listener Method Failing Continuously
- [Documentation] 'message' method failing continuously used to cause recursion error: http://code.google.com/p/robotframework/issues/detail?id=832
-    Calling listener failed  message  ValueError: This fails continuously!
-
-Log Message Logging Itself
-    ${tc} =  Check test case  Pass
- Check log message ${tc.kws[-1].msgs[-2]} log_message logging 1 (original: "TRACE Return: None")
-    Check log message  ${tc.kws[-1].msgs[-1]}  log_message logging 2  WARN

 Correct Attributes To Listener Methods
     ${status} =  Log File  ${TEMPDIR}/${ATTR_TYPE_FILE}
@@ -111,10 +96,8 @@
     ${args}=  Catenate
... --listener ListenAll --listener ListenAll:${TEMPDIR}${/}${ALL_FILE2} ... --listener module_listener --listener listeners.ListenSome --listener JavaListener - ... --listener listeners.InvalidMethods --listener attributeverifyinglistener - ... --listener JavaAttributeVerifyingListener --metadata ListenerMeta:Hello
-    ...  --listener listeners.LogMessageLogging
-    ...  --critical pass
+ ... --listener attributeverifyinglistener --listener JavaAttributeVerifyingListener
+    ...  --metadata ListenerMeta:Hello --critical pass
     Run Tests  ${args}  misc/pass_and_fail.html

 Check Listen All File
=======================================
--- /atest/testresources/listeners/listeners.py Thu Sep 15 06:39:05 2011
+++ /atest/testresources/listeners/listeners.py Fri Sep 23 02:54:04 2011
@@ -33,28 +33,6 @@
         outfile.close()


-class InvalidMethods:
-    ROBOT_LISTENER_API_VERSION = '2'
-
-    def start_suite(self, wrong, number, of, args, here):
-        pass
-
-    def end_suite(self, *args):
-        raise RuntimeError("Here comes an exception!")
-
-    def message(self, msg):
-        raise ValueError("This fails continuously!")
-
-
-class LogMessageLogging:
-    ROBOT_LISTENER_API_VERSION = '2'
-
-    def log_message(self, msg):
-        logging.info('log_message logging 1 (original: "%s %s")'
-                     % (msg['level'], msg['message']))
-        logger.warn('log_message logging 2')
-
-
 class SuiteAndTestCounts(object):
     ROBOT_LISTENER_API_VERSION = '2'
     exp_data = {

Reply via email to