Revision: 4170
Author: jprantan
Date: Wed Sep 29 13:37:35 2010
Log: Initial keywords for tests.
http://code.google.com/p/robotframework/source/detail?r=4170

Modified:
 /trunk/proto/atdd-tutorial-berlin-2010/atest/vacalc/__init__.txt
 /trunk/proto/atdd-tutorial-berlin-2010/atest/vacalc/add_employee.txt
 /trunk/proto/atdd-tutorial-berlin-2010/atest/vacalc/resource.txt

=======================================
--- /trunk/proto/atdd-tutorial-berlin-2010/atest/vacalc/__init__.txt Wed Sep 29 12:38:49 2010 +++ /trunk/proto/atdd-tutorial-berlin-2010/atest/vacalc/__init__.txt Wed Sep 29 13:37:35 2010
@@ -1,3 +1,4 @@
 *** Settings ***
 Resource  resource.txt
 Suite Setup  Start Vacalc
+Suite Teardown  Clear Database
=======================================
--- /trunk/proto/atdd-tutorial-berlin-2010/atest/vacalc/add_employee.txt Wed Sep 29 12:38:49 2010 +++ /trunk/proto/atdd-tutorial-berlin-2010/atest/vacalc/add_employee.txt Wed Sep 29 13:37:35 2010
@@ -2,18 +2,35 @@

 Adding employee
     Given no employee "Juha" exists in the system
-    When "Juha" with start date 1.1.2010 is added
+    When "Juha" with start date 2010-1-1 is added
     Then message "Employee 'Juha' was added successfully" is shown
-    and "Juha" with start date 1.1.2010 exists in the database
+    and "Juha" exists in the employee listing
+    and "Juha" with start date 2010-1-1 exists in the database

 Adding employee with same ID
-    Given employee "Juha" with start date 1.1.2010 exists in the system
-    When "Juha" with start date 2.1.2010 is added
+    Given employee "Juha" with start date 2010-1-1 exists in the system
+    When "Juha" with start date 2010-2-2 is added
     Then message "Employee 'Juha' already exists in the system" is shown
-    and "Juha" with start date 1.1.2010 exists in the database
-
-***Settings***
-Force Tags   Sprint-1
+    and "Juha" with start date 2010-1-1 exists in the database
+

 *** Keywords ***
-
+Given no employee "${name}" exists in the system
+    Clear Database
+
+When "${name}" with start date ${date} is added
+    Add Employee  ${name}  ${date}
+
+Then message "${message}" is shown
+    Status Message Should Be  ${message}
+
+and "${name}" exists in the employee listing
+    Employee Should Be Selected  ${name}
+
+and "${name}" with start date ${date} exists in the database
+    Employee exists in the database  ${name}  ${date}
+
+
+***Settings***
+Force Tags   Sprint-1
+Resource  resource.txt
=======================================
--- /trunk/proto/atdd-tutorial-berlin-2010/atest/vacalc/resource.txt Wed Sep 29 12:38:49 2010 +++ /trunk/proto/atdd-tutorial-berlin-2010/atest/vacalc/resource.txt Wed Sep 29 13:37:35 2010
@@ -1,8 +1,37 @@
 *** Settings ***
 Library  SwingLibrary
+Library  OperatingSystem
+
+*** Variables ***
+${database}  ${CURDIR}${/}test_db.txt

 *** Keywords ***
 Start Vacalc
+    Set Environment Variable  VACALC_DB  ${database}
     Start Application  org.robotframework.vacalc.VacalcRunner
     Select Window  Vacation Calculator
     ${title}=  Get Selected Window Title
+
+Clear Database
+    Remove File  ${database}
+
+Add Employee
+    [Arguments]  ${name}  ${date}
+    Insert Into Text Field  name_input  ${name}
+    Insert Into Text Field  start_input  ${date}
+    Push Button  save_button
+
+
+
+Status Message Should Be
+    [Arguments]  ${message}
+    Label Text Should Be  status_label  ${message}
+
+Employee Should Be Selected
+    [Arguments]  ${name}
+    ${selected item}=  Get Selected Value From List  employee_list
+    Should Be Equal  ${name}  ${selected item}
+
+Employee exists in the database  ${name}  ${date}
+    ${data} =  Get File  ${database}
+    Should Contain  ${data}  ${name}, ${date}

Reply via email to