Revision: 2980
Author: jprantan
Date: Wed Apr 14 10:54:52 2010
Log: Added tests for logging arguments from library keywords. Issue 531.
http://code.google.com/p/robotframework/source/detail?r=2980

Added:
 /trunk/atest/testdata/keywords/TraceArgsLibrary.py
Modified:
 /trunk/atest/robot/keywords/user_keyword_argument_tracelog.txt
 /trunk/atest/testdata/keywords/user_keyword_argument_tracelog.txt

=======================================
--- /dev/null
+++ /trunk/atest/testdata/keywords/TraceArgsLibrary.py Wed Apr 14 10:54:52 2010
@@ -0,0 +1,13 @@
+class TraceArgsLibrary(object):
+
+    def only_mandatory(self, mand1, mand2):
+        pass
+
+    def mandatory_and_default(self, mand, default="default value"):
+        pass
+
+    def multiple_default_values(self, a=1, a2=2, a3=3, a4=4):
+        pass
+
+    def mandatory_and_varargs(self, mand, *varargs):
+        pass
=======================================
--- /trunk/atest/robot/keywords/user_keyword_argument_tracelog.txt Tue Apr 13 05:47:46 2010 +++ /trunk/atest/robot/keywords/user_keyword_argument_tracelog.txt Wed Apr 14 10:54:52 2010
@@ -5,30 +5,74 @@

 *** Test Cases ***

-Only Mandatory
-    ${tc} =  Check Test Case  Only Mandatory
+UK with Only Mandatory Arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
Check Argument Value Trace ${tc.kws[0]} \${mand1}=u'arg1' | \${mand2}=u'arg2' Check Argument Value Trace ${tc.kws[1]} \${mand1}=-123L | \${mand2}=0.0

-Mandatory And Default
-    ${tc} =  Check Test Case  Mandatory And Default
+UK with Mandatory And Default Arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
Check Argument Value Trace ${tc.kws[0]} \${mand}=u'mandatory' | \${default}=u'default value'

-Multiple Default Values
-    ${tc} =  Check Test Case  Multiple Default Values
+UK with Multiple Default Values
+    ${tc} =  Check Test Case  ${TEST NAME}
Check Argument Value Trace ${tc.kws[0]} \${a1}=u'10' | \${a2}=u'2' | \${a3}=u'30' | \${a4}=4L

-Using Named Args
-    ${tc} =  Check Test Case  Using Named Args
+UK with Using Named Arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
Check Argument Value Trace ${tc.kws[0]} \${mand}=u'foo' | \${default}=u'bar' Check Argument Value Trace ${tc.kws[1]} \${mand}=True | \${default}=None

-Using Varargs
-    ${tc} =  Check Test Case  Using Varargs
+UK with Using Variable Number of Arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
Check Argument Value Trace ${tc.kws[0]} \${mand}=u'a' | \...@{vargs}=[u'b', u'c', u'd'] Check Argument Value Trace ${tc.kws[1]} \${mand}=u'mandatory' | \...@{vargs}=[u'a', u'b', u'c', u'd'] Check Argument Value Trace ${tc.kws[2]} \${mand}=u'mandatory' | \...@{vargs}=[]

+Library Keyword with Only Mandatory Arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Check Argument Value Trace  ${tc.kws[0]}  u'arg1' | u'arg2'
+    Check Argument Value Trace  ${tc.kws[1]}  -123L | 0.0
+
+Library Keyword with Mandatory And Default Arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Check Argument Value Trace  ${tc.kws[0]}  u'mandatory'
+
+Library Keyword with Multiple Default Values
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Check Argument Value Trace  ${tc.kws[0]}  u'10' | a3=u'30'
+
+Library Keyword with Using Named Arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Check Argument Value Trace  ${tc.kws[0]}  u'foo' | default=u'bar'
+    Check Argument Value Trace  ${tc.kws[1]}  True | default=None
+    Check Argument Value Trace  ${tc.kws[2]}  True | u'foo=bar'
+
+Library Keyword with Using Variable Number of Arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Check Argument Value Trace  ${tc.kws[0]}  u'a' | u'b' | u'c' | u'd'
+ Check Argument Value Trace ${tc.kws[1]} u'mandatory' | u'a' | u'b' | u'c' | u'd'
+    Check Argument Value Trace  ${tc.kws[2]}  u'mandatory'
+
+Non String Object as Argument
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Check Argument Value Trace  ${tc.kws[0]}  1L
+
+None as Argument
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Check Argument Value Trace  ${tc.kws[0]}  None
+
+Non Ascii String as Argument
+    ${tc} =  Check Test Case  ${TEST NAME}
+ Check Argument Value Trace ${tc.kws[0]} u'Hyv\\xe4\\xe4 P\\xe4iv\\xe4\\xe4' + Check Argument Value Trace ${tc.kws[1]} \${mand}=u'Hyv\\xe4\\xe4 P\\xe4iv\\xe4\\xe4' | \${default}=u'default value'
+
+Object With Unicode Repr as Argument
+    ${tc} =  Check Test Case  ${TEST NAME}
+ Check Argument Value Trace ${tc.kws[1]} u'Circle is 360\\xb0, Hyv\\xe4\\xe4 \\xfc\\xf6t\\xe4, \\u0989\\u09c4 \\u09f0 \\u09fa \\u099f \\u09eb \\u09ea \\u09b9' + Check Argument Value Trace ${tc.kws[2]} \${mand}=u'Circle is 360\\xb0, Hyv\\xe4\\xe4 \\xfc\\xf6t\\xe4, \\u0989\\u09c4 \\u09f0 \\u09fa \\u099f \\u09eb \\u09ea \\u09b9' | \${default}=u'default value'
+
+
 *** Keywords ***
 Check Argument Value Trace
     [Arguments]  ${kw}  ${exp_variables}
=======================================
--- /trunk/atest/testdata/keywords/user_keyword_argument_tracelog.txt Tue Apr 13 05:47:46 2010 +++ /trunk/atest/testdata/keywords/user_keyword_argument_tracelog.txt Wed Apr 14 10:54:52 2010
@@ -1,41 +1,80 @@
+*** Settings ***
+Library    UnicodeLibrary
+Library    TraceArgsLibrary.py
+
+
 *** Variables ***
 @{VALUES}  a  b  c  d

+
 *** Test cases ***
-Only Mandatory
+UK with Only Mandatory Arguments
+    Only Mandatory UK  arg1  arg2
+    Only Mandatory UK  ${-123}  ${0.0}
+
+UK with Mandatory And Default Arguments
+    Mandatory And Default UK  mandatory
+
+UK with Multiple Default Values
+    Multiple Default Values UK  10  a3=30
+
+UK with Using Named Arguments
+    Mandatory and Default UK  foo  default=bar
+    Mandatory and Default UK  ${True}  default=${None}
+
+UK with Using Variable Number of Arguments
+    Mandatory and Varargs UK  @{VALUES}
+    Mandatory and Varargs UK  mandatory  @{VALUES}
+    Mandatory and Varargs UK  mandatory
+
+Library Keyword with Only Mandatory Arguments
     Only Mandatory  arg1  arg2
     Only Mandatory  ${-123}  ${0.0}

-Mandatory And Default
+Library Keyword with Mandatory And Default Arguments
     Mandatory And Default  mandatory

-Multiple Default Values
+Library Keyword with Multiple Default Values
     Multiple Default Values  10  a3=30

-Using Named Args
+Library Keyword with Using Named Arguments
     Mandatory and Default  foo  default=bar
     Mandatory and Default  ${True}  default=${None}
-
-Using Varargs
+    Mandatory and Default  ${True}  foo=bar
+
+Library Keyword with Using Variable Number of Arguments
     Mandatory and Varargs  @{VALUES}
     Mandatory and Varargs  mandatory  @{VALUES}
     Mandatory and Varargs  mandatory

+Non String Object as Argument
+    Log  ${1}
+
+None as Argument
+    Log  ${NONE}
+
+Non Ascii String as Argument
+    Log  Hyvää Päivää
+    Mandatory And Default UK  Hyvää Päivää
+
+Object With Unicode Repr as Argument
+    ${object}  Print and Return Unicode Object
+    Log  ${object}
+    Mandatory And Default UK  ${object}

 *** Keywords ***
-Only Mandatory
+Only Mandatory UK
     [Arguments]  ${mand1}  ${mand2}
     Log Many  ${mand1}  ${mand2}

-Mandatory And Default
+Mandatory And Default UK
     [Arguments]  ${mand}  ${default}=default value
     Log Many  ${mand}  ${default}

-Multiple Default Values
+Multiple Default Values UK
     [Arguments]  ${a1}=1  ${a2}=2  ${a3}=3  ${a4}=${4}
     Log Many  ${a1}  ${a2}  ${a3}  ${a4}

-Mandatory and Varargs
+Mandatory and Varargs UK
     [Arguments]  ${mand}  @{vargs}
     Log Many  ${mand}  @{vargs}
-


--
To unsubscribe, reply using "remove me" as the subject.

Reply via email to