sweetchuck / junit-merger-cli
CLI tool to merge two or more JUnit XML files into one.
Installs: 1 804
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Open Issues: 1
Type:project
Requires
- php: >=7.4
- ext-json: *
- psr/log: ^1.1
- sweetchuck/junit-merger: 1.x-dev
- symfony/console: ^5.1 || ^6.0
- symfony/dependency-injection: ^5.3 || ^6.0
Requires (Dev)
- codeception/codeception: ^4.1
- codeception/module-asserts: ^1.3
- codeception/module-cli: ^1.1
- consolidation/robo: ^3.0
- mikey179/vfsstream: ^1.6
- nuvoleweb/robo-config: ^2.0
- squizlabs/php_codesniffer: ^3.6
- sweetchuck/git-hooks: 2.x-dev
- sweetchuck/robo-composer: 2.x-dev
- sweetchuck/robo-git: 2.x-dev
- sweetchuck/robo-phpcs: 2.x-dev
- sweetchuck/utils: 1.x-dev
- symfony/error-handler: ^5.3 || ^6.0
- symfony/finder: ^5.3 || ^6.0
- symfony/yaml: ^5.4 || ^6.0
This package is auto-updated.
Last update: 2024-11-06 21:17:06 UTC
README
As the name suggests this CLI tool helps to merge two or more JUnit XML files into one.
Under the hood it uses the JUnit merger library.
Usage
By default it reads the input file names from stdIn line by line, and puts the result XML content to the stdOutput.
So the basic usage:
find path/to/junit -type f -name '*.xml' | junit-merger merge:files
The input file names also can be provided as arguments. Like this:
junit-merger merge:files 1.xml 2.xml
The merged XML content can be put into a file by using standard shell redirections. Like this:
junit-merger merge:files 1.xml 2.xml > junit.xml
Or by using the --output-file
CLI option. Like this:
junit-merger merge:files --output-file='junit.xml' 1.xml 2.xml
Usage - handlers
Handlers are responsible for read and parse the input files and generate the merged XML content.
To which handler should be used can be controlled by the --handler
option. Like this:
junit-merger merge:files --handler='dom_read_write' 1.xml 2.xml
There are three available option
Usage - handler - dom_read_write
With this handler the input files are parsed with \DOMDocument and the output is also generated with it.
It is safe and reliable, but resource heavy.
On the other hand this handler recalculates all the <testsuite tests assertions errors warnings failures skipped time />
attributes.
This might come handy when multiple <testcase />
comes from different input files and they are belong to the same <testsuite />
.
Usage - handler - dom_read
With this handler the input files are parsed with \DOMDocument and the output is generated with string concatenation.
Usage - handler - substr
The input files have to be in the same format in the terms of the position of the opening <testsuites>
tag and the closing </testsuites>
tag.
These position parsed from the first input file and the same positions will be used for the remaining input files.
Usually the input files are come from the same source – for example PHPUnit – so their format is identical.