2 new revisions:

Revision: 5af8f430d09e
Branch:   default
Author:   Pekka Klärck
Date:     Thu Apr 17 10:07:17 2014 UTC
Log: atests: Move 'Test Should Have Correct Keywords' to library to allow m...
http://code.google.com/p/robotframework/source/detail?r=5af8f430d09e

Revision: 08ad194cc6ed
Branch:   default
Author:   Pekka Klärck
Date:     Thu Apr 17 10:27:02 2014 UTC
Log: Fix detecting does Run Keyword argument contain variable in dry-run....
http://code.google.com/p/robotframework/source/detail?r=08ad194cc6ed

==============================================================================
Revision: 5af8f430d09e
Branch:   default
Author:   Pekka Klärck
Date:     Thu Apr 17 10:07:17 2014 UTC
Log: atests: Move 'Test Should Have Correct Keywords' to library to allow making it configurable.
http://code.google.com/p/robotframework/source/detail?r=5af8f430d09e

Modified:
 /atest/resources/TestCheckerLibrary.py
 /atest/resources/atest_resource.txt

=======================================
--- /atest/resources/TestCheckerLibrary.py      Wed Jan 29 15:30:44 2014 UTC
+++ /atest/resources/TestCheckerLibrary.py      Thu Apr 17 10:07:17 2014 UTC
@@ -156,11 +156,21 @@
             assert_equals(act, exp)

     def should_contain_keywords(self, item, *kw_names):
-        actual_names =  [kw.name for kw in item.keywords]
+        actual_names = [kw.name for kw in item.keywords]
assert_equals(len(actual_names), len(kw_names), 'Wrong number of keywords')
         for act, exp in zip(actual_names, kw_names):
             assert_equals(act, exp)

+    def test_should_have_correct_keywords(self, *kw_names, **config):
+        get_var = BuiltIn().get_variable_value
+        suite = get_var('${SUITE}')
+        name = config.get('name', get_var('${TEST NAME}'))
+        kw_index = int(config.get('kw_index', 0))
+        test = self.get_test_from_suite(suite, name)
+        self.check_test_status(test)
+        self.should_contain_keywords(test.keywords[kw_index], *kw_names)
+        return test
+

 def process_suite(suite):
     for subsuite in suite.suites:
=======================================
--- /atest/resources/atest_resource.txt Sun Nov 24 21:48:32 2013 UTC
+++ /atest/resources/atest_resource.txt Thu Apr 17 10:07:17 2014 UTC
@@ -315,11 +315,6 @@
     Log    ${tag.text}
     Should Be Equal As Integers  ${tag.attrib['pass']}  ${pass}
     Should Be Equal As Integers  ${tag.attrib['fail']}  ${fail}
-
-Test Should Have Correct Keywords  [Arguments]  @{expected}
-    ${tc} =  Check Test Case  ${TESTNAME}
-    Should Contain Keywords  ${tc.kws[0]}  @{expected}
-    [Return]  ${tc}

 Test And All Keywords Should Have Passed
     [Arguments]    ${name}=${TESTNAME}

==============================================================================
Revision: 08ad194cc6ed
Branch:   default
Author:   Pekka Klärck
Date:     Thu Apr 17 10:27:02 2014 UTC
Log: Fix detecting does Run Keyword argument contain variable in dry-run.

Update issue 1670
Status: Done
Bug fixed by removing a buggy helper method in favor of a working generic utility function.

Also added a new test and enhanced a related test.
http://code.google.com/p/robotframework/source/detail?r=08ad194cc6ed

Modified:
 /atest/robot/cli/dryrun/run_keyword_variants.txt
 /atest/testdata/cli/dryrun/run_keyword_variants.txt
 /src/robot/running/handlers.py

=======================================
--- /atest/robot/cli/dryrun/run_keyword_variants.txt Mon Oct 28 13:53:16 2013 UTC +++ /atest/robot/cli/dryrun/run_keyword_variants.txt Thu Apr 17 10:27:02 2014 UTC
@@ -11,7 +11,13 @@
 Run Keyword With Missing Keyword
     Check Test Case  ${TESTNAME}

-Run Keyword With Variable In Keyword Name
+Keywords with variable in name are ignored
+    Test Should Have Correct Keywords  kw_index=0
+    Test Should Have Correct Keywords  BuiltIn.No Operation  kw_index=1
+    Test Should Have Correct Keywords  kw_index=2
+    Test Should Have Correct Keywords  BuiltIn.No Operation  kw_index=3
+
+Keywords with variable in name are ignored also when variable is argument
     Check Test Case  ${TESTNAME}

 Run Keyword With UK
=======================================
--- /atest/testdata/cli/dryrun/run_keyword_variants.txt Sun Nov 24 18:39:03 2013 UTC +++ /atest/testdata/cli/dryrun/run_keyword_variants.txt Thu Apr 17 10:27:02 2014 UTC
@@ -1,5 +1,4 @@
 *** Variables ***
-${existing} =  foo
${LOG GOT WRONG ARGS} = Keyword 'BuiltIn.Log' expected 1 to 5 arguments, got
 ${UK GOT WRONG ARGS} =  Keyword 'UK' expected 0 arguments, got
 ${LOG KW} =  Log
@@ -14,10 +13,15 @@
     [Documentation]  FAIL No keyword with name 'Missing' found.
     Run Keyword    Missing

-Run Keyword With Variable In Keyword Name
-    Run Keyword    Log ${missing}
-    Run Keyword    Log ${existing}
-    Run Keyword    Log ${EMPTY}
+Keywords with variable in name are ignored
+    Run Keyword    ${non-existing variable}
+    Run Keyword    No Operation
+    Run Keyword    Existing variable ${42}
+ Run Keywords ${non existing} No Operation Existing @{TEST TAGS}
+
+Keywords with variable in name are ignored also when variable is argument
+    Higher order fun    No Operation
+    Higher order fun    ${name}

 Run Keyword With UK
     Run Keyword  UK
@@ -211,6 +215,12 @@


 *** Keywords ***
-UK  No Operation
+UK
+    No Operation
+
+Failing UK
+    Log

-Failing UK  Log
+Higher order fun
+    [Arguments]    ${name}
+    Run Keyword    ${name}
=======================================
--- /src/robot/running/handlers.py      Thu Jan 23 14:00:53 2014 UTC
+++ /src/robot/running/handlers.py      Thu Apr 17 10:27:02 2014 UTC
@@ -16,7 +16,7 @@

 from robot import utils
 from robot.errors import DataError
-from robot.variables import is_list_var
+from robot.variables import contains_var, is_list_var

 from .arguments import (PythonArgumentParser, JavaArgumentParser,
                         DynamicArgumentParser, ArgumentResolver,
@@ -265,20 +265,11 @@
     def _get_runnable_dry_run_keywords(self, context, args):
         keywords = Keywords([])
         for keyword in self._get_dry_run_keywords(args):
-            if self._variable_syntax_in(keyword.name, context):
+            if contains_var(keyword.name):
                 continue
             keywords.add_keyword(keyword)
         return keywords

-    def _variable_syntax_in(self, kw_name, context):
-        try:
-            resolved = context.namespace.variables.replace_string(kw_name)
-            #Variable can contain value, but it might be wrong,
-            #therefore it cannot be returned
-            return resolved != kw_name
-        except DataError:
-            return True
-
     def _get_dry_run_keywords(self, args):
         if self._handler_name == 'run_keyword_if':
             return list(self._get_run_kw_if_keywords(args))

--

--- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to