Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the PHPUnit dialect of JUnit #422

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mbeccati
Copy link

@mbeccati mbeccati commented Apr 9, 2024

PHPUnit uses nested <testsuite> elements, and the actual test cases are ignored in the current version of the reporter.

This is my first attempt at TypeScript, so apologies for any silly mistake.

Most likely it would be best to implement it as a separate parser, add more features, such as better error reporting, file links, etc.

As a first prototype, it seems to be working good enough for my current needs, e.g. https://github.com/mbeccati/php-latest-builds/runs/23625536886

@darshanrampatel
Copy link

@mbeccati An interesting approach - when I needed to do this, I instead modified the PHPUnit test file to match the JUnit format:

# Change from
#
# <testsuites>
#   <testsuite name="" ...
#   ...
#   </testsuite>
# </testsuites>
#
# to
#
# <testsuites name=""
# ...
# </testsuites>

I think your approach is probably better though 🙂

One thing that I'm not sure "just works" in your version is the file annotations - I had to perform some regex to get this to work. See this: https://github.com/darshanrampatel/test-reporter/blob/e8fa95a4ce020faeb9a198f9b31bf4e6e200c2b9/src/parsers/phpunit-junit/phpunit-junit-parser.ts#L182-L196

(I apologise that it's not documented😅)

@mbeccati
Copy link
Author

@darshanrampatel nice! Feel free to borrow from this PR for your fork. That would indeed make for a better PR than this one. If you do, pls let me know. Id'be more than happy to give it a try

@jozefizso jozefizso self-assigned this Jun 25, 2024
@jozefizso jozefizso added the enhancement New feature or request label Jun 25, 2024
@jozefizso
Copy link
Collaborator

This should be a new parser specific for PHPUnit format.

@mbeccati
Copy link
Author

@jozefizso I agree. I just wasn't sure exacty where to start with a new parser, or at least that's what I recall. It's bee a while ;-)

Are you suggesting I edit the PR creating a new parser? If so I think I'd need some guidance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants