pytest-dev / pytest-dev/pytest

[junit] Add a file attribute to xunit2

Open
#7,537 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plugin: junitxml type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

Currently linked schema https://github.com/jenkinsci/xunit-plugin/blob/xunit-2.3.2/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd#L127 allows a file attribute in <testsuite> nodes. It's currently missing but would be very useful.

AFAICS junitxml plugin dumps everything under a single testsuite node. It was probably fine with xunit1 that allowed per-testcase file attribute to be set. Now that xunit2 is going to be a default, it needs a similar feature too.

But since this attribute is per-suite in xunit2, the plugin will have to separate <testcase>s into multiple <testsuite>s.

Why is this important to me personally? I usually set up test reporting in CIs that support it (AppVeyor and Circle CI, for example). And it's nice to see where the test is coming from.

I wanted to turn the test report into GitHub Actions annotations from XML using a simple action that requires almost zero effort to set up (https://github.com/shyim/junit-report-annotations-action/issues/3). But I hit a roadblock when I realized that for putting annotations on lines in files, it has to know what those files are.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked junit-10.xsd at line 127 and trace the junitxml plugin's xunit2 output. Done means supporting the testsuite file attribute while separating testcases into multiple testsuite nodes, with coverage for the resulting report structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.