5 new revisions:

Revision: d4a9456ee2e9
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:06:22 2013
Log:      Add suite initialization errors to test errors....
http://code.google.com/p/robotframework/source/detail?r=d4a9456ee2e9

Revision: 1e656458026c
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:06:56 2013
Log:      test cleanup
http://code.google.com/p/robotframework/source/detail?r=1e656458026c

Revision: da7760c7ce20
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:33:36 2013
Log:      test cleanup
http://code.google.com/p/robotframework/source/detail?r=da7760c7ce20

Revision: 665a4710beee
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:35:30 2013
Log:      Refactor...
http://code.google.com/p/robotframework/source/detail?r=665a4710beee

Revision: f2f8e45198dc
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:35:42 2013
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=f2f8e45198dc

==============================================================================
Revision: d4a9456ee2e9
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:06:22 2013
Log:      Add suite initialization errors to test errors.

Update issue 1307
Add suite initialization errors to test errors.
http://code.google.com/p/robotframework/source/detail?r=d4a9456ee2e9

Modified:
 /atest/robot/core/test_and_uk_settings.txt
 /src/robot/running/runerrors.py

=======================================
--- /atest/robot/core/test_and_uk_settings.txt  Mon Oct 31 23:00:37 2011
+++ /atest/robot/core/test_and_uk_settings.txt  Thu Jan  3 06:06:22 2013
@@ -117,10 +117,14 @@
Check Stderr Contains [ ERROR ] Error in file '${PATH}' in table 'Keyword': Invalid syntax in keyword 'UK With Invalid Meta Failing': Non-existing setting 'Invalid'.

 Non Existing Variable In Suite Setup And Teardown
-    Run Tests  ${EMPTY}  core${/}test_and_uk_settings.html
-    Equals  ${SUITE.status}  FAIL
- ${exp} = Catenate SEPARATOR=\n Suite initialization failed: Replacing variables from Setup failed: Non-existing variable '\${SUITE_FIXTURE_FROM_CLI}'. Replacing variables from Teardown failed: Non-existing variable '\${SUITE_FIXTURE_FROM_CLI}'. Replacing variables from setting 'Var from CLI' failed: Non-existing variable '\${META_FROM_CLI}'.
-    Equals  ${SUITE.message}  ${exp}
+    Run Tests  ${EMPTY}  core/test_and_uk_settings.html
+    Should Be Equal  ${SUITE.status}  FAIL
+    ${errors} =    Catenate    SEPARATOR=\n
+ ... Replacing variables from Setup failed: Non-existing variable '\${SUITE_FIXTURE_FROM_CLI}'. + ... Replacing variables from Teardown failed: Non-existing variable '\${SUITE_FIXTURE_FROM_CLI}'. + ... Replacing variables from setting 'Var from CLI' failed: Non-existing variable '\${META_FROM_CLI}'.
+    ${exp} =  Catenate  SEPARATOR=\n
+ Should Be Equal ${SUITE.message} Suite initialization failed:\n${errors}
     ${tc} =  Get Test Case  Test Case Documentation
     Equals  ${tc.status}  FAIL
     Equals  ${tc.message}  Initialization of the parent suite failed.
=======================================
--- /src/robot/running/runerrors.py     Thu Jan  3 04:59:37 2013
+++ /src/robot/running/runerrors.py     Thu Jan  3 06:06:22 2013
@@ -16,7 +16,7 @@
_exit_on_failure_error = ('Critical failure occurred and ExitOnFailure '
                               'option is in use')
     _exit_on_fatal_error = 'Test execution is stopped due to a fatal error'
-    _parent_suite_init_error = 'Initialization of the parent suite failed.'
+ _parent_suite_init_error = 'Initialization of the parent suite failed:\n'
     _parent_suite_setup_error = 'Setup of the parent suite failed:\n'

def __init__(self, exit_on_failure_mode=False, skip_teardowns_on_exit_mode=False):
@@ -63,7 +63,7 @@

     def suite_initialized(self, error=None):
         if error:
-            self._init_error = 'Suite initialization failed:\n%s' % error
+            self._init_error = error

     def setup_executed(self, error=None):
         self._setup_executed = True
@@ -74,7 +74,7 @@

     def get_suite_error(self):
         if self._init_error:
-            return self._init_error
+            return 'Suite initialization failed:\n%s' % self._init_error
         if self._setup_error:
             return 'Suite setup failed:\n%s' % self._setup_error
         if any(self._earlier_init_errors):
@@ -85,7 +85,7 @@

     def get_child_error(self):
         if self._init_error or any(self._earlier_init_errors):
-            return self._parent_suite_init_error
+            return self._get_init_error()
         if self._setup_error or any(self._earlier_setup_errors):
             return self._get_setup_error()
         if self._exit_on_failure:
@@ -94,6 +94,10 @@
             return self._exit_on_fatal_error
         return None

