n98 / junit-xml
JUnit XML Document generation library
Installs: 7 336 085
Dependents: 8
Suggesters: 0
Security: 0
Stars: 15
Watchers: 3
Forks: 2
Open Issues: 0
Requires (Dev)
- phpunit/phpunit: ^9.5.0
This package is auto-updated.
Last update: 2024-10-25 17:50:07 UTC
README
JUnit XML Document Generator Library
Install component with composer.
composer require --dev n98/junit-xml
Example
require_once __DIR__ . '/../vendor/autoload.php'; $document = new \N98\JUnitXml\Document(); $suite = $this->document->addTestSuite(); $timeStamp = new \DateTime(); $suite->setName('My Test Suite'); $suite->setTimestamp($timeStamp); $suite->setTime(0.344244); $testCase = $suite->addTestCase(); $testCase->addError('My error 1', 'Exception'); $testCase->addError('My error 2', 'Exception'); $testCase->addError('My error 3', 'Exception'); $testCase->addError('My error 4', 'Exception'); $testCase->addFailure('My failure 1', 'Exception'); $testCase->addFailure('My failure 2', 'Exception'); $document->save('results.xml');