pabot icon indicating copy to clipboard operation
pabot copied to clipboard

Having tests creating xml files in ${OUTPUT DIR} makes pabot return 252

Open JockeJarre opened this issue 4 years ago • 1 comments

If you have tests in your testcases which create xml files in ${OUTPUT DIR} pabot return 252 as return-code independent on if the tests actually fail or not.

so a simple test case which make pabot fail would be:

*** Settings ***
Library    OperatingSystem

*** Test Cases ***
Store information to XML File
    Create File    ${OUTPUT DIR}${/}MESSAGES.xml    <MESSAGES>Text</MESSAGES>

The second test in this example is of no interest for this problem, but for reference:

*** Test Cases ***
Just log "Nothing"
    Log    Nothing

the example result:

Reading XML source '.\pabot_results\0\MESSAGES.xml' failed: Incompatible XML element 'MESSAGES'.
Skipping '.\pabot_results\0\MESSAGES.xml' from final result
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
===================================================
Output:  C:\temp\output.xml
Log:     C:\temp\log.html
Report:  C:\temp\report.html
Total testing: 12.20 seconds
Elapsed time:  8.0 seconds

C:\temp>echo %ERRORLEVEL%
252

If the xml files is created in a subfolder of ${OUTPUT DIR} it works as expected though.

*** Settings ***
Library    OperatingSystem

*** Test Cases ***
Store information to XML File
    Create Directory    ${OUTPUT DIR}${/}xmlout
    Create File    ${OUTPUT DIR}${/}xmlout${/}MESSAGES.xml    <MESSAGES>Text</MESSAGES>

JockeJarre avatar Sep 29 '20 14:09 JockeJarre

I guess the following change will be too simple...

def group_by_root(results, critical_tags, non_critical_tags, invalid_xml_callback):
    groups = {}
    for src in results:
        if not src.endswith('output.xml'):   #<- checking the filename will it work?
            continue

JockeJarre avatar Sep 29 '20 14:09 JockeJarre