facile-it / paraunit

Run PHPUnit tests in parallel
https://engineering.facile.it/paraunit/
Apache License 2.0
134 stars 14 forks source link

Handle `--log-junit` option #207

Open Jean85 opened 1 year ago

Jean85 commented 1 year ago

The --log-junit would be pretty useful to report tests to various systems, including the GitLab CI Unit Test Report: https://docs.gitlab.com/ee/ci/testing/unit_test_reports.html

This option is not feasible as a pass-through one, because it would produce multiple files, and also because there's no way to produce different files with different names for each executed test class.

This feature would mirror the coverage one, with the hijacking of the native PHPUnit option, and the merging of the resulting files. The merge would have to be written as a feature, but would be pretty straightforward, see https://github.com/drazisil/junit-merge/blob/master/lib/index.js

Jean85 commented 1 year ago

It seems that JUnit logs can be uploaded with glob patterns to GitLab! :tada: https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsjunit

This would simplify a lot the feature, because I could accept a directory name as the value of the option, and generate the filename automatically, without having to merge the result.

GiovanniCardamone commented 1 year ago

following

keljtanoski commented 1 year ago

👋 Hi @Jean85 I added a MR with my implementation of this for the version 1.x. I needed this feature so I have made the rewrite of paraunit - not released yet though as I notified you via email. I am adding this MR as an example how I think it can be solved. I did not had a chance to go through the version 2.x but I will in my free time 👍 Kudos for paraunit 🎉

This option is not feasible as a pass-through one, because it would produce multiple files, and also because there's no way to produce different files with different names for each executed test class.

My MR does this exactly creates generated filenames based on the file provided as a parameter. 😄

Jean85 commented 1 year ago

Seemed interesting, thank you. I'm not sure I'll be implementing the merge of the XML files though, at least at first. That's because for my use case (GitLab) multiple files are fine too. For which use case do you need one single file?

keljtanoski commented 1 year ago

Seemed interesting, thank you. I'm not sure I'll be implementing the merge of the XML files though, at least at first. That's because for my use case (GitLab) multiple files are fine too. For which use case do you need one single file?

Not a specific use case, I just did not knew that Gitlab had the artifacts_reports option 😄 but anyway problem solved.