n98/junit-xml

JUnit XML Document generation library

1.1.0 2020-12-25 09:08 UTC

This package is auto-updated.

Last update: 2024-10-25 17:50:07 UTC


README

JUnit XML Document Generator Library

image

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');