Revision: 4540
Author: jussi.ao.malinen
Date: Tue Dec 28 06:14:52 2010
Log: moved set log level tests to own suite. Added tests for dynamically
setting log level during run and output to html getting the correct
printouts (issue 751).
http://code.google.com/p/robotframework/source/detail?r=4540
Added:
/trunk/atest/robot/standard_libraries/builtin/set_log_level.txt
/trunk/atest/testdata/standard_libraries/builtin/set_log_level.txt
Modified:
/trunk/atest/resources/atest_resource.txt
/trunk/atest/robot/standard_libraries/builtin/misc.txt
/trunk/atest/testdata/standard_libraries/builtin/misc.txt
=======================================
--- /dev/null
+++ /trunk/atest/robot/standard_libraries/builtin/set_log_level.txt Tue Dec
28 06:14:52 2010
@@ -0,0 +1,30 @@
+*** Settings ***
+Suite Setup Run Tests --log set_log_level_log.html
standard_libraries/builtin/set_log_level.txt
+Force Tags regression
+Default Tags jybot pybot
+Resource atest_resource.txt
+
+*** Test Cases ***
+Set Log Level
+ ${tc} = Check Test Case
+ Check Log Message ${tc.kws[1].msgs[1]} This is logged TRACE
+ Check Log Message ${tc.kws[2].msgs[1]} This is logged DEBUG
+ Check Log Message ${tc.kws[3].msgs[1]} This is logged INFO
+ Should Be Equal As Integers ${tc.kws[6].message_count} 0
+ Check Log Message ${tc.kws[7].msgs[0]} This is logged DEBUG
+ Check Log Message ${tc.kws[8].msgs[0]} This is logged INFO
+ Should Be Equal As Integers ${tc.kws[10].message_count} 0
+ Should Be Equal As Integers ${tc.kws[11].message_count} 0
+ Check Log Message ${tc.kws[12].msgs[0]} This is logged INFO
+ Should Be Equal As Integers ${tc.kws[15].message_count} 0
+ Check Log Message ${tc.kws[16].msgs[0]} This is logged ERROR
+ Should Be Equal As Integers ${tc.kws[18].message_count} 0
+ Should Be Equal As Integers ${tc.kws[19].message_count} 0
+ Should Be Equal As Integers ${tc.kws[20].message_count} 0
+
+Log Level Goes To HTML
+ ${tc} = Check Test Case
+ Check File Contains ${OUTDIR}${/}set_log_level_log.html KW Info
to log
+ Check File Contains ${OUTDIR}${/}set_log_level_log.html KW Trace
to log
+ Check File Contains ${OUTDIR}${/}set_log_level_log.html TC Info
to log
+ Check File Contains ${OUTDIR}${/}set_log_level_log.html TC Trace
to log
=======================================
--- /dev/null
+++ /trunk/atest/testdata/standard_libraries/builtin/set_log_level.txt Tue
Dec 28 06:14:52 2010
@@ -0,0 +1,41 @@
+*** Variables ***
+# Used to make arguments look different from actual printout in html
+${to log} = to log
+
+*** Test Cases ***
+Set Log Level
+ [Documentation] FAIL Invalid log level 'INVALID'
+ Set Log Level TRACE
+ Log This is logged TRACE
+ Log This is logged DEBUG
+ Log This is logged INFO
+ ${old} = Set Log Level debug
+ Should Be Equal ${old} TRACE
+ Log This is NOT logged TRACE
+ Log This is logged DEBUG
+ Log This is logged INFO
+ Set Log Level Info
+ Log This is NOT logged TRACE
+ Log This is NOT logged DEBUG
+ Log This is logged INFO
+ ${old} = Set Log Level ErRoR
+ Should Be Equal ${old} INFO
+ Log This is NOT logged INFO
+ Log This is logged ERROR
+ Set Log Level NONE
+ Log NOT logged
+ Log NOT logged FAIL
+ Set Log Level INVALID
+ [Teardown] Set Log Level INFO
+
+Log Level Goes To HTML
+ Set Log Level Trace
+ Log TC Trace ${to log} Trace
+ Log TC Info ${to log} Info
+ logging kw
+
+
+*** Keywords ***
+logging kw
+ Log KW Trace ${to log} Trace
+ Log KW Info ${to log} Info
=======================================
--- /trunk/atest/resources/atest_resource.txt Fri Dec 3 01:42:43 2010
+++ /trunk/atest/resources/atest_resource.txt Tue Dec 28 06:14:52 2010
@@ -103,7 +103,7 @@
[return] ${INTERPRETER}
Check Test Case
- [Arguments] ${name} ${status}=${None} ${message}=${None}
+ [Arguments] ${name}=${TEST NAME} ${status}=${None}
${message}=${None}
${test} = Get Test From Suite ${SUITE} ${name}
Check Test Status ${test} ${status} ${message}
[Return] ${test}
=======================================
--- /trunk/atest/robot/standard_libraries/builtin/misc.txt Mon Aug 30
09:54:57 2010
+++ /trunk/atest/robot/standard_libraries/builtin/misc.txt Tue Dec 28
06:14:52 2010
@@ -34,23 +34,6 @@
Should Be Equal As Integers ${tc.kws[1].msg_count} 0
Should Be Equal As Integers ${tc.kws[2].msg_count} 0
-Set Log Level
- ${tc} = Check Test Case Set Log Level
- Check Log Message ${tc.kws[1].msgs[1]} This is logged TRACE
- Check Log Message ${tc.kws[2].msgs[1]} This is logged DEBUG
- Check Log Message ${tc.kws[3].msgs[1]} This is logged INFO
- Should Be Equal As Integers ${tc.kws[6].message_count} 0
- Check Log Message ${tc.kws[7].msgs[0]} This is logged DEBUG
- Check Log Message ${tc.kws[8].msgs[0]} This is logged INFO
- Should Be Equal As Integers ${tc.kws[10].message_count} 0
- Should Be Equal As Integers ${tc.kws[11].message_count} 0
- Check Log Message ${tc.kws[12].msgs[0]} This is logged INFO
- Should Be Equal As Integers ${tc.kws[15].message_count} 0
- Check Log Message ${tc.kws[16].msgs[0]} This is logged ERROR
- Should Be Equal As Integers ${tc.kws[18].message_count} 0
- Should Be Equal As Integers ${tc.kws[19].message_count} 0
- Should Be Equal As Integers ${tc.kws[20].message_count} 0
-
Import Library
Check Test Case Import Library 1
Check Test Case Import Library 2
=======================================
--- /trunk/atest/testdata/standard_libraries/builtin/misc.txt Mon Sep 20
14:17:48 2010
+++ /trunk/atest/testdata/standard_libraries/builtin/misc.txt Tue Dec 28
06:14:52 2010
@@ -59,31 +59,6 @@
Comment
Comment Should work also with ${NON EXISTING} variable and ${OTHER
NON EXISTING} variable
Comment @{NON EXISTING LIST} variable should work also @{OTHER NON
EXISTING LIST}
-
-Set Log Level
- [Documentation] FAIL Invalid log level 'INVALID'
- Set Log Level TRACE
- Log This is logged TRACE
- Log This is logged DEBUG
- Log This is logged INFO
- ${old} = Set Log Level debug
- Should Be Equal ${old} TRACE
- Log This is NOT logged TRACE
- Log This is logged DEBUG
- Log This is logged INFO
- Set Log Level Info
- Log This is NOT logged TRACE
- Log This is NOT logged DEBUG
- Log This is logged INFO
- ${old} = Set Log Level ErRoR
- Should Be Equal ${old} INFO
- Log This is NOT logged INFO
- Log This is logged ERROR
- Set Log Level NONE
- Log NOT logged
- Log NOT logged FAIL
- Set Log Level INVALID
- [Teardown] Set Log Level INFO
Import Library 1
[Documentation] Verify that keyword to be imported is not yet
available FAIL No keyword with name 'Directory Should Exist' found.