Revision: 2640
Author: jprantan
Date: Tue Mar 16 03:02:30 2010
Log: Updated tests and added tests for querying amount of vacation.
http://code.google.com/p/robotframework/source/detail?r=2640

Added:
 /trunk/proto/atdd_example/atest/query_amount_of_vacation.txt
Modified:
 /trunk/proto/atdd_example/VacalcLibrary.py
 /trunk/proto/atdd_example/atest/add_employee.txt
 /trunk/proto/atdd_example/atest/amount_of_vacation.txt
 /trunk/proto/atdd_example/atest/resource.txt

=======================================
--- /dev/null
+++ /trunk/proto/atdd_example/atest/query_amount_of_vacation.txt Tue Mar 16 03:02:30 2010
@@ -0,0 +1,22 @@
+*** Test Cases ***
+
+Employee vacations can be queried
+  Given no users exist in the system
+  And employee Kari H is added with start date 2010-1-1
+  When amount of vacation days for Kari H is queried for year 2010
+ Then message "Kari H has 6 days for vacation during holiday credit year 2010" is shown
+
+Employee vacations queary fails if employee does not exist
+  Given no users exist in the system
+  When amount of vacation days for Kari H is queried for year 2010
+  Then error message "Kari H does not exist in the system" is shown
+
+
+*** User Keywords ***
+
+When amount of vacation days for ${name} is queried for year ${year}
+  Get vacation  "${name}"  ${year}
+
+
+*** Settings ***
+Resource  resource.txt
=======================================
--- /trunk/proto/atdd_example/VacalcLibrary.py  Tue Mar 16 02:27:11 2010
+++ /trunk/proto/atdd_example/VacalcLibrary.py  Tue Mar 16 03:02:30 2010
@@ -25,6 +25,10 @@
     def get_employee(self, name):
         self._run('get_employee', name)

+    def get_vacation(self, name, year):
+        self._run('get_vacation', name, year)
+
+
     def _run(self, command, *args):
         cmd = [sys.executable, 'vacalc.py', command] + list(args)
         print subprocess.list2cmdline(cmd)
=======================================
--- /trunk/proto/atdd_example/atest/add_employee.txt Mon Mar 15 13:37:29 2010 +++ /trunk/proto/atdd_example/atest/add_employee.txt Tue Mar 16 03:02:30 2010
@@ -17,22 +17,7 @@
     When employee JR is added with start date 2010-1-1
Then error message "Employee 'JR' already exists in the system" is shown

-*** Keywords ***
-Given no users exist in the system
-   Clear Database
-
-Employee ${name} is added with start date ${date}
-    Add Employee  ${name}  ${date}
-
-Then message "${msg}" is shown
-    Status Should Be  ${msg}
-
-User queries info about ${name}
-    Get Employee  ${name}
-
-Then error message "${msg}" is shown
-    Status Should Be  ${msg}
-

 *** Settings ***
+
 Resource  resource.txt
=======================================
--- /trunk/proto/atdd_example/atest/amount_of_vacation.txt Mon Mar 15 06:43:29 2010 +++ /trunk/proto/atdd_example/atest/amount_of_vacation.txt Tue Mar 16 03:02:30 2010
@@ -1,28 +1,36 @@
-*** Test Cases ***
-Employee has worked less than a year before the holiday credit year starts
-  Given employee starts working 2010-1-1
-  When she works 14 or more days per month
- Then she has 6 day vacation on the holiday credit year 2010 (period from 1 April 2010 to 31 March 2011)
-
-Employee has worked exactly a year before the holiday credit year starts
+holiday credit year: period from 1 April to 31 March
+
+*** Test Cases ***
+Employee has started exactly a year before the holiday credit year starts
When employee starts on 2009-4-1 then she has 24 day vacation on year 2010

-Employee has worked day over a year before the holiday credit year starts
+Employee has started day over a year before the holiday credit year starts
When employee starts on 2009-3-31 then she has 30 day vacation on year 2010

 Employee has less than 14 days during the first month of employment
- When employee starts on 2010-2-10 then she has 2 day vacation on year 2010
+  Amount of vacation should be  2010-2-10  2010  2

 Employee has 14 days during the first month of employment
-  When employee starts on 2010-2-9 then she has 4 day vacation on year 2010
-
-Employee has worked years before the holiday credit year starts
- When employee starts on 2000-1-21 then she has 30 day vacation on year 2010
+  Amount of vacation should be  2010-2-9  2010  4
+
+Employee has started during the holiday credit year
+  Amount of vacation should be  2010-6-1  2010  0
+
+Employee has started after the holiday credit year
+  Amount of vacation should be  2011-6-1  2010  0
+
+Employee has started more than year before the holiday credit year starts
+  Amount of vacation should be  2000-1-21  2010  30
+

 *** Keywords ***
-When employee starts on ${startdate} then she has ${exp_vacation} day vacation on year ${year}
-  ${vacation} =  Count Vacation  ${startdate}  ${year}
-  Should Be Equal As Integers  ${vacation}  ${exp_vacation}
+When employee starts on ${startdate} then she has ${expected vacation} day vacation on year ${year}
+  Amount of vacation should be  ${startdate}  ${year}  ${expected vacation}
+
+Amount of vacation should be
+ [Arguments] ${employee startdate} ${vacation year} ${expected amount of vacation} + ${amount of vacation} = Count Vacation ${employee startdate} ${vacation year} + Should Be Equal As Integers ${amount of vacation} ${expected amount of vacation}

 *** Settings ***
 Resource  resource.txt
=======================================
--- /trunk/proto/atdd_example/atest/resource.txt        Mon Mar 15 06:43:29 2010
+++ /trunk/proto/atdd_example/atest/resource.txt        Tue Mar 16 03:02:30 2010
@@ -1,2 +1,24 @@
 *** Settings ***
+
 Library  VacalcLibrary
+
+
+*** User Keywords ***
+
+Given no users exist in the system
+   Clear Database
+
+Then message "${msg}" is shown
+    Status Should Be  ${msg}
+
+Then error message "${msg}" is shown
+    Status Should Be  ${msg}
+
+Employee ${name} is added with start date ${date}
+    Add Employee  ${name}  ${date}
+
+User queries info about ${name}
+    Get Employee  ${name}
+
+
+

Reply via email to