2 new revisions:

Revision: caa51debf3a4
Branch:   default
Author:   Pekka Klärck
Date:     Thu Feb  6 22:03:29 2014 UTC
Log:      atests: enhanced tests for non-ascii debug file, cleanup/tidy
http://code.google.com/p/robotframework/source/detail?r=caa51debf3a4

Revision: 941f86eb2cce
Branch:   default
Author:   Pekka Klärck
Date:     Thu Feb  6 22:17:12 2014 UTC
Log:      Debug file: Fixed log message timestamps....
http://code.google.com/p/robotframework/source/detail?r=941f86eb2cce

==============================================================================
Revision: caa51debf3a4
Branch:   default
Author:   Pekka Klärck
Date:     Thu Feb  6 22:03:29 2014 UTC
Log:      atests: enhanced tests for non-ascii debug file, cleanup/tidy
http://code.google.com/p/robotframework/source/detail?r=caa51debf3a4

Modified:
 /atest/robot/cli/runner/cli_resource.txt
 /atest/robot/cli/runner/debugfile.txt

=======================================
--- /atest/robot/cli/runner/cli_resource.txt    Thu May 30 14:48:32 2013 UTC
+++ /atest/robot/cli/runner/cli_resource.txt    Thu Feb  6 22:03:29 2014 UTC
@@ -1,42 +1,44 @@
 *** Settings ***
-Resource        atest_resource.txt
-
+Resource          atest_resource.txt

 *** Variables ***
 ${CLI OUTDIR}     %{TEMPDIR}${/}cli
 ${TEST FILE}      misc${/}normal.txt
-${UNICODE TEST}   misc${/}unicode.txt
-
+${UNICODE TEST}    misc${/}unicode.txt

 *** Keywords ***
-
 Create Output Directory
-    Remove Directory  ${CLI OUTDIR}  recursive
-    Create Directory  ${CLI OUTDIR}
+    Remove Directory    ${CLI OUTDIR}    recursive
+    Create Directory    ${CLI OUTDIR}

-Directory Should Contain  [Arguments]  ${path}  @{expected}
-    ${actual} =  List Directory  ${path}
-    Should Be Equal  ${actual}  ${expected}
+Directory Should Contain
+    [Arguments]    ${path}    @{expected}
+    ${actual} =    List Directory    ${path}
+    Should Be Equal    ${actual}    ${expected}

-Output Directory Should Contain  [Arguments]  @{expected}
-    Directory Should Contain  ${CLI OUTDIR}  @{expected}
+Output Directory Should Contain
+    [Arguments]    @{expected}
+    Directory Should Contain    ${CLI OUTDIR}    @{expected}

 Output Directory Should Be Empty
-    Directory Should Be Empty  ${CLI OUTDIR}
+    Directory Should Be Empty    ${CLI OUTDIR}

-Run Some Tests  [Arguments]  ${options}=-l none -r none
-    ${path} =  Join Path  ${CURDIR}/../../..  testdata  ${TESTFILE}
-    ${output} =  Run Robot Directly  -d ${CLI OUTDIR} ${options} ${path}
- Should Contain ${output} Output: message=Running tests failed for some reason
-    [Return]  ${output}
+Run Some Tests
+    [Arguments]    ${options}=-l none -r none
+    ${path} =    Join Path    ${CURDIR}/../../..    testdata    ${TESTFILE}
+ ${output} = Run Robot Directly -d ${CLI OUTDIR} ${options} ${path} + Should Contain ${output} Output: message=Running tests failed for some reason
+    [Return]    ${output}

-Tests Should Pass Without Errors  [Arguments]  ${options}  ${datasource}
-    Run Tests  ${options}  ${datasource}
-    Should Be Equal  ${SUITE.status}  PASS
-    File Should Be Empty  ${STDERR FILE}
+Tests Should Pass Without Errors
+    [Arguments]    ${options}    ${datasource}
+    Run Tests    ${options}    ${datasource}
+    Should Be Equal    ${SUITE.status}    PASS
+    File Should Be Empty    ${STDERR FILE}

-Run Should Fail  [Arguments]  ${options}  ${exp error}
+Run Should Fail
+    [Arguments]    ${options}    ${exp error}
     Set Runners
-    ${rc}  ${output} =  Run And Return RC and Output  ${ROBOT} ${options}
-    Should Be Equal As Integers  ${rc}  252
- Should Match Regexp ${output} ^\\[ .*ERROR.* \\] ${exp error}${USAGETIP}$ + ${rc} ${output} = Run And Return RC and Output ${ROBOT} ${options}
+    Should Be Equal As Integers    ${rc}    252
+ Should Match Regexp ${output} ^\\[ .*ERROR.* \\] ${exp error}${USAGETIP}$
=======================================
--- /atest/robot/cli/runner/debugfile.txt       Fri Nov 22 10:55:34 2013 UTC
+++ /atest/robot/cli/runner/debugfile.txt       Thu Feb  6 22:03:29 2014 UTC
@@ -6,13 +6,11 @@
 *** Variables ***
 ${TIMESTAMP}   ???????? ??:??:??.???

-
 *** Test Cases ***
-
 Debugfile
Run Tests Without Processing Output --outputdir=${CLI OUTDIR} --debugfile=DeBug.TXT -o o.xml ${TESTFILE}
     Output Directory Should Contain  DeBug.TXT  o.xml
-    ${content} =  Log File  ${CLI OUTDIR}${/}DeBug.TXT
+    ${content} =  Get File  ${CLI OUTDIR}${/}DeBug.TXT
     Debug file should contain    ${content}           + START SUITE: Normal
Debug file should contain ${content} +- START TEST: First One
     Debug file should contain    ${content}
@@ -32,7 +30,7 @@
 Debugfile Log Level Should Always Be Debug
[Documentation] --loglevel option should not affect what's written to debugfile Run Tests Without Processing Output --outputdir ${CLI OUTDIR} -b debug.txt -o o.xml --loglevel WARN ${TESTFILE}
-    ${content}=     Log file     ${CLI OUTDIR}/debug.txt
+    ${content}=     Get File     ${CLI OUTDIR}/debug.txt
     Debug file should contain    ${content}
     ...    ${TIMESTAMP} - INFO - +-- START KW: BuiltIn.Log [ Test 1 ]
     ...    ${TIMESTAMP} - INFO - Test 1
@@ -42,23 +40,26 @@
     ...    ${TIMESTAMP} - DEBUG - Logging with debug level
     ...    ${TIMESTAMP} - INFO - +-- END KW: BuiltIn.Log

+Writing Non-ASCII To Debugfile
+ [Documentation] Tests also that '.txt' is appended if no extension given + Run Tests Without Processing Output --outputdir ${CLI OUTDIR} --debugfile debug -o o.xml ${UNICODE TEST}
+    Directory Should Contain  ${CLI OUTDIR}  debug.txt  o.xml
+    Stderr Should Be Empty
+    ${content} =    Get File    ${CLI OUTDIR}/debug.txt
+ Debugfile should contain ${TIMESTAMP} - FAIL - Circle is 360°, Hyvää üötä, উৄ ৰ ৺ ট ৫ ৪ হ + Debugfile should contain ${TIMESTAMP} - INFO - +- START TEST: Ünïcödë Tëst änd Këywörd Nämës [ ]
+
 No Debugfile
Run Tests Without Processing Output --outputdir ${CLI OUTDIR} --debugfile NoNe -o o.xml ${TESTFILE}
     Directory Should Contain  ${CLI OUTDIR}  o.xml
     Check Syslog Contains  DebugFile: None

 Invalid Debugfile
-    Create Directory  ${CLI OUTDIR}${/}debug.txt
+    Create Directory  ${CLI OUTDIR}/debug.txt
Run Tests Without Processing Output --outputdir ${CLI OUTDIR} -b debug.txt ${TESTFILE} Check Stderr Matches Regexp \\[ ERROR \\] Opening debug file '.*debug.txt' failed: .* Check Stdout Contains 2 critical tests, 2 passed, 0 failed\n 2 tests total, 2 passed, 0 failed

-Writing Unicode To Debugfile
- [Documentation] Tests also that '.txt' is appended if no extension given - Run Tests Without Processing Output --outputdir ${CLI OUTDIR} --debugfile debug -o o.xml ${UNICODE TEST}
-    Directory Should Contain  ${CLI OUTDIR}  debug.txt  o.xml
-    Stderr Should Be Empty
-
 *** Keywords ***
 Debugfile should contain
     [arguments]     ${content}    @{lines}

==============================================================================
Revision: 941f86eb2cce
Branch:   default
Author:   Pekka Klärck
Date:     Thu Feb  6 22:17:12 2014 UTC
Log:      Debug file: Fixed log message timestamps.

Update issue 1650
Status: Done
Owner: pekka.klarck
Fixed with tests.
http://code.google.com/p/robotframework/source/detail?r=941f86eb2cce

Modified:
 /atest/robot/cli/runner/debugfile.txt
 /src/robot/output/debugfile.py

=======================================
--- /atest/robot/cli/runner/debugfile.txt       Thu Feb  6 22:03:29 2014 UTC
+++ /atest/robot/cli/runner/debugfile.txt       Thu Feb  6 22:17:12 2014 UTC
@@ -40,6 +40,15 @@
     ...    ${TIMESTAMP} - DEBUG - Logging with debug level
     ...    ${TIMESTAMP} - INFO - +-- END KW: BuiltIn.Log

+Debugfile timestamps are accurate
+ Run Tests --outputdir ${CLI OUTDIR} -b debug.txt -t LibraryAddsTimestampAsInteger
+    ...    test_libraries/timestamps_for_stdout_messages.txt
+    ${tc} =    Check Test Case    LibraryAddsTimestampAsInteger
+    ${content} =     Get file     ${CLI OUTDIR}/debug.txt
+    Debug file should contain    ${content}
+    ...    ${tc.kws[0].msgs[0].timestamp} - INFO - Known timestamp
+    ...    ${tc.kws[0].msgs[1].timestamp} - INFO - <b>Current</b>
+
 Writing Non-ASCII To Debugfile
[Documentation] Tests also that '.txt' is appended if no extension given Run Tests Without Processing Output --outputdir ${CLI OUTDIR} --debugfile debug -o o.xml ${UNICODE TEST}
=======================================
--- /src/robot/output/debugfile.py      Thu Jan 23 14:00:53 2014 UTC
+++ /src/robot/output/debugfile.py      Thu Feb  6 22:17:12 2014 UTC
@@ -78,7 +78,7 @@

     def log_message(self, msg):
         if self._is_logged(msg.level):
-            self._write(msg.message, msg_level=msg.level)
+ self._write(msg.message, level=msg.level, timestamp=msg.timestamp)

     def close(self):
         if not self._outfile.closed:
@@ -101,11 +101,12 @@
     def _separator(self, type_):
         self._write(self._separators[type_] * 78, separator=True)

-    def _write(self, text, separator=False, msg_level='INFO'):
+    def _write(self, text, separator=False, level='INFO', timestamp=None):
         if separator and self._separator_written_last:
             return
         if not separator:
- text = '%s - %s - %s' % (utils.get_timestamp(), msg_level, text)
+            text = '%s - %s - %s' % (timestamp or utils.get_timestamp(),
+                                     level, text)
         self._outfile.write(text.encode('UTF-8').rstrip() + '\n')
         self._outfile.flush()
         self._separator_written_last = separator

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to