Skip to content

Use time in suite if provided #49

@rohit-gohri

Description

@rohit-gohri

I have a junit xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="client" tests="72" failures="0" errors="0" time="2.176">
  <testsuite name="src/__tests__/1.test.ts" errors="0" failures="0" skipped="0" timestamp="2023-03-01T22:51:14" time="1.56" tests="7">
    <testcase classname="1 hook" name="should set a" time="0.029">
    </testcase>
    <testcase classname="1 hook" name="should set b" time="0.006">
    </testcase>
    <testcase classname="1 hook" name="should set c" time="0.005">
    </testcase>
    <testcase classname="1 hook" name="should set d" time="0.004">
    </testcase>
    <testcase classname="1 hook" name="should set e" time="0.007">
    </testcase>
    <testcase classname="1 hook" name="should set f" time="0.003">
    </testcase>
    <testcase classname="1 hook" name="should set g" time="0.01">
    </testcase>
  </testsuite>
  <testsuite name="src/__tests__/2.test.tsx" errors="0" failures="0" skipped="0" timestamp="2023-03-01T22:51:14" time="1.623" tests="6">
    <testcase classname="2" name="should set a" time="0.051">
    </testcase>
    <testcase classname="2" name="should set b" time="0.005">
    </testcase>
    <testcase classname="2" name="should set c" time="0.009">
    </testcase>
    <testcase classname="2" name="should set d" time="0.014">
    </testcase>
    <testcase classname="2" name="should set e" time="0.015">
    </testcase>
    <testcase classname="2" name="should set f" time="0.004">
    </testcase>
  </testsuite>
</testsuites>

(this is from the output of https://www.npmjs.com/package/jest-junit)

Expected

I expect the suites' totals.duration to match the time mentioned in the testsuite itself rather than be the sum of times in testcases.

Actual

The totals.duration is the sum of the testcases. This leaves out the time spent by the testsuite in setup and teardown which is not part of any 1 individual test case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions