victorolinasc / junit-formatter

A JUnit XML report exporter for Elixir's ExUnit
https://hexdocs.pm/junit_formatter/
Apache License 2.0
110 stars 37 forks source link

Skipped test stats not showing in generated junit XML report when using ExUnit >= 1.7.0 #49

Closed mengdaming closed 5 months ago

mengdaming commented 10 months ago

When running tests with some tests marked as skipped (using @tag :skip), these skipped tests don't show up in the generated junit XML test report.

I'm getting a report that looks like the following:

 <testsuite errors="0" failures="1" name="xxx" tests="2" time="...">

While I would expect to see somthing like this (with 1 test case marked as skipped):

<testsuite errors="0" failures="1" skipped="1" name="xxx" tests="3" time="...">

I did a bit of investigation and from what I could see ExUnit changed in version 1.7.0 their state type to use :skipped atom instead of :skip when marking skipped tests. Cf. the 2 links below:

So I guess updating this line in junit-formatter could fix the problem. WDYT?

victorolinasc commented 10 months ago

We could add something like:

def handle_cast({:test_finished, %ExUnit.Test{state: {tag, _}} = test}, config) when tag in [:skip, :skipped] do

PRs are most welcome!