waldenner / robotframework

Automatically exported from code.google.com/p/robotframework
Apache License 2.0
0 stars 0 forks source link

import library with exception in __init__ do not stop test execution #588

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Robot Framework 2.5 (Python 2.5.2 on linux2)

===Library
class test:
    ROBOT_LIBRARY_SCOPE = 'GLOBAL'
    ROBOT_LIBRARY_VERSION = '0'
    def __init__(self):
        "2"+2

====Test suite
*Setting*       *Value* *Value* *Value* *Value* *Value* *Value* *Value*
Library ./test.py                                               

*Test Case*     *Action*        *Argument*      *Argument*      *Argument*      
*Argument*      *Argument*      *Argument*
1       Log     koko  

===Result
tde@tde-laptop:~/vld/trunk/VSV_RFW$ pybot VSV/foo.tsv 
[ ERROR ] Invalid syntax in file '/home/tde/vld/trunk/VSV_RFW/VSV/foo.tsv' in 
table 'Setting': Creating an instance of the test library 'test' with no 
arguments failed: TypeError: cannot concatenate 'str' and 'int' objects
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/robot/running/testlibraries.py", line 149, in _get_instance
    return self._libcode(*self.positional_args, **self.named_args)
  File "/home/tde/vld/trunk/VSV_RFW/test.py", line 5, in __init__
    "2"+2
==============================================================================
Foo                                                                           
==============================================================================
1                                                                     | PASS |
------------------------------------------------------------------------------
Foo                                                                   | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output:  /home/tde/vld/trunk/VSV_RFW/output.xml
Report:  /home/tde/vld/trunk/VSV_RFW/report.html
Log:     /home/tde/vld/trunk/VSV_RFW/log.html

===Excpected
if init raise an exception in init, all the tests case of test suite failed.

Original issue reported on code.google.com by kiwitarg...@gmail.com on 13 Jul 2010 at 12:14

GoogleCodeExporter commented 9 years ago
This behavior is by design. We don't want one invalid library to stop the whole 
execution. The error is clearly visible on the console and in the log file so 
it's easy to see it even when tests are executed.

Original comment by pekka.klarck on 13 Jul 2010 at 2:13