Skip to content

heiglandreas/JUnitDiff

Repository files navigation

Build Status Code Climate Test Coverage Coverage Status Scrutinizer Code Quality Codacy Badge SensioLabsInsight

Latest Stable Version Total Downloads License Dependency Status composer.lock

JUnitDiff

A small CLI to check which tests have changed between test runs.

This software is in an early alpha-stage. PRs and improvement-ideas are more than welcome.

Installation

JUnitDiff can be installed in one of the two following ways:

composer.

Run this in your projects root-folder to include JUnitDiff as development-dependency

$ composer global require --dev org_heigl/junitdiff

Phar

Download the latest release as PHAR-file from the release-page.

The releases are signed using the JUNitDiff GPG-Key with ID AE11B9CEBADB342A and Fingerprint A84C BFAC 7147 9C6C E37E FF47 AE11 B9CE BADB 342A.

You can verify the phar-file using these commands:

gpg --keyserver pgp.mit.edu --recv-key 0xAE11B9CEBADB342A
gpg --fingerprint AE11B9CEBADB342A
gpg --verify junitdiff.phar.asc junitdiff.phar

Feel free to rename the file junitdiff.phar to junitdiff for easier execution.

Usage

JUnitDiff compares two JUnit log files which can be generated with e.g. phpunit.

$ phpunit --log-junit logfile.xml

When you have two JUnit log files from two different test runs available you can check which tests have changed between those with junitdiff.

$ php junitdiff.diff compare </path/to/first/logfile> </path/to/last/logfile>

An example output might be:

[o] Test MyTest::testStoringIdWorks changed from success to error
[+] New Test MyTest::testStoringIdWorksBetter with data set #7
[-] Removed Test MyTest::testStoringIdWorksBest

Caveat

PHPUnit adds information about skipped or ignored tests into the JUnit-lof file starting with PHPUnit 6.0! So files created with a previous version do not provide information about skipped or ignored tests. (Thanks to Sebastian Bergmann for that info!) Until Issue 3 is resolved they will not be shown in the output! But as they are ignored or skipped and therefore not executed they are just like not existing tests at all, so it shouldn't be an issue.