All Downloads are FREE. Search and download functionalities are using the official Maven repository.

robotframework-2.7.7.atest.robot.output.xunit.txt Maven / Gradle / Ivy

The newest version!
*** Settings ***
Documentation   Tests for xunit-compatible xml-output.
Default Tags    regression  pybot  jybot
Resource        atest_resource.txt
Variables       unicode_vars.py
Suite Setup     Run Tests  -x xunit.xml -l log.html -L debug  ${TESTDATA}

*** Variables ***
${TESTDATA}  misc/unicode.txt
${INVALID}   %{TEMPDIR}${/}ïnvälïd-xünït.xml

*** Test Cases ***
XUnit File Is Created
    Stderr should be empty
    Check Stdout Contains  XUnit
    File Should Exist  ${OUTDIR}/xunit.xml
    File Should Exist  ${OUTDIR}/log.html

File Structure Is Correct
    ${root} =  Get XUnit Node  .
    Should Be Equal  ${root.tag}  testsuite
    ${tests} =  Get XUnit Nodes  testcase
    Length Should Be  ${tests}  8
    ${failures} =  Get XUnit Nodes  testcase/failure
    Length Should Be  ${failures}  4
    Log  ${failures[0].text}
    Should Start With  ${failures[0].text}  Traceback

Non-ASCII Content
    ${tests} =  Get XUnit Nodes  testcase
    Should Be Equal  ${tests[-1].attrib['name']}  Ünïcödë Tëst änd Këywörd Nämës
    ${failures} =  Get XUnit Nodes  testcase/failure
    Should Be Equal  ${failures[0].attrib['message']}  ${MESSAGES}

Multiline failure
    ${failures} =  Get XUnit Nodes  testcase/failure
    Should Be Equal  ${failures[-1].attrib['message']}  Just ASCII here\n\nAlso teardown failed:\n${MESSAGES}

No XUnit Option Given
    Run Tests  ${EMPTY}  ${TESTDATA}
    Check Stdout Does Not Contain  XUnit

Invalid XUnit File
    Create Directory  ${INVALID}
    Run Tests  --XUnitFile ${INVALID} -l log.html  ${TESTDATA}
    File Should Not Exist  ${INVALID}
    File Should Exist  ${OUTDIR}/log.html
    ${dir}  ${base} =  Split Path  ${INVALID}
    ${path} =  Regexp Escape  ${INVALID}
    Check Stderr Matches Regexp
    ...  \\[ ERROR \\] Writing xunit file '${path}' failed: .*

*** Keywords ***
Get XUnit Node
    [Arguments]  ${path}
    ${node} =  Get Element  ${OUTDIR}/xunit.xml  ${path}
    [Return]  ${node}

Get XUnit Nodes
    [Arguments]  ${path}
    ${nodes} =  Get Elements  ${OUTDIR}/xunit.xml  ${path}
    [Return]  ${nodes}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy