Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

0.1.16 broke junit xml reporting with YUI when testing multiple files #22

Open
Hamusutaa opened this issue Oct 22, 2013 · 2 comments
Open

Comments

@Hamusutaa
Copy link

Around 3 months ago, our automated build started having issues collecting test results. I've finally narrowed down the cause: A change to lib/process.js in 0.1.16 broke the way that results are passed to yuitest, which caused it to get confused and treat every testsuite after the first as a new root.

Before: (With coverage and superfluous tests stripped out)

[
    {
        "name": "mb-cta-link Test Suite",
        "passed": 5,
        "failed": 0,
        "errors": 0,
        "ignored": 0,
        "total": 5,
        "duration": 70,
        "type": "report",
        "MB Ads FE Call To Action Link": {
            "name": "MB Ads FE Call To Action Link",
            "passed": 5,
            "failed": 0,
            "errors": 0,
            "ignored": 0,
            "total": 5,
            "duration": 66,
            "type": "testcase",
            "test initializer": {
                "result": "pass",
                "message": "Test passed",
                "type": "test",
                "name": "test initializer",
                "duration": 4
            }
        },
        "timestamp": "Mon 21 Oct 2013 05:23:39 PM PDT",
        "coverage": {},
        "coverageType": "istanbul",
        "consoleInfo": []
    },
    {
        "name": "mb-base-widget Test Suite",
        "passed": 11,
        "failed": 0,
        "errors": 0,
        "ignored": 0,
        "total": 11,
        "duration": 148,
        "type": "report",
        "MB Ads FE Base Widget": {
            "name": "MB Ads FE Base Widget",
            "passed": 11,
            "failed": 0,
            "errors": 0,
            "ignored": 0,
            "total": 11,
            "duration": 145,
            "type": "testcase",
            "testInitializer": {
                "result": "pass",
                "message": "Test passed",
                "type": "test",
                "name": "testInitializer",
                "duration": 2
            }
        },
        "timestamp": "Mon 21 Oct 2013 05:23:40 PM PDT",
        "coverage": {},
        "coverageType": "istanbul",
        "consoleInfo": []
    }
]

After:

{
    "name": "mb-cta-link Test Suite",
    "passed": 10,
    "failed": 0,
    "errors": 0,
    "ignored": 0,
    "total": 10,
    "duration": 132,
    "type": "report",
    "MB Ads FE Call To Action Link": {
        "name": "MB Ads FE Call To Action Link",
        "passed": 5,
        "failed": 0,
        "errors": 0,
        "ignored": 0,
        "total": 5,
        "duration": 64,
        "type": "testcase",
        "test initializer": {
            "result": "pass",
            "message": "Test passed",
            "type": "test",
            "name": "test initializer",
            "duration": 4
        }
    },
    "timestamp": "Mon 21 Oct 2013 05:20:59 PM PDT",
    "coverage": {},
    "coverageType": "istanbul",
    "consoleInfo": [],
    "mb-base-widget Test Suite": {
        "name": "mb-base-widget Test Suite",
        "passed": 22,
        "failed": 0,
        "errors": 0,
        "ignored": 0,
        "total": 22,
        "duration": 292,
        "type": "report",
        "MB Ads FE Base Widget": {
            "name": "MB Ads FE Base Widget",
            "passed": 11,
            "failed": 0,
            "errors": 0,
            "ignored": 0,
            "total": 11,
            "duration": 144,
            "type": "testcase",
            "testInitializer": {
                "result": "pass",
                "message": "Test passed",
                "type": "test",
                "name": "testInitializer",
                "duration": 2
            }
        },
        "timestamp": "Mon 21 Oct 2013 05:20:59 PM PDT",
        "coverage": {},
        "coverageType": "istanbul",
        "consoleInfo": []
    }}

And what the result.xml looks like when it's broken:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
    <testsuite name="MB Ads FE Call To Action Link" tests="1" failures="0" time="0.066">
        <testcase name="test initializer" time="0.004"></testcase>
    </testsuite>
    <testsuites>
        <testsuite name="MB Ads FE Base Widget" tests="1" failures="0" time="0.145">
            <testcase name="testInitializer" time="0.002"></testcase>
        </testsuite>
    </testsuites>
</testsuites>

In this case, our build would report only 1 test success, not 2, as the latter test suite is wrapped in a <testsuites> tag.

@paulRbr
Copy link

paulRbr commented Mar 18, 2014

👍 There's a bug here indeed,

Same issue for our team.

@stjohnjohnson
Copy link

👍 same issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants