Revision: 2288
Author: janne.t.harkonen
Date: Mon Oct 12 17:11:04 2009
Log: Tests for optional Given/When/Then/And
http://code.google.com/p/robotframework/source/detail?r=2288

Added:
 /trunk/atest/robot/core/keywords/optional_given_when_then.txt
 /trunk/atest/testdata/core/keywords/optional_given_when_then.txt
 /trunk/atest/testdata/core/keywords/resources/optional_given_when_then.txt

=======================================
--- /dev/null
+++ /trunk/atest/robot/core/keywords/optional_given_when_then.txt Mon Oct 12 17:11:04 2009
@@ -0,0 +1,47 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY} core/keywords/optional_given_when_then.txt
+Force Tags      pybot  jybot  regression
+Resource        ../../../resources/resource.html
+
+*** Test Cases ***
+In user keyword name with normal arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Should Be Equal  ${tc.kws[0].name}  Given we don't drink too many beers
+    Should Be Equal  ${tc.kws[1].name}  When we are in
+    Should Be Equal  ${tc.kws[2].name}  And time
+ Should Be Equal ${tc.kws[3].name} Then we get this feature ready today
+    Should Be Equal  ${tc.kws[4].name}  and we don't drink too many beers
+
+In user keyword name with embedded arguments
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Should Be Equal  ${tc.kws[0].name}  Given we are in Berlin city
+    Should Be Equal  ${tc.kws[1].name}  When it does not rain
+    Should Be Equal  ${tc.kws[2].name}  And we get this feature implemented
+    Should Be Equal  ${tc.kws[3].name}  Then we go to walking tour
+    Should Be Equal  ${tc.kws[4].name}  and it does not rain
+
+In library keyword name
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Should Be Equal  ${tc.kws[0].name}  BuiltIn.Given Should Be Equal
+    Should Be Equal  ${tc.kws[1].name}  BuiltIn.And Should Not Match
+    Should Be Equal  ${tc.kws[2].name}  BuiltIn.When set test variable
+    Should Be Equal  ${tc.kws[3].name}  BuiltIn.THEN should be equal
+
+In user keyword in resource file
+    ${tc} =  Check Test Case  ${TEST NAME}
+ Should Be Equal ${tc.kws[0].name} optional_given_when_then.Given Keyword Is In Resource File + Should Be Equal ${tc.kws[1].name} optional_given_when_then.and another resource file
+
+Correct Name Shown in Keyword Not Found Error
+    Check Test Case  ${TEST NAME}
+
+Keyword can be used with and without prefix
+    ${tc} =  Check Test Case  ${TEST NAME}
+    Should Be Equal  ${tc.kws[0].name}  GiveN we don't drink too many beers
+    Should Be Equal  ${tc.kws[1].name}  and we don't drink too many beers
+    Should Be Equal  ${tc.kws[2].name}  We Don't Drink Too Many Beers
+    Should Be Equal  ${tc.kws[3].name}  When time
+    Should Be Equal  ${tc.kws[4].name}  Time
+    Should Be Equal  ${tc.kws[5].name}  Then we are in Berlin city
+    Should Be Equal  ${tc.kws[6].name}  we are in Berlin city
+
=======================================
--- /dev/null
+++ /trunk/atest/testdata/core/keywords/optional_given_when_then.txt Mon Oct 12 17:11:04 2009
@@ -0,0 +1,68 @@
+*** Settings ***
+Resource        resources/optional_given_when_then.txt
+
+*** Test Cases ***
+In user keyword name with normal arguments
+    Given we don't drink too many beers
+    When we are in  museum  cafe
+    And time  does  not  run  out
+    Then we get this feature ready today
+    and we don't drink too many beers
+
+In user keyword name with embedded arguments
+    Given we are in Berlin city
+    When it does not rain
+    And we get this feature implemented
+    Then we go to walking tour
+    and it does not rain
+
+In library keyword name
+    Given Should Be Equal  1  1
+    And Should Not Match  foo  bar
+    When set test variable  $foo  bar
+    THEN should be equal  ${foo}  bar
+
+In user keyword in resource file
+    Given Keyword Is In Resource File
+    and another resource file  keyword
+
+Correct Name Shown In Keyword Not Found Error
+ [Documentation] FAIL No keyword with name 'Given this keyword does not exist' found.
+    Given this keyword does not exist
+
+Keyword can be used with and without prefix
+    GiveN we don't drink too many beers
+    and we don't drink too many beers
+    we don't drink too many beers
+    When time  s  they  are  a-changing
+    time  to  commit  soon  !
+    Then we are in Berlin city
+    we are in Berlin city
+
+*** Keywords ***
+We don't drink too many beers
+    No Operation
+
+We are in
+    [Arguments]  ${a1}  ${a2}
+    Should Be Equal  ${a1}-${a2}  museum-cafe
+
+Time
+    [Arguments]  @{args}
+    Length Should Be  ${args}  4
+
+we get this feature ready today
+    Given we don't drink too many beers
+
+We Are In ${name} city
+    Should be equal  ${name}  Berlin
+
+It Does Not ${x}
+    Should Be Equal  ${x}  rain
+
+We ${x} This ${thing} Implemented
+    Should Be Equal  ${x}-${thing}  get-feature
+
+We Go To ${somewhere}
+    Should Be Equal  ${somewhere}  walking tour
+
=======================================
--- /dev/null
+++ /trunk/atest/testdata/core/keywords/resources/optional_given_when_then.txt Mon Oct 12 17:11:04 2009
@@ -0,0 +1,10 @@
+*** Settings ***
+
+*** Keywords ***
+Keyword Is In Resource File
+    Log  hello, resource file
+
+An Other Resource File
+    [Arguments]  ${keyword}
+    Should Be Equal  ${keyword}  keyword
+

Reply via email to