Revision: 3875
Author: pekka.klarck
Date: Mon Aug 23 09:49:49 2010
Log: Split rebot's cli tests into smaller suites (or moved them to right
places otherwise). Some tests still to be moved.
http://code.google.com/p/robotframework/source/detail?r=3875
Added:
/trunk/atest/robot/cli/rebot/invalid_usage.txt
/trunk/atest/robot/cli/rebot/misc_tests_to_be_moved_to_own_suites.txt
/trunk/atest/robot/cli/rebot/output_files.txt
/trunk/atest/robot/cli/rebot/rebot_cli_resource.txt
/trunk/atest/robot/cli/rebot/suite_name_doc_and_metadata.txt
/trunk/atest/robot/cli/rebot/timestamp_outputs.txt
Deleted:
/trunk/atest/robot/cli/rebot/commandline.txt
/trunk/atest/robot/cli/rebot/rebot_resource.txt
Modified:
/trunk/atest/robot/cli/rebot/__init__.txt
/trunk/atest/robot/cli/rebot/log_level.txt
/trunk/atest/robot/rebot/combine.txt
=======================================
--- /dev/null
+++ /trunk/atest/robot/cli/rebot/invalid_usage.txt Mon Aug 23 09:49:49 2010
@@ -0,0 +1,61 @@
+*** Settings ***
+Default Tags regression pybot jybot
+Resource rebot_cli_resource.txt
+
+
+*** Test Cases ***
+
+Invalid Options
+ Rebot should fail --invalid option option --invalid not recognized
+ Rebot should fail --name valid -I option -I not recognized
+
+No Input
+ Rebot should fail ${EMPTY} Expected at least 1 argument, got 0.
+
+Non-Existing Input
+ Rebot should fail nonex.xml Output file 'nonex\\.xml' does not exist.
+
+Non-XML Input
+ Create File ${MYOUTDIR}/invalid.txt Hello, world
+ Rebot should fail ${MYOUTDIR}${/}invalid.txt (\\[Fatal Error\\] .*:
Content is not allowed in prolog.\\n)?Opening XML file '.*invalid.txt'
failed: .*
+
+Non-Compatible XML
+ Create File ${MYOUTDIR}/invalid.xml <not><our>type</our></not>
+ Rebot should fail ${MYOUTDIR}${/}invalid.xml File '.*invalid.xml' is
not Robot Framework output file.
+
+Invalid Output Directory
+ [Documentation] Test error handling when some of the output dirs
(where to write output, report, etc.) is invalid (i.e. can't be created).
To make sure creating dirs fails their names are non-standard (that's not
enough in Linux) parent is made read only.
+ Create Directory ${MYOUTDIR}${/}x
+ Set Read Only ${MYOUTDIR}${/}x
+ Rebot should fail -d ${MYOUTDIR}${/}x${/}:i ${MYINPUT}
+ ... Can't create log file's parent directory '.*': (OS|IO|
Windows)Error: .*
+ Rebot should fail -d ${MYOUTDIR}${/}x${/}:i -o out.xml -l none -r
none ${MYINPUT}
+ ... Can't create output file's parent directory '.*': (OS|IO|
Windows)Error: .*
+ [Teardown] Set Read Write ${MYOUTDIR}${/}x
+
+Invalid Output File
+ Create Directory ${MYOUTDIR}${/}directory.ext
+ Rebot should fail -d ${MYOUTDIR} -o directory.ext ${MYINPUT}
+ ... Opening output file '.*directory.ext' for writing failed:
(IOError|FileNotFoundException): .*
+
+Invalid Argument Values
+ Run Rebot --splitoutputs not_int --suitestatlevel not_int
--tagstatlink less_than_3x_: ${MYINPUT}
+ Verify Correct Errors in Stderr Option '--suitestatlevel' expected
integer value but got 'not_int'. Default value used instead.\n
+ Verify Correct Errors in Stderr Option '--splitoutputs' expected
integer value but got 'not_int'. Default value used instead.\n
+ Verify Correct Errors in Stderr Invalid format for
option '--tagstatlink'. Expected 'tag:link:title' but
got 'less_than_3x_:'.\n
+ Should Be Equal ${SUITE.status} PASS
+
+
+*** Keywords ***
+
+Rebot Should Fail [Arguments] ${options} ${exp msg}
+ Set Runners
+ ${rc} ${output} = Run And Return RC and Output ${REBOT} ${options}
+ Should Be Equal As Integers ${rc} 252
+ Should Match Regexp ${output} ^\\[ .*ERROR.* \\] ${exp
msg}${USAGETIP}$
+
+Verify Correct Errors In Stderr
+ [Arguments] @{messages}
+ ${error} = Set Variable If os.sep=='/' ERROR [ ERROR ]
+ Check Stderr Contains ${error}
+ Check Stderr Contains @{messages}
=======================================
--- /dev/null
+++ /trunk/atest/robot/cli/rebot/misc_tests_to_be_moved_to_own_suites.txt
Mon Aug 23 09:49:49 2010
@@ -0,0 +1,113 @@
+*** Settings ***
+Documentation Testing Rebot's command line functionality. Functionality
tested elsewere:\n - filtering by tags/names\n - combining outputs\n -
creating correct html (incl. --xxxtitle options)
+Test Setup Empty Directory ${MYOUTDIR}
+Suite Setup Set Runners
+Force Tags regression pybot jybot
+Resource atest_resource.txt
+
+*** Variables ***
+${TESTFILE} misc${/}normal.html
+${PASS_FAIL_FILE} misc${/}pass_and_fail.html
+${MYOUTDIR} ${TEMPDIR}${/}robot-test-145435
+${MYINPUT} ${TEMPDIR}${/}robot-test-145435.xml
+${M_211_211} 2 critical tests, 1 passed, 1 failed\n 2 tests total, 1
passed, 1 failed
+${M_110_211} 1 critical test, 1 passed, 0 failed\n 2 tests total, 1
passed, 1 failed
+${M_101_211} 1 critical test, 0 passed, 1 failed\n 2 tests total, 1
passed, 1 failed
+${M_000_211} 0 critical tests, 0 passed, 0 failed\n 2 tests total, 1
passed, 1 failed
+${USAGE_TIP} \n\nTry --help for usage information.
+
+*** Test Cases ***
+
+
+
+Help
+ ${rc} ${help} = Run And Return Rc And Output ${REBOT} --help 2>&1
+ Should Be Equal ${rc} ${251}
+ Log ${help.replace(' ','_').replace('\\t','_'*8)}
+ Should Start With ${help} Rebot -- Robot Framework Report and Log
Generator\n \n Version: \
+ Should End With ${help} \n\n# Running 'robot/rebot.py' directly and
creating combined outputs.\n $ python /path/robot/rebot.py -N Project_X -l
x.html -r x.html outputs/*.xml\n
+ Should Not Contain ${help} ERROR
+ @{lines} = Evaluate [ '%d\\t%s' % (len(line), line) for line in
${help.splitlines()} ]
+ Log Many @{lines}
+ @{long} = Evaluate [ line for line in ${help.splitlines()} if
len(line) - line.count('\\\\') >= 80 ]
+ Log Many @{long}
+ Should Be True len(@{long}) == 0 Too long (>= 80) help line(s)
+ ${help2} = Run ${REBOT} -h 2>&1
+ Should Be Equal ${help} ${help2}
+
+Version
+ ${rc} ${output} = Run And Return Rc And Output ${REBOT} --version
2>&1
+ Should Be Equal ${rc} ${251}
+ Log ${output}
+ Should Match Regexp ${output} ^Rebot (2\\.\\d+(\\.\\d+)?( (alpha|
beta|rc)\\d*)?|trunk 2\\d{7}) \\([PJ]ython 2\\.[\\d.]+ on .+\\)$
+ Should Be True len("${output}") < 80 Too long version line
+
+Argument File
+ Create File ${MYOUTDIR}${/}a.txt --name From_Arg_File\n -c c1\n #
comment line\n --log none\n -r none\n --output ${MYOUTDIR}${/}output.xml\n
${MYINPUT}
+ ${output} = Run ${REBOT} --critical c2 --argumentfile
${MYOUTDIR}${/}a.txt 2>&1
+ Should Not Contain ${output} ERROR
+ Process Output ${MYOUTDIR}${/}output.xml
+ Should Be Equal ${SUITE.name} From Arg File
+ Should Be True ${SUITE.critical.tags} == []
+
+Setting Syslog File
+ Set Environment Variable ROBOT_SYSLOG_FILE ${MYOUTDIR}${/}syslog.txt
+ Rebot Something
+ File Should Not Be Empty ${MYOUTDIR}${/}syslog.txt
+ Remove File ${MYOUTDIR}${/}syslog.txt
+ Delete Environment Variable ROBOT_SYSLOG_FILE
+ Rebot Something
+ File Should Not Exist ${MYOUTDIR}${/}syslog.txt
+ Set Environment Variable ROBOT_SYSLOG_FILE none
+ Rebot Something
+ File Should Not Exist ${MYOUTDIR}${/}syslog.txt
+ [Teardown] Delete syslog environment variables
+
+Setting Syslog Level
+ Set Environment Variable ROBOT_SYSLOG_FILE ${MYOUTDIR}${/}syslog.txt
+ Set Environment Variable ROBOT_SYSLOG_LEVEL INFO
+ Rebot Something
+ ${size1} = Get File Size ${MYOUTDIR}${/}syslog.txt
+ Set Environment Variable ROBOT_SYSLOG_LEVEL DEBUG
+ Rebot Something
+ ${size2} = Get File Size ${MYOUTDIR}${/}syslog.txt
+ Should Be True 0 < ${size1} <= ${size2}
+ Set Environment Variable ROBOT_SYSLOG_LEVEL warn
+ Rebot Something
+ File Should Be Empty ${MYOUTDIR}${/}syslog.txt
+ [Teardown] Delete syslog environment variables
+
+
+*** Keywords ***
+Delete syslog environment variables
+ Delete environment variable ROBOT_SYSLOG_FILE
+ Delete environment variable ROBOT_SYSLOG_LEVEL
+
+My Setup
+ Run Tests Without Processing Output ${EMPTY} ${TESTFILE}
+ Move File ${OUTFILE} ${MYINPUT}
+ Create Directory ${MYOUTDIR}
+
+Remove Temps
+ Remove Directory ${MYOUTDIR} recursively
+ Remove File ${MYINPUT}
+
+Directory Should Contain
+ [Arguments] ${dir_path} @{exp_files}
+ ${act_files} = List Directory ${dir_path}
+ Should Be Equal ${act_files} ${exp_files}
+
+Test Critical
+ [Arguments] ${opts} ${input} ${status} ${msg} ${crit_tags}
${crit1} ${crit2}
+ Set Suite Variable $SUITE ${None}
+ Run Rebot ${opts} ${input}
+ Should Be Equal ${SUITE.status} ${status}
+ Should Be Equal ${SUITE.get_full_message()} ${msg}
+ Should Be True ${SUITE.critical_tags} == ${crit_tags}
+ Should Be Equal ${SUITE.tests[0].critical} ${crit1}
+ Should Be Equal ${SUITE.tests[1].critical} ${crit2}
+
+Rebot Something
+ Run ${REBOT} --outputdir ${MYOUTDIR} ${MYINPUT}
+
+
=======================================
--- /dev/null
+++ /trunk/atest/robot/cli/rebot/output_files.txt Mon Aug 23 09:49:49 2010
@@ -0,0 +1,46 @@
+*** Settings ***
+Test Setup Empty output directory
+Test Template Correct outputs should be created
+Force Tags pybot jybot regression
+Resource rebot_cli_resource.txt
+
+*** Test Cases ***
+
+Default outputs
+ ${EMPTY} log.html report.html
+
+Output Only
+ --output myoutput.xml --log none --report none myoutput.xml
+
+Report Only
+ --output none --report myreport.html --log NONE myreport.html
+
+Log Only
+ --output None --report NONE --log mylog.html -S none mylog.html
+
+Summary Only
+ -o none --summary mysummary.html -l none -r NONE mysummary.html
+
+All Outputs
+ -o myoutput.xml -r myreport.html -l mylog.html -S mysummary.html
+ ... mylog.html myoutput.xml myreport.html mysummary.html
+
+Outputs Without Extensions
+ --output xoutput --report xreport --log xlog --summary xsummary
+ ... xlog.html xoutput.xml xreport.html xsummary.html
+
+Outputs Into Different Directories
+ [Template]
+ Set Runners
+ Run ${REBOT} --outputdir ::invalid:: -o ${MYOUTDIR}${/}o${/}o.xml -r
${MYOUTDIR}${/}r${/}r.html -l ${MYOUTDIR}${/}l${/}l.html --summary
${MYOUTDIR}${/}s.htm ${MYINPUT}
+ Directory Should Contain ${MYOUTDIR}${/}o o.xml
+ Directory Should Contain ${MYOUTDIR}${/}r r.html
+ Directory Should Contain ${MYOUTDIR}${/}l l.html
+ Directory Should Contain ${MYOUTDIR} l o r s.htm
+
+
+*** Keywords ***
+Correct outputs should be created
+ [Arguments] ${arguments} @{expected}
+ ${outputs} = Run rebot and return outputs ${arguments}
+ Lists Should Be Equal ${outputs} ${expected}
=======================================
--- /dev/null
+++ /trunk/atest/robot/cli/rebot/rebot_cli_resource.txt Mon Aug 23 09:49:49
2010
@@ -0,0 +1,36 @@
+*** Settings ***
+Resource ../runner/cli_resource.txt
+
+*** Variables ***
+${TEST FILE} misc${/}normal.html
+${PASSFAIL FILE} misc${/}pass_and_fail.html
+${MYOUTDIR} ${TEMPDIR}${/}robot-test-145435
+${MYINPUT} ${TEMPDIR}${/}robot-test-145435.xml
+${M_211_211} 2 critical tests, 1 passed, 1 failed\n 2 tests total, 1
passed, 1 failed
+${M_110_211} 1 critical test, 1 passed, 0 failed\n 2 tests total, 1
passed, 1 failed
+${M_101_211} 1 critical test, 0 passed, 1 failed\n 2 tests total, 1
passed, 1 failed
+${M_000_211} 0 critical tests, 0 passed, 0 failed\n 2 tests total, 1
passed, 1 failed
+${USAGE_TIP} \n\nTry --help for usage information.
+
+
+*** Keywords ***
+
+Run tests to create input file for Rebot
+ Run Tests Without Processing Output --loglevel TRACE ${TESTFILE}
+ Move File ${OUTFILE} ${MYINPUT}
+ Create Directory ${MYOUTDIR}
+
+Remove temporary files
+ Remove Directory ${MYOUTDIR} recursively
+ Remove File ${MYINPUT}
+
+Empty output directory
+ Empty Directory ${MYOUTDIR}
+
+Run rebot and return outputs
+ [Arguments] ${arguments}
+ Empty output directory
+ Set Runners
+ Run ${REBOT} --outputdir ${MYOUTDIR} ${arguments} ${MYINPUT}
+ @{outputs} = List Directory ${MYOUTDIR}
+ [Return] @{outputs}
=======================================
--- /dev/null
+++ /trunk/atest/robot/cli/rebot/suite_name_doc_and_metadata.txt Mon Aug 23
09:49:49 2010
@@ -0,0 +1,26 @@
+*** Settings ***
+Default Tags regression pybot jybot
+Resource rebot_cli_resource.txt
+
+
+*** Test Cases ***
+
+Default Name, Doc & Metadata
+ [Documentation] Using default values (read from xml) for name, doc
and metadata. Tests are run together to have less Rebot runs with same
input i.e. to have faster execution.
+ Run Rebot ${EMPTY} ${MYINPUT}
+ Check Names ${SUITE} Normal
+ Check Names ${SUITE.tests[0]} First One Normal.
+ Check Names ${SUITE.tests[1]} Second One Normal.
+ Should Be Equal ${SUITE.doc} Normal test cases
+ Should Be Equal ${SUITE.metadata['Something']} My Value
+
+Overriding Name, Doc & Metadata And Escaping
+ [Documentation] Overriding name, doc and metadata. Also testing
escaping values. Tests are run together to have less Rebot runs with same
input i.e. to have faster execution.
+ Run Rebot -N this_is_overridden_next --name my_COOL_NameEXEX --doc
Even_cooooler_docEXQU --metadata something:New --metadata
two_parts:three_parts_here -M esc:STQUDOAMHAEXEX --escape star:ST -E
quest:QU -E dollar:DO -E amp:AM -E hash:HA -E exclam:EX ${MYINPUT}
+ Check Names ${SUITE} my COOL Name!!
+ Check Names ${SUITE.tests[0]} First One my COOL Name!!.
+ Check Names ${SUITE.tests[1]} Second One my COOL Name!!.
+ Should Be Equal ${SUITE.doc} Even cooooler doc!?
+ Should Be Equal ${SUITE.metadata['Something']} New
+ Should Be Equal ${SUITE.metadata['two parts']} three parts here
+ Should Be Equal ${SUITE.metadata['esc']} *?$&#!!
=======================================
--- /dev/null
+++ /trunk/atest/robot/cli/rebot/timestamp_outputs.txt Mon Aug 23 09:49:49
2010
@@ -0,0 +1,20 @@
+*** Settings ***
+Test Setup Empty output directory
+Force Tags pybot jybot regression
+Resource rebot_cli_resource.txt
+
+*** Test Cases ***
+
+Timestamped Outputs
+ @{files} = Run rebot and return outputs --TimeStampOutputs
+ Length Should Be ${files} 2
+ :FOR ${file} IN @{files}
+ \ Should Match Regexp ${file} (log|report)-20\\d{6}-\\d{6}\\.html
+
+Timestamped Outputs With Custom Names
+ @{files} = Run rebot and return outputs --timest -l l -r r.html -o o
-S s
+ Length Should Be ${files} 4
+ :FOR ${file} IN @{files}
+ \ Should Match Regexp ${file} (l|o|r|s)-20\\d{6}-\\d{6}\\.(html|xml)
+
+
=======================================
--- /trunk/atest/robot/cli/rebot/commandline.txt Mon Aug 23 06:02:33 2010
+++ /dev/null
@@ -1,249 +0,0 @@
-*** Settings ***
-Documentation Testing Rebot's command line functionality. Functionality
tested elsewere:\n - filtering by tags/names\n - combining outputs\n -
creating correct html (incl. --xxxtitle options)
-Test Setup Empty Directory ${MYOUTDIR}
-Force Tags regression pybot jybot
-Resource atest_resource.txt
-
-*** Variables ***
-${TESTFILE} misc${/}normal.html
-${PASS_FAIL_FILE} misc${/}pass_and_fail.html
-${MYOUTDIR} ${TEMPDIR}${/}robot-test-145435
-${MYINPUT} ${TEMPDIR}${/}robot-test-145435.xml
-${M_211_211} 2 critical tests, 1 passed, 1 failed\n 2 tests total, 1
passed, 1 failed
-${M_110_211} 1 critical test, 1 passed, 0 failed\n 2 tests total, 1
passed, 1 failed
-${M_101_211} 1 critical test, 0 passed, 1 failed\n 2 tests total, 1
passed, 1 failed
-${M_000_211} 0 critical tests, 0 passed, 0 failed\n 2 tests total, 1
passed, 1 failed
-${USAGE_TIP} \n\nTry --help for usage information.
-
-*** Test Cases ***
-Output Only
- Run Rebot Without Processing Output --outputdir ${MYOUTDIR} --output
myoutput.xml --log none --report none ${MYINPUT}
- Directory Should Contain ${MYOUTDIR} myoutput.xml
-
-Report Only
- Run Rebot Without Processing Output --outputdir ${MYOUTDIR} --output
none --report myreport.html --log NONE --summary none ${MYINPUT}
- Directory Should Contain ${MYOUTDIR} myreport.html
-
-Log Only
- Run Rebot Without Processing Output --outputdir ${MYOUTDIR} --output
None --report NONE --log mylog.html -S none ${MYINPUT}
- Directory Should Contain ${MYOUTDIR} mylog.html
-
-Summary Only
- Run Rebot Without Processing Output --outputdir ${MYOUTDIR} -o none
--summary mysummary.html -l none -r NONE ${MYINPUT}
- Directory Should Contain ${MYOUTDIR} mysummary.html
-
-All Outputs
- Run Rebot Without Processing Output --outputdir ${MYOUTDIR} --output
myoutput.xml --report myreport.html --log mylog.html -S mysummary.html
${MYINPUT}
- Directory Should Contain ${MYOUTDIR} mylog.html myoutput.xml
myreport.html mysummary.html
-
-All Outputs With Default Names
- Verify REBOT Set
- Run ${REBOT} --outputdir ${MYOUTDIR} ${MYINPUT}
- Directory Should Contain ${MYOUTDIR} log.html report.html
-
-All Outputs Without Extensions
- Run Rebot Without Processing Output --outputdir ${MYOUTDIR} -o
myoutput -r myreport -l mylog --summary mysummary ${MYINPUT}
- Directory Should Contain ${MYOUTDIR} mylog.html myoutput.xml
myreport.html mysummary.html
-
-Outputs Into Different Dirs
- Run Rebot Without Processing Output --outputdir ::invalid:: -o
${MYOUTDIR}${/}o${/}o.xml -r ${MYOUTDIR}${/}r${/}r.html -l
${MYOUTDIR}${/}l${/}l.html --summary ${MYOUTDIR}${/}s.htm ${MYINPUT}
- Directory Should Contain ${MYOUTDIR}${/}o o.xml
- Directory Should Contain ${MYOUTDIR}${/}r r.html
- Directory Should Contain ${MYOUTDIR}${/}l l.html
- Directory Should Contain ${MYOUTDIR} l o r s.htm
-
-Timestamped Outputs
- Verify REBOT Set
- Run ${REBOT} --outputdir ${MYOUTDIR} --TimeStampOutputs ${MYINPUT}
- @{files} = List Directory ${MYOUTDIR}
- Should Be True len(@{files}) == 2
- :FOR ${file} IN @{files}
- \ Fail Unless Regexp Matches ${file} (log|
report)-20\\d{6}-\\d{6}\\.html
-
-Timestamped Outputs With Names
- Run Rebot Without Processing Output --outputdir ${MYOUTDIR}
--TimeStampOutputs -l l -r r.html -o o -S s ${MYINPUT}
- @{files} = List Directory ${MYOUTDIR}
- Should Be True len(@{files}) == 4
- :FOR ${file} IN @{files}
- \ Fail Unless Regexp Matches ${file} (l|o|r|
s)-20\\d{6}-\\d{6}\\.(html|xml)
-
-Default Name, Doc & Metadata
- [Documentation] Using default values (read from xml) for name, doc
and metadata. Tests are run together to have less Rebot runs with same
input i.e. to have faster execution.
- Run Rebot ${EMPTY} ${MYINPUT}
- Check Names ${SUITE} Normal
- Check Names ${SUITE.tests[0]} First One Normal.
- Check Names ${SUITE.tests[1]} Second One Normal.
- Should Be Equal ${SUITE.doc} Normal test cases
- Should Be Equal ${SUITE.metadata['Something']} My Value
-
-Overriding Name, Doc & Metadata And Escaping
- [Documentation] Overriding name, doc and metadata. Also testing
escaping values. Tests are run together to have less Rebot runs with same
input i.e. to have faster execution.
- Run Rebot -N this_is_overridden_next --name my_COOL_NameEXEX --doc
Even_cooooler_docEXQU --metadata something:New --metadata
two_parts:three_parts_here -M esc:STQUDOAMHAEXEX --escape star:ST -E
quest:QU -E dollar:DO -E amp:AM -E hash:HA -E exclam:EX ${MYINPUT}
- Check Names ${SUITE} my COOL Name!!
- Check Names ${SUITE.tests[0]} First One my COOL Name!!.
- Check Names ${SUITE.tests[1]} Second One my COOL Name!!.
- Should Be Equal ${SUITE.doc} Even cooooler doc!?
- Should Be Equal ${SUITE.metadata['Something']} New
- Should Be Equal ${SUITE.metadata['two parts']} three parts here
- Should Be Equal ${SUITE.metadata['esc']} *?$&#!!
-
-Invalid Options
- Run Rebot Without Processing Output --invalid option ${MYINPUT}
- Check Stderr Contains option --invalid not recognized\n \n Try --help
for usage information.
- Run Rebot Without Processing Output --name valid -X ${MYINPUT}
- Check Stderr Contains option -X not recognized\n \n Try --help for
usage information.
-
-It Should Be Possible To Use Wildcards In Datasources
- Set Test Variable $OUTPUTNAME mysuite
- Copy File ${MYINPUT} ${OUTDIR}${/}runningwild-1.xml
- Copy File ${MYINPUT} ${OUTDIR}${/}runningwild-2.xml
- Run Rebot ${EMPTY} ${OUTDIR}${/}*wild-?.xml
- Should Be True ${SUITE.suites} == ['Normal'] * 2
-
-No Input
- Verify REBOT Set
- ${output} = Run ${REBOT} 2>&1
- Should End With ${output} Expected at least 1 argument, got
0.${USAGE_TIP}
-
-Non-Existing Input
- Run Rebot Without Processing Output ${EMPTY} non-existing.xml
- Check Stderr Matches Regexp .*Output
file '.*[/\\\\]non-existing\\.xml' does not exist.\n\n Try --help for usage
information.
-
-Non-XML Input
- Create File ${MYOUTDIR}${/}invalid.txt Hello, world
- Run Rebot Without Processing Output ${EMPTY}
${MYOUTDIR}${/}invalid.txt
- Check Stderr Matches Regexp (\\[Fatal Error\\] .*: Content is not
allowed in prolog.\\n)?\\[ ERROR \\] Opening XML
file '.*[/\\\\]invalid.txt' failed: .*
- Check Syslog Matches Regexp .*| INFO | Traceback (most recent call
last):\\n File ".*readers.py", line .*, in process_output.*
-
-Non-Compatible Input
- [Documentation] Test handlig xml files not compatible with Robot
- Create File ${MYOUTDIR}${/}invalid.xml <not><our>type</our></not>
- Run Rebot Without Processing Output ${EMPTY}
${MYOUTDIR}${/}invalid.xml
- Check Stderr Matches Regexp \\[ ERROR \\] File '.*[/\\\\]invalid.xml'
is not Robot Framework output file.${USAGE_TIP}
-
-Invalid Output Dirs
- [Documentation] Test error handling when some of the output dirs
(where to write output, report, etc.) is invalid (i.e. can't be created).
To make sure creating dirs fails their names are non-standard (that's not
enough in Linux) parent is made read only.
- Create Directory ${MYOUTDIR}${/}x
- Set Read Only ${MYOUTDIR}${/}x
- Run Rebot Without Processing Output --outputdir
${MYOUTDIR}${/}x${/}:i --output default ${MYINPUT}
- Check Stderr Matches Regexp \\[ ERROR \\] Can't create output file's
parent directory '.*[/\\\\]x[/\\\\]:i\\\\?': (OS|IO|
Windows)Error: .*${USAGE_TIP}
- Run Rebot Without Processing Output --outputdir
${MYOUTDIR}${/}x${/}hello:world --output none --report default ${MYINPUT}
- Check Stderr Matches Regexp \\[ ERROR \\] Can't create report file's
parent directory '.*[/\\\\]x[/\\\\]hello:world': (OS|IO|
Windows)Error: .*${USAGE_TIP}
- [Teardown] Set Read Write ${MYOUTDIR}${/}x
-
-Invalid Output Files
- [Documentation] Test error handling when some of the output files
(output, report, etc.) is invalid (i.e. can't be opened)
- Create Directory ${MYOUTDIR}${/}directory.ext
- Run Rebot Without Processing Output --outputdir ${MYOUTDIR} --output
directory.ext ${MYINPUT}
- Check Stderr Matches Regexp \\[ ERROR \\] Opening output
file '.*[/\\\\]directory.ext' for writing failed: (IOError|
FileNotFoundException): .*${USAGE_TIP}
- Run Rebot Without Processing Output --outputdir ${MYOUTDIR} --summary
directory.ext --report r.html ${MYINPUT}
- Check Stderr Matches Regexp \\[ ERROR \\] Opening summary
file '.*[/\\\\]directory.ext' for writing failed: (IOError|
FileNotFoundException): .*
-
-Help
- Verify REBOT Set
- ${rc} ${help} = Run And Return Rc And Output ${REBOT} --help 2>&1
- Should Be Equal ${rc} ${251}
- Log ${help.replace(' ','_').replace('\\t','_'*8)}
- Should Start With ${help} Rebot -- Robot Framework Report and Log
Generator\n \n Version: \
- Should End With ${help} \n\n# Running 'robot/rebot.py' directly and
creating combined outputs.\n $ python /path/robot/rebot.py -N Project_X -l
x.html -r x.html outputs/*.xml\n
- Should Not Contain ${help} ERROR
- @{lines} = Evaluate [ '%d\\t%s' % (len(line), line) for line in
${help.splitlines()} ]
- Log Many @{lines}
- @{long} = Evaluate [ line for line in ${help.splitlines()} if
len(line) - line.count('\\\\') >= 80 ]
- Log Many @{long}
- Should Be True len(@{long}) == 0 Too long (>= 80) help line(s)
- ${help2} = Run ${REBOT} -h 2>&1
- Should Be Equal ${help} ${help2}
-
-Version
- Verify REBOT Set
- ${rc} ${output} = Run And Return Rc And Output ${REBOT} --version
2>&1
- Should Be Equal ${rc} ${251}
- Log ${output}
- Should Match Regexp ${output} ^Rebot (2\\.\\d+(\\.\\d+)?( (alpha|
beta|rc)\\d*)?|trunk 2\\d{7}) \\([PJ]ython 2\\.[\\d.]+ on .+\\)$
- Should Be True len("${output}") < 80 Too long version line
-
-Argument File
- Verify REBOT Set
- Create File ${MYOUTDIR}${/}a.txt --name From_Arg_File\n -c c1\n #
comment line\n --log none\n -r none\n --output ${MYOUTDIR}${/}output.xml\n
${MYINPUT}
- ${output} = Run ${REBOT} --critical c2 --argumentfile
${MYOUTDIR}${/}a.txt 2>&1
- Should Not Contain ${output} ERROR
- Process Output ${MYOUTDIR}${/}output.xml
- Should Be Equal ${SUITE.name} From Arg File
- Should Be True ${SUITE.critical.tags} == []
-
-Setting Syslog File
- Set Environment Variable ROBOT_SYSLOG_FILE ${MYOUTDIR}${/}syslog.txt
- Rebot Something
- File Should Not Be Empty ${MYOUTDIR}${/}syslog.txt
- Remove File ${MYOUTDIR}${/}syslog.txt
- Delete Environment Variable ROBOT_SYSLOG_FILE
- Rebot Something
- File Should Not Exist ${MYOUTDIR}${/}syslog.txt
- Set Environment Variable ROBOT_SYSLOG_FILE none
- Rebot Something
- File Should Not Exist ${MYOUTDIR}${/}syslog.txt
-
-Setting Syslog Level
- Set Environment Variable ROBOT_SYSLOG_FILE ${MYOUTDIR}${/}syslog.txt
- Set Environment Variable ROBOT_SYSLOG_LEVEL INFO
- Rebot Something
- ${size1} = Get File Size ${MYOUTDIR}${/}syslog.txt
- Set Environment Variable ROBOT_SYSLOG_LEVEL DEBUG
- Rebot Something
- ${size2} = Get File Size ${MYOUTDIR}${/}syslog.txt
- Should Be True 0 < ${size1} <= ${size2}
- Set Environment Variable ROBOT_SYSLOG_LEVEL warn
- Rebot Something
- File Should Be Empty ${MYOUTDIR}${/}syslog.txt
- [Teardown] Set Environment Variable ROBOT_SYSLOG_LEVEL INFO
-
-Correct RC When Invalid Data
- ${rc} = Run And Return Rc ${REBOT} 2>&1
- Should Be Equal ${rc} ${252}
-
-Invalid Argument Values
- Run Rebot --splitoutputs not_int --suitestatlevel not_int
--tagstatlink less_than_3x_: ${MYINPUT}
- Verify Correct Errors in Stderr Option '--suitestatlevel' expected
integer value but got 'not_int'. Default value used instead.\n
- Verify Correct Errors in Stderr Option '--splitoutputs' expected
integer value but got 'not_int'. Default value used instead.\n
- Verify Correct Errors in Stderr Invalid format for
option '--tagstatlink'. Expected 'tag:link:title' but
got 'less_than_3x_:'.\n
- Should Be Equal ${SUITE.status} PASS
-
-*** Keywords ***
-My Setup
- Run Tests Without Processing Output ${EMPTY} ${TESTFILE}
- Move File ${OUTFILE} ${MYINPUT}
- Create Directory ${MYOUTDIR}
-
-Remove Temps
- Remove Directory ${MYOUTDIR} recursively
- Remove File ${MYINPUT}
-
-Directory Should Contain
- [Arguments] ${dir_path} @{exp_files}
- ${act_files} = List Directory ${dir_path}
- Should Be Equal ${act_files} ${exp_files}
-
-Test Critical
- [Arguments] ${opts} ${input} ${status} ${msg} ${crit_tags}
${crit1} ${crit2}
- Set Suite Variable $SUITE ${None}
- Run Rebot ${opts} ${input}
- Should Be Equal ${SUITE.status} ${status}
- Should Be Equal ${SUITE.get_full_message()} ${msg}
- Should Be True ${SUITE.critical_tags} == ${crit_tags}
- Should Be Equal ${SUITE.tests[0].critical} ${crit1}
- Should Be Equal ${SUITE.tests[1].critical} ${crit2}
-
-Verify REBOT Set
- Should Not Be Equal ${REBOT} \ This test can be run only after
\${REBOT} is set No Values
-
-Rebot Something
- Verify REBOT Set
- Run ${REBOT} --outputdir ${MYOUTDIR} ${MYINPUT}
-
-Verify Correct Errors In Stderr
- [Arguments] @{messages}
- ${error} = Set Variable If os.sep=='/' ERROR [ ERROR ]
- Check Stderr Contains ${error}
- Check Stderr Contains @{messages}
-
=======================================
--- /trunk/atest/robot/cli/rebot/rebot_resource.txt Mon Aug 23 06:02:33 2010
+++ /dev/null
@@ -1,29 +0,0 @@
-*** Settings ***
-Resource ../runner/cli_resource.txt
-
-*** Variables ***
-${TEST FILE} misc${/}normal.html
-${PASSFAIL FILE} misc${/}pass_and_fail.html
-${MYOUTDIR} ${TEMPDIR}${/}robot-test-145435
-${MYINPUT} ${TEMPDIR}${/}robot-test-145435.xml
-${M_211_211} 2 critical tests, 1 passed, 1 failed\n 2 tests total, 1
passed, 1 failed
-${M_110_211} 1 critical test, 1 passed, 0 failed\n 2 tests total, 1
passed, 1 failed
-${M_101_211} 1 critical test, 0 passed, 1 failed\n 2 tests total, 1
passed, 1 failed
-${M_000_211} 0 critical tests, 0 passed, 0 failed\n 2 tests total, 1
passed, 1 failed
-${USAGE_TIP} \n\nTry --help for usage information.
-
-
-*** Keywords ***
-
-Run tests to create input file for Rebot
- Run Tests Without Processing Output --loglevel TRACE ${TESTFILE}
- Move File ${OUTFILE} ${MYINPUT}
- Create Directory ${MYOUTDIR}
-
-Remove temporary files
- Remove Directory ${MYOUTDIR} recursively
- Remove File ${MYINPUT}
-
-Rebot And Process Output
- [Arguments] ${arguments}=${EMPTY} ${input}=${MYINPUT}
- Run Rebot --outputdir ${MYOUTDIR} ${arguments} ${input}
=======================================
--- /trunk/atest/robot/cli/rebot/__init__.txt Mon Aug 23 06:02:33 2010
+++ /trunk/atest/robot/cli/rebot/__init__.txt Mon Aug 23 09:49:49 2010
@@ -1,4 +1,4 @@
***Settings***
Suite Setup Run tests to create input file for Rebot
Suite Teardown Remove temporary files
-Resource rebot_resource.txt
+Resource rebot_cli_resource.txt
=======================================
--- /trunk/atest/robot/cli/rebot/log_level.txt Mon Aug 23 06:07:33 2010
+++ /trunk/atest/robot/cli/rebot/log_level.txt Mon Aug 23 09:49:49 2010
@@ -1,13 +1,12 @@
*** Settings ***
Force Tags regression pybot jybot
-Resource rebot_resource.txt
+Resource rebot_cli_resource.txt
*** Test Cases ***
By default all messages are included
- Rebot and process output
- ${tc} = Set Variable ${SUITE.tests[0]}
+ ${tc} = Rebot
Check Log Message ${tc.kws[0].msgs[0]} Arguments: [ u'Test 1' ]
TRACE
Check Log Message ${tc.kws[0].msgs[1]} Test 1 INFO
Check Log Message ${tc.kws[0].msgs[2]} Return: None TRACE
@@ -16,17 +15,21 @@
Check Log Message ${tc.kws[1].msgs[2]} Return: None TRACE
Levels below given level are ignored
- Rebot and process output --loglevel debug
- ${tc} = Set Variable ${SUITE.tests[0]}
+ ${tc} = Rebot --loglevel debug
Check Log Message ${tc.kws[0].msgs[0]} Test 1 INFO
Check Log Message ${tc.kws[1].msgs[0]} Logging with debug level
DEBUG
- Rebot and process output -L INFO
- ${tc} = Set Variable ${SUITE.tests[0]}
+ ${tc} = Rebot -L INFO
Check Log Message ${tc.kws[0].msgs[0]} Test 1 INFO
Should Be Empty ${tc.kws[1].msgs}
All messages are ignored when NONE level is used
- Rebot and process output --loglevel NONE
- ${tc} = Set Variable ${SUITE.tests[0]}
+ ${tc} = Rebot --loglevel NONE
Should Be Empty ${tc.kws[0].msgs}
Should Be Empty ${tc.kws[1].msgs}
+
+
+*** Keywords ***
+Rebot
+ [Arguments] ${arguments}=${EMPTY}
+ Run Rebot ${arguments} ${MYINPUT}
+ [Return] ${SUITE.tests[0]}
=======================================
--- /trunk/atest/robot/rebot/combine.txt Tue May 25 07:00:21 2010
+++ /trunk/atest/robot/rebot/combine.txt Mon Aug 23 09:49:49 2010
@@ -129,6 +129,11 @@
Should Contain ${report content} <div class="stat_name"><a
href="#suite_New Name" title="New Name">New Name</a></div>
Should Contain ${report content} <div class="stat_name"><a
href="#suite_New Name.Pass And Fail" title="New Name.Pass And Fail"><span
class="parent_name">New Name . </span>Pass And Fail</a></div>
+Wildcards
+ Run Rebot ${EMPTY} ${TEMPDIR}${/}rebot-test-?.x*
+ Should Be True ${SUITE.suites} == ['Pass And Fail', 'Normal', 'New
Name']
+
+
*** Keywords ***
My Setup
Comment 1) Create first input for Rebot