This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,65 @@ | ||
# JunitXml | ||
[![Build Status branch master](https://travis-ci.org/llaumgui/JunitXml.svg?branch=master)](https://travis-ci.org/llaumgui/JunitXml) [![Code Climate](https://codeclimate.com/github/llaumgui/JunitXml/badges/gpa.svg)](https://codeclimate.com/github/llaumgui/JunitXml) [![Test Coverage](https://codeclimate.com/github/llaumgui/JunitXml/badges/coverage.svg)](https://codeclimate.com/github/llaumgui/JunitXml/coverage) | ||
[![Build Status branch master](https://travis-ci.org/llaumgui/JunitXml.svg?branch=master)](https://travis-ci.org/llaumgui/JunitXml) [![Code Climate](https://codeclimate.com/github/llaumgui/JunitXml/badges/gpa.svg)](https://codeclimate.com/github/llaumgui/JunitXml) [![Test Coverage](https://codeclimate.com/github/llaumgui/JunitXml/badges/coverage.svg)](https://codeclimate.com/github/llaumgui/JunitXml/coverage) [![PHP version](https://badge.fury.io/ph/llaumgui%2Fjunit-xml.svg)](https://packagist.org/packages/llaumgui/junit-xml) | ||
|
||
PHP library for generate XML document in JUnit format. | ||
|
||
|
||
|
||
## Installation | ||
~~~php | ||
composer require 'llaumgui/junit-xml:dev-master' | ||
~~~ | ||
|
||
|
||
## API | ||
See [documentation](https://llaumgui.github.io/JunitXml/). | ||
## API documentation | ||
See [JunitXml API Documentation](https://llaumgui.github.io/JunitXml/). | ||
|
||
|
||
## Usage | ||
* Create a new TestSuites: | ||
* Create a new *TestSuites*: | ||
~~~php | ||
$testSuites = new JunitXmlTestSuites('My testsuites'); | ||
~~~ | ||
* Add a *TestSuite* to the *TestSuites*: | ||
~~~php | ||
$testSuite1 = $testSuites->addTestSuite('My testsuite #1'); | ||
~~~ | ||
* Add a *TestCase* to the *TestSuite*: | ||
~~~php | ||
$test1 = $testSuite1->addTest('Check if blabla is good'); | ||
~~~ | ||
* Increment the *assertion* number of the *TestCase*: | ||
~~~php | ||
$testSuites = new JunitXmlTestSuites(); | ||
$test1->incAssertions(); | ||
~~~ | ||
* Mark test as *skipped*: | ||
~~~php | ||
$test1->addSkipped('Skipped because blabla.'); | ||
~~~ | ||
* Mark test in error: | ||
~~~php | ||
$test1->addError('Error message', 'error_type'); | ||
~~~ | ||
* Mark test as fail: | ||
~~~php | ||
$test1->addFailure('Fail message', 'fail_type'); | ||
~~~ | ||
* Finish and close test: | ||
~~~php | ||
$test1->finish(); | ||
~~~ | ||
* Finish and close TestSuite: | ||
~~~php | ||
$testSuite->finish(); | ||
~~~ | ||
* Finish, close and get XML of the TestSuites: | ||
~~~php | ||
$testSuites->getXml(); | ||
~~~ | ||
|
||
* For full documentation: see [JunitXml API Documentation](https://llaumgui.github.io/JunitXml/) | ||
* For full exemple: see [tests/JunitXmlTestCaseTest.php](https://github.com/llaumgui/JunitXml/blob/master/tests/JunitXmlTestCaseTest.php) | ||
|
||
|
||
## License | ||
Released under the [MIT license](http://www.opensource.org/licenses/MIT). | ||
|