+    def _get_init_error(self):
+ error = self._init_error or [e for e in self._earlier_init_errors if e][0]
+        return self._parent_suite_init_error + error
+
     def _get_setup_error(self):
error = self._setup_error or [e for e in self._earlier_setup_errors if e][0]
         return self._parent_suite_setup_error + error

==============================================================================
Revision: 1e656458026c
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:06:56 2013
Log:      test cleanup
http://code.google.com/p/robotframework/source/detail?r=1e656458026c

Modified:
 /atest/robot/core/test_and_uk_settings.txt

=======================================
--- /atest/robot/core/test_and_uk_settings.txt  Thu Jan  3 06:06:22 2013
+++ /atest/robot/core/test_and_uk_settings.txt  Thu Jan  3 06:06:56 2013
@@ -46,7 +46,7 @@

 Multiple Test Case Metas
     ${test} =  Check Test Case  Multiple Test Case Metas
-    Equal  ${test.doc}  Documentation for this test case
+    Should Be Equal  ${test.doc}  Documentation for this test case
     Should Contain Tags  ${test}  force-1  test-1  test-2
     Verify Setup  ${test}  BuiltIn.Log  Test case setup
     Verify Teardown  ${test}  BuiltIn.Log  Test case teardown
@@ -57,41 +57,41 @@

 Escaping Metadata In Test Case Table
     ${test} =  Check Test Case  Escaping Metadata in Test Case Table
-    Equal  ${test.doc}  Two backslashes \\\\
+    Should Be Equal  ${test.doc}  Two backslashes \\\\

 User Keyword Name
     ${test} =  Check testcase  Lower Case User Keyword Name
-    Equals  ${test.keywords[0].name}  UK with lower case name
+    Should Be Equal  ${test.keywords[0].name}  UK with lower case name

 User Keyword Documentation
[Documentation] Check that test case documentation can be set in one cell and in multiple columns and lines
     ${test} =  Check testcase  User Keyword Documentation
-    Equal  ${test.keywords[0].doc}  Documentation for a user keyword
- Equal ${test.keywords[1].doc} Documentation for a user keyword in multiple columns - Equal ${test.keywords[2].doc} Documentation for a user keyword in multiple lines + Should Be Equal ${test.keywords[0].doc} Documentation for a user keyword + Should Be Equal ${test.keywords[1].doc} Documentation for a user keyword in multiple columns + Should Be Equal ${test.keywords[2].doc} Documentation for a user keyword in multiple lines

 User Keyword Short Documentation
[Documentation] Checks that it is possible to use "short doc" with user keywords i.e. that only the first line (until real newline) is taken into documentation.
     ${test} =  Check testcase  User Keyword With Short Documentation
- Equal ${test.keywords[0].doc} This is the short doc and also the only thing logged + Should Be Equal ${test.keywords[0].doc} This is the short doc and also the only thing logged

 User Keyword Documentation With Variables
[Documentation] Check that variables work in user keyword documentation and invalid variables are handled correctly
     ${test} =  Check testcase  User Keyword Documentation With Variables
- Equal ${test.keywords[0].doc} Variables work in documentation since Robot 1.2 + Should Be Equal ${test.keywords[0].doc} Variables work in documentation since Robot 1.2

 User Keyword Documentation With Non Existing Variables
${tc} = Check testcase User Keyword Documentation with non Existing Variables - Equals ${tc.kws[0].doc} Starting from RF 2.1 \@{non-existing} variables are just left unchanged in keyword documentation. + Should Be Equal ${tc.kws[0].doc} Starting from RF 2.1 \@{non-existing} variables are just left unchanged in keyword documentation.

 User Keyword Arguments
[Documentation] Check that user keyword Arguments work. Arguments and Return are handled differently than other metadatas.
     ${test} =  Check testcase  User Keyword Arguments
-    Equal  ${test.keywords[0].args[0]}  one
+    Should Be Equal  ${test.keywords[0].args[0]}  one
     Check Log Message  ${test.keywords[0].keywords[0].messages[0]}  one
-    Equal  ${test.keywords[1].args[0]}  one
-    Equal  ${test.keywords[1].args[1]}  two
-    Equal  ${test.keywords[1].args[2]}  three
+    Should Be Equal  ${test.keywords[1].args[0]}  one
+    Should Be Equal  ${test.keywords[1].args[1]}  two
+    Should Be Equal  ${test.keywords[1].args[2]}  three
Check Log Message ${test.keywords[1].keywords[0].messages[0]} one two three

 User Keyword Return
@@ -109,7 +109,7 @@

 User Keyword With Multiple Metas
     ${test} =  Check testcase  User Keyword With Multiple Metas
-    Equal  ${test.keywords[0].doc}  Documentation for a user keyword
+ Should Be Equal ${test.keywords[0].doc} Documentation for a user keyword

 User Keyword With Invalid Metadata
     Check Test Case  User Keyword With Invalid Metadata
@@ -126,8 +126,8 @@
     ${exp} =  Catenate  SEPARATOR=\n
Should Be Equal ${SUITE.message} Suite initialization failed:\n${errors}
     ${tc} =  Get Test Case  Test Case Documentation
-    Equals  ${tc.status}  FAIL
-    Equals  ${tc.message}  Initialization of the parent suite failed.
+    Should Be Equal  ${tc.status}  FAIL
+ Should Be Equal ${tc.message} Initialization of the parent suite failed:\n${errors}

 *** Keywords ***
 My Setup
@@ -145,6 +145,6 @@

 Verify Fixture
     [Arguments]  ${fixture}  ${expected_name}  ${expected_message}
-    Equal  ${fixture.name}  ${expected_name}
+    Should Be Equal  ${fixture.name}  ${expected_name}
     Check Log Message  ${fixture.messages[0]}  ${expected_message}


==============================================================================
Revision: da7760c7ce20
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:33:36 2013
Log:      test cleanup
http://code.google.com/p/robotframework/source/detail?r=da7760c7ce20

Modified:
 /atest/robot/core/test_and_uk_settings.txt

=======================================
--- /atest/robot/core/test_and_uk_settings.txt  Thu Jan  3 06:06:56 2013
+++ /atest/robot/core/test_and_uk_settings.txt  Thu Jan  3 06:33:36 2013
@@ -132,7 +132,7 @@
 *** Keywords ***
 My Setup
Run Tests --variable suite_doc_from_cli:Hello --variable suite_fixture_from_cli:Log --variable meta_from_cli:my_metadata core${/}test_and_uk_settings.html - ${PATH} = Join Path ${CURDIR}${/}..${/}.. testdata${/}core${/}test_and_uk_settings.html + ${PATH} = Normalize Path ${CURDIR}/../../testdata/core/test_and_uk_settings.html
     Set Suite Variable  $PATH

 Verify Setup

==============================================================================
Revision: 665a4710beee
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:35:30 2013
Log:      Refactor

Update issue 1307
Refactor earlier work
TODO:
- better tests for initialization
- handling of teardown errors
http://code.google.com/p/robotframework/source/detail?r=665a4710beee

Modified:
 /src/robot/running/runerrors.py

=======================================
--- /src/robot/running/runerrors.py     Thu Jan  3 06:06:22 2013
+++ /src/robot/running/runerrors.py     Thu Jan  3 06:35:30 2013
@@ -16,8 +16,10 @@
_exit_on_failure_error = ('Critical failure occurred and ExitOnFailure '
                               'option is in use')
     _exit_on_fatal_error = 'Test execution is stopped due to a fatal error'
- _parent_suite_init_error = 'Initialization of the parent suite failed:\n'
-    _parent_suite_setup_error = 'Setup of the parent suite failed:\n'
+ _parent_init_error_prefix = 'Initialization of the parent suite failed:\n'
+    _parent_setup_error_prefix = 'Setup of the parent suite failed:\n'
+    _init_error_prefix = 'Suite initialization failed:\n'
+    _setup_error_prefix = 'Suite setup failed:\n'

def __init__(self, exit_on_failure_mode=False, skip_teardowns_on_exit_mode=False):
         self._exit_on_failure_mode = exit_on_failure_mode
@@ -74,11 +76,11 @@

     def get_suite_error(self):
         if self._init_error:
-            return 'Suite initialization failed:\n%s' % self._init_error
+            return self._init_error_prefix + self._init_error
         if self._setup_error:
-            return 'Suite setup failed:\n%s' % self._setup_error
+            return self._setup_error_prefix + self._setup_error
         if any(self._earlier_init_errors):
-            return self._parent_suite_init_error
+            return self._get_init_error()
         if any(self._earlier_setup_errors):
             return self._get_setup_error()
         return None
@@ -95,12 +97,17 @@
         return None

     def _get_init_error(self):
- error = self._init_error or [e for e in self._earlier_init_errors if e][0]
-        return self._parent_suite_init_error + error
+ error = self._get_error(self._init_error, *self._earlier_init_errors)
+        return self._parent_init_error_prefix + error

     def _get_setup_error(self):
- error = self._setup_error or [e for e in self._earlier_setup_errors if e][0]
-        return self._parent_suite_setup_error + error
+ error = self._get_error(self._setup_error, *self._earlier_setup_errors)
+        return self._parent_setup_error_prefix + error
+
+    def _get_error(self, *errors):
+        for error in errors:
+            if error:
+                return error

     def test_failed(self, exit=False, critical=False):
         if critical and self._exit_on_failure_mode:

==============================================================================
Revision: f2f8e45198dc
Branch:   default
Author:   Ilmari Kontulainen <[email protected]>
Date:     Thu Jan  3 06:35:42 2013
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=f2f8e45198dc


Reply via email to