Revision: 3988
Author: jprantan
Date: Mon Aug 30 04:10:56 2010
Log: Splitted misc suite and increased sleep time to prevent flickering
test.
http://code.google.com/p/robotframework/source/detail?r=3988
Added:
/trunk/atest/robot/standard_libraries/operating_system/modified_time.txt
/trunk/atest/robot/standard_libraries/operating_system/touch.txt
/trunk/atest/testdata/standard_libraries/operating_system/modified_time.txt
/trunk/atest/testdata/standard_libraries/operating_system/touch.txt
Modified:
/trunk/atest/robot/standard_libraries/operating_system/misc.txt
/trunk/atest/testdata/standard_libraries/operating_system/misc.txt
=======================================
--- /dev/null
+++
/trunk/atest/robot/standard_libraries/operating_system/modified_time.txt
Mon Aug 30 04:10:56 2010
@@ -0,0 +1,41 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY}
standard_libraries/operating_system/modified_time.txt
+Force Tags regression jybot pybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+Get Modified Time As Timestamp
+ ${tc} = Check testcase Get Modified Time As Timestamp
+ Should Match Regexp ${tc.kws[0].msgs[0].message} Last modified time
of '<a href=.*</a>' is 20\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d
+
+Get Modified Time As Seconds After Epoch
+ ${tc} = Check testcase Get Modified Time As Seconds After Epoch
+ Should Match Regexp ${tc.kws[0].msgs[0].message} Last modified time
of '<a href=.*</a>' is \\d+
+
+Get Modified Time As Parts
+ Check testcase Get Modified Time As Parts
+
+Get Modified Time Fails When Path Does Not Exist
+ Check testcase get modified Time Fails When Path Does Not Exist
+
+Set Modified Time Using Epoch
+ ${tc} = Check testcase Set Modified Time Using Epoch
+ ${path} = Join Path ${CURDIR}/../../.. testdata
standard_libraries operating_system robot_temp_file.txt
+ Check Log Message ${tc.kws[1].msgs[0]} Set modified time of '<a
href="file://${path}">${path}</a>' to 2007-04-26 11:22:20 HTML
+
+Set Modified Time Using Timestamp
+ ${tc} = Check testcase Set modified Time Using Timestamp
+ ${path} = Join Path ${CURDIR}/../../.. testdata
standard_libraries operating_system robot_temp_file.txt
+ Check Log Message ${tc.kws[1].kws[0].kws[0].msgs[0]} Set modified
time of '<a href="file://${path}">${path}</a>' to 2007-04-26 11:22:30 HTML
+ Check Log Message ${tc.kws[1].kws[1].kws[0].msgs[0]} Set modified
time of '<a href="file://${path}">${path}</a>' to 2007-04-26 11:22:30 HTML
+ Check Log Message ${tc.kws[1].kws[2].kws[0].msgs[0]} Set modified
time of '<a href="file://${path}">${path}</a>' to 2007-04-26 11:22:30 HTML
+ Check Log Message ${tc.kws[1].kws[3].kws[0].msgs[0]} Set modified
time of '<a href="file://${path}">${path}</a>' to 2007-04-26 11:22:30 HTML
+
+Set Modified Time Using NOW
+ Check testcase Set Modified Time Using NOW
+
+Set Modified Time Fails When Path Does Not Exist
+ Check testcase Set Modified Time Fails When Path Does Not Exist
+
+Set Modified Time Fails When Path Is Directory
+ Check testcase Set Modified Time Fails When Path Is Directory
=======================================
--- /dev/null
+++ /trunk/atest/robot/standard_libraries/operating_system/touch.txt Mon
Aug 30 04:10:56 2010
@@ -0,0 +1,19 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY}
standard_libraries/operating_system/touch.txt
+Force Tags regression jybot pybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+Touch
+ ${tc} = Check testcase Touch
+ ${path} = Join Path ${CURDIR}/../../.. testdata
standard_libraries operating_system robot_temp_file.txt
+ Check Log Message ${tc.kws[1].msgs[0]} Touched new file '<a
href="file://${path}">${path}</a>' HTML
+ Check Log Message ${tc.kws[5].msgs[0]} Touched existing file '<a
href="file://${path}">${path}</a>' HTML
+ Check Log Message ${tc.kws[9].msgs[0]} Touched existing file '<a
href="file://${path}">${path}</a>' HTML
+
+Touch Dir Fails
+ Check testcase Touch Dir Fails
+
+Touch When Parent Does Not Exist Fails
+ Check testcase Touch When Parent Does Not Exist Fails
+
=======================================
--- /dev/null
+++
/trunk/atest/testdata/standard_libraries/operating_system/modified_time.txt
Mon Aug 30 04:10:56 2010
@@ -0,0 +1,90 @@
+*** Settings ***
+Suite Teardown Remove Temps
+Test Setup Remove Temps
+Library OperatingSystem
+
+*** Variables ***
+${TESTFILE} ${CURDIR}${/}robot_temp_file.txt
+${TESTDIR} ${CURDIR}${/}robot_temp_dir
+
+*** Test Cases ***
+Get Modified Time As Timestamp
+ ${time1} = Get Modified Time ${CURDIR}
+ Log ${time1}
+ Create File ${TESTFILE} hello
+ ${time2} = Get Modified Time ${TESTFILE}
+ Log ${time2}
+ Should Be True '${time2}' >= '${time1}'
+ Should Match Regexp ${time1} \\d{4}-\\d{2}-\\d{2}
\\d{2}:\\d{2}:\\d{2}
+
+Get Modified Time As Seconds After Epoch
+ ${dirtime} = Get Modified Time ${CURDIR} epoch
+ Should Be True 1000000000 < ${dirtime} < 2000000000
+ ${current} = Get Time epoch
+ Should Be True ${current} >= ${dirtime}
+
+Get Modified Time As Parts
+ ${year} = Get Modified Time ${CURDIR} year
+ Should Be True 2000 < ${year} < 2100
+ ${yyyy} ${mm} ${dd} = Get Modified Time ${CURDIR} year, month, day
+ Should Be Equal ${yyyy} ${year}
+ Comment Must use 'int', because otherwise 08 and 09 cause problems.
They are thougt to be octal but there is no such octal numbers as 08 or 09.
+ Should Be True 1 <= int('${mm}') <= 12
+ Should Be True 1 <= int('${dd}') <= 31
+ @{time} = Get Modified Time ${CURDIR} year, sec, min, hour
+ Should Be Equal @{time}[0] ${year}
+ Should Be True 0 <= int('@{time}[1]') <= 23
+ Should Be True 0 <= int('@{time}[2]') <= 59
+ Should Be True 0 <= int('@{time}[3]') <= 59
+
+Get Modified Time Fails When Path Does Not Exist
+ [Documentation] FAIL Getting modified time
of '${CURDIR}${/}does_not_exist' failed: Path does not exist
+ Get Modified Time ${CURDIR}${/}does_not_exist
+
+Set Modified Time Using Epoch
+ [Documentation] FAIL Setting modified time of '${TESTFILE}' failed:
Epoch time must be positive (got -1)
+ Create File ${TESTFILE}
+ Set Modified Time ${TESTFILE} 1177575740
+ ${mtime} = Get Modified Time ${TESTFILE}
+ Should Be Equal ${mtime} 2007-04-26 11:22:20
+ Set Modified time ${TESTFILE} -1
+
+Set Modified Time Using Timestamp
+ [Documentation] FAIL Setting modified time of '${TESTFILE}' failed:
Invalid time format 'invalid'
+ Create File ${TESTFILE}
+ :FOR ${timestamp} IN 2007-04-26 11:22:30 20070426 11:22:30
20070426 112230 20070426-112230 20070426 11:22:30.456
+ ... 20070426 11:22:29.9 invalid
+ \ Set Modified Time ${TESTFILE} ${timestamp}
+ \ ${mtime} = Get Modified Time ${TESTFILE} epoch
+ \ Should Be Equal ${mtime} ${1177575750}
+
+Set Modified Time Using NOW
+ [Documentation] FAIL Setting modified time of '${TESTFILE}' failed:
Invalid time string 'invalid'
+ Create File ${TESTFILE}
+ ${t0} = Get Modified Time ${TESTFILE} epoch
+ Sleep 2.5 s
+ Set Modified Time ${TESTFILE} NOW
+ ${t1} = Get Modified Time ${TESTFILE} epoch
+ Should Be True ${t0} < ${t1} < ${t0}+5
+ Set Modified Time ${TESTFILE} NOW-1day
+ ${t2} = Get Modified Time ${TESTFILE} epoch
+ Should Be True ${t2}-4 <= ${t1} - 24*60*60 <= ${t2}
+ Set Modified Time ${TESTFILE} now + 1 day 2 hour 3 min 4 seconds 10
ms
+ ${t3} = Get Modified Time ${TESTFILE} epoch
+ Should Be True ${t3}-9 <= ${t1} + (24*60*60 + 2*60*60 + 3*60 + 4) <=
${t3}
+ Set Modified Time ${TESTFILE} NOW + invalid
+
+Set Modified Time Fails When Path Does Not Exist
+ [Documentation] FAIL Setting modified time
of '${CURDIR}${/}does_not_exist' failed: File does not exist
+ Set Modified Time ${CURDIR}${/}does_not_exist 0
+
+Set Modified Time Fails When Path Is Directory
+ [Documentation] FAIL Setting modified time of '${CURDIR}' failed:
Modified time can only be set to regular files
+ Set Modified Time ${CURDIR} 0
+
+
+*** Keywords ***
+Remove Temps
+ Remove File ${TESTFILE}
+ Remove Dir ${TESTDIR} recursive
+
=======================================
--- /dev/null
+++ /trunk/atest/testdata/standard_libraries/operating_system/touch.txt Mon
Aug 30 04:10:56 2010
@@ -0,0 +1,38 @@
+*** Settings ***
+Suite Teardown Remove Temps
+Test Setup Remove Temps
+Library OperatingSystem
+
+*** Variables ***
+${TESTFILE} ${CURDIR}${/}robot_temp_file.txt
+${TESTDIR} ${CURDIR}${/}robot_temp_dir
+
+*** Test Cases ***
+Touch
+ Should Not Exist ${TESTFILE}
+ Touch ${TESTFILE}
+ File Should Be Empty ${TESTFILE}
+ ${time1} = Get Modified Time ${TESTFILE} epoch
+ Sleep 2.5 s
+ Touch ${TESTFILE}
+ ${time2} = Get Modified Time ${TESTFILE} epoch
+ Should Be True ${time2} > ${time1}
+ Create File ${TESTFILE} Some text\nin 2 lines\n
+ Touch ${TESTFILE}
+ ${content} = Get File ${TESTFILE}
+ Should Be Equal ${content} Some text\nin 2 lines\n
+
+Touch Dir Fails
+ [Documentation] FAIL Cannot touch '${CURDIR}' because it is a
directory
+ Touch ${CURDIR}
+
+Touch When Parent Does Not Exist Fails
+ [Documentation] FAIL Cannot touch '${TESTDIR}${/}file.txt' because
its parent directory does not exist
+ Fail If Dir Exists ${TESTDIR}
+ Touch ${TESTDIR}/file.txt
+
+*** Keywords ***
+Remove Temps
+ Remove File ${TESTFILE}
+ Remove Dir ${TESTDIR} recursive
+
=======================================
--- /trunk/atest/robot/standard_libraries/operating_system/misc.txt Mon Apr
12 05:17:10 2010
+++ /trunk/atest/robot/standard_libraries/operating_system/misc.txt Mon Aug
30 04:10:56 2010
@@ -4,42 +4,6 @@
Resource atest_resource.txt
*** Test Cases ***
-Get Modified Time As Timestamp
- ${tc} = Check testcase Get Modified Time As Timestamp
- Should Match Regexp ${tc.kws[0].msgs[0].message} Last modified time
of '<a href=.*</a>' is 20\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d
-
-Get Modified Time As Seconds After Epoch
- ${tc} = Check testcase Get Modified Time As Seconds After Epoch
- Should Match Regexp ${tc.kws[0].msgs[0].message} Last modified time
of '<a href=.*</a>' is \\d+
-
-Get Modified Time As Parts
- Check testcase Get Modified Time As Parts
-
-Get Modified Time Fails When Path Does Not Exist
- Check testcase get modified Time Fails When Path Does Not Exist
-
-Set Modified Time Using Epoch
- ${tc} = Check testcase Set Modified Time Using Epoch
- ${path} = Join Path ${CURDIR}/../../.. testdata
standard_libraries operating_system robot_temp_file.txt
- Check Log Message ${tc.kws[1].msgs[0]} Set modified time of '<a
href="file://${path}">${path}</a>' to 2007-04-26 11:22:20 HTML
-
-Set Modified Time Using Timestamp
- ${tc} = Check testcase Set modified Time Using Timestamp
- ${path} = Join Path ${CURDIR}/../../.. testdata
standard_libraries operating_system robot_temp_file.txt
- Check Log Message ${tc.kws[1].kws[0].kws[0].msgs[0]} Set modified
time of '<a href="file://${path}">${path}</a>' to 2007-04-26 11:22:30 HTML
- Check Log Message ${tc.kws[1].kws[1].kws[0].msgs[0]} Set modified
time of '<a href="file://${path}">${path}</a>' to 2007-04-26 11:22:30 HTML
- Check Log Message ${tc.kws[1].kws[2].kws[0].msgs[0]} Set modified
time of '<a href="file://${path}">${path}</a>' to 2007-04-26 11:22:30 HTML
- Check Log Message ${tc.kws[1].kws[3].kws[0].msgs[0]} Set modified
time of '<a href="file://${path}">${path}</a>' to 2007-04-26 11:22:30 HTML
-
-Set Modified Time Using NOW
- Check testcase Set Modified Time Using NOW
-
-Set Modified Time Fails When Path Does Not Exist
- Check testcase Set Modified Time Fails When Path Does Not Exist
-
-Set Modified Time Fails When Path Is Directory
- Check testcase Set Modified Time Fails When Path Is Directory
-
Get File Size
${tc} = Check testcase Get File Size
${path} = Join Path ${CURDIR}/../../.. testdata
standard_libraries operating_system robot_temp_file.txt
@@ -68,17 +32,3 @@
List And Count Files And Directories In Directory
[Documentation] Tests 'List Files In Directory', 'List Directories In
Directory', 'Count Files In Directory', 'Count Directories In Directory'
and 'Count Items In Directory'
Check testcase List And Count Files And Directories In Directory
-
-Touch
- ${tc} = Check testcase Touch
- ${path} = Join Path ${CURDIR}/../../.. testdata
standard_libraries operating_system robot_temp_file.txt
- Check Log Message ${tc.kws[1].msgs[0]} Touched new file '<a
href="file://${path}">${path}</a>' HTML
- Check Log Message ${tc.kws[5].msgs[0]} Touched existing file '<a
href="file://${path}">${path}</a>' HTML
- Check Log Message ${tc.kws[9].msgs[0]} Touched existing file '<a
href="file://${path}">${path}</a>' HTML
-
-Touch Dir Fails
- Check testcase Touch Dir Fails
-
-Touch When Parent Does Not Exist Fails
- Check testcase Touch When Parent Does Not Exist Fails
-
=======================================
--- /trunk/atest/testdata/standard_libraries/operating_system/misc.txt Tue
Mar 23 07:17:58 2010
+++ /trunk/atest/testdata/standard_libraries/operating_system/misc.txt Mon
Aug 30 04:10:56 2010
@@ -8,80 +8,6 @@
${TESTDIR} ${CURDIR}${/}robot_temp_dir
*** Test Cases ***
-Get Modified Time As Timestamp
- ${time1} = Get Modified Time ${CURDIR}
- Log ${time1}
- Create File ${TESTFILE} hello
- ${time2} = Get Modified Time ${TESTFILE}
- Log ${time2}
- Should Be True '${time2}' >= '${time1}'
- Should Match Regexp ${time1} \\d{4}-\\d{2}-\\d{2}
\\d{2}:\\d{2}:\\d{2}
-
-Get Modified Time As Seconds After Epoch
- ${dirtime} = Get Modified Time ${CURDIR} epoch
- Should Be True 1000000000 < ${dirtime} < 2000000000
- ${current} = Get Time epoch
- Should Be True ${current} >= ${dirtime}
-
-Get Modified Time As Parts
- ${year} = Get Modified Time ${CURDIR} year
- Should Be True 2000 < ${year} < 2100
- ${yyyy} ${mm} ${dd} = Get Modified Time ${CURDIR} year, month, day
- Should Be Equal ${yyyy} ${year}
- Comment Must use 'int', because otherwise 08 and 09 cause problems.
They are thougt to be octal but there is no such octal numbers as 08 or 09.
- Should Be True 1 <= int('${mm}') <= 12
- Should Be True 1 <= int('${dd}') <= 31
- @{time} = Get Modified Time ${CURDIR} year, sec, min, hour
- Should Be Equal @{time}[0] ${year}
- Should Be True 0 <= int('@{time}[1]') <= 23
- Should Be True 0 <= int('@{time}[2]') <= 59
- Should Be True 0 <= int('@{time}[3]') <= 59
-
-Get Modified Time Fails When Path Does Not Exist
- [Documentation] FAIL Getting modified time
of '${CURDIR}${/}does_not_exist' failed: Path does not exist
- Get Modified Time ${CURDIR}${/}does_not_exist
-
-Set Modified Time Using Epoch
- [Documentation] FAIL Setting modified time of '${TESTFILE}' failed:
Epoch time must be positive (got -1)
- Create File ${TESTFILE}
- Set Modified Time ${TESTFILE} 1177575740
- ${mtime} = Get Modified Time ${TESTFILE}
- Should Be Equal ${mtime} 2007-04-26 11:22:20
- Set Modified time ${TESTFILE} -1
-
-Set Modified Time Using Timestamp
- [Documentation] FAIL Setting modified time of '${TESTFILE}' failed:
Invalid time format 'invalid'
- Create File ${TESTFILE}
- :FOR ${timestamp} IN 2007-04-26 11:22:30 20070426 11:22:30
20070426 112230 20070426-112230 20070426 11:22:30.456
- ... 20070426 11:22:29.9 invalid
- \ Set Modified Time ${TESTFILE} ${timestamp}
- \ ${mtime} = Get Modified Time ${TESTFILE} epoch
- \ Should Be Equal ${mtime} ${1177575750}
-
-Set Modified Time Using NOW
- [Documentation] FAIL Setting modified time of '${TESTFILE}' failed:
Invalid time string 'invalid'
- Create File ${TESTFILE}
- ${t0} = Get Modified Time ${TESTFILE} epoch
- Sleep 1.1 s
- Set Modified Time ${TESTFILE} NOW
- ${t1} = Get Modified Time ${TESTFILE} epoch
- Should Be True ${t0} < ${t1} < ${t0}+5
- Set Modified Time ${TESTFILE} NOW-1day
- ${t2} = Get Modified Time ${TESTFILE} epoch
- Should Be True ${t2}-4 <= ${t1} - 24*60*60 <= ${t2}
- Set Modified Time ${TESTFILE} now + 1 day 2 hour 3 min 4 seconds 10
ms
- ${t3} = Get Modified Time ${TESTFILE} epoch
- Should Be True ${t3}-9 <= ${t1} + (24*60*60 + 2*60*60 + 3*60 + 4) <=
${t3}
- Set Modified Time ${TESTFILE} NOW + invalid
-
-Set Modified Time Fails When Path Does Not Exist
- [Documentation] FAIL Setting modified time
of '${CURDIR}${/}does_not_exist' failed: File does not exist
- Set Modified Time ${CURDIR}${/}does_not_exist 0
-
-Set Modified Time Fails When Path Is Directory
- [Documentation] FAIL Setting modified time of '${CURDIR}' failed:
Modified time can only be set to regular files
- Set Modified Time ${CURDIR} 0
-
Get File Size
Create File ${TESTFILE}
${size} = Get File Size ${TESTFILE}
@@ -192,28 +118,6 @@
Should Be Equal ${html_dir_count} ${0}
Should Be Equal ${html_file_count} ${html_item_count}
-Touch
- Should Not Exist ${TESTFILE}
- Touch ${TESTFILE}
- File Should Be Empty ${TESTFILE}
- ${time1} = Get Modified Time ${TESTFILE} epoch
- Sleep 1.1 s
- Touch ${TESTFILE}
- ${time2} = Get Modified Time ${TESTFILE} epoch
- Should Be True ${time2} > ${time1}
- Create File ${TESTFILE} Some text\nin 2 lines\n
- Touch ${TESTFILE}
- ${content} = Get File ${TESTFILE}
- Should Be Equal ${content} Some text\nin 2 lines\n
-
-Touch Dir Fails
- [Documentation] FAIL Cannot touch '${CURDIR}' because it is a
directory
- Touch ${CURDIR}
-
-Touch When Parent Does Not Exist Fails
- [Documentation] FAIL Cannot touch '${TESTDIR}${/}file.txt' because
its parent directory does not exist
- Fail If Dir Exists ${TESTDIR}
- Touch ${TESTDIR}/file.txt
*** Keywords ***
Remove Temps