, (*1)
PHPUnit\TestListeners\TestDox
END OF LIFE
Please note: This project won't receive updates or fixes anymore and was marked as "abandoned" at packagist.org., (*2)
However, if you find this code useful in any way, feel free to fork, change and re-publish it. The MIT license applies., (*3)
Description
A PHPUnit test listener that creates a testdox markdown file with grouped dataset output, (*4)
Requirements
- PHP >= 7.1
- PHPUnit >= 7.0
Installation
composer require --dev hollodotme/phpunit-testdox-markdown
Usage
If you are using PSR-4 autoloading, add the following to your phpunit.xml
:, (*5)
<phpunit ...>
<listeners>
<listener class="hollodotme\PHPUnit\TestListeners\TestDox\Markdown">
<arguments>
<string name="environment">Development</string>
<string name="outputFile">build/logs/TestDox.md</string>
</arguments>
</listener>
</listeners>
</phpunit>
If you're not using PSR-4 autoloading, also add the class' file path to the <listener>
tag:, (*6)
<phpunit ...>
<listeners>
<listener class="hollodotme\PHPUnit\TestListeners\TestDox\Markdown"
file="/path/to/vendor/hollodotme/phpunit-testdox-markdown/src/Markdown.php">
<arguments>
<string name="environment">Development</string>
<string name="outputFile">build/logs/TestDox.md</string>
</arguments>
</listener>
</listeners>
</phpunit>
Available listener arguments
Name |
Type |
Required |
Meaning |
environment |
string |
YES |
Is printed on top of the testdox report to identifiy on which build stage the report has been created. |
outputFile |
string |
YES |
Relative path to the markdown testdox output file. Please note: the path must be relative to your current working directory, not to the location of the phpunit.xml . |
baseNamespace |
string |
NO |
A part of your test namespace to shorten the output headlines. Example: Your test namespace is YourVendor\YourProject\Tests\Unit and you set baseNamespace to YourVendor\YourProject\Tests all headlines will be prefixed with Unit\ only. |
testStatusMap |
array |
NO |
A key-value array of strings that let's you manipulate the icons for each test result status. See example below. |
Example with all available arguments
<phpunit ...>
<listeners>
<listener class="hollodotme\PHPUnit\TestListeners\TestDox\Markdown">
<arguments>
<string name="environment">Development</string>
<string name="outputFile">build/logs/TestDox.md</string>
<string name="baseNamespace">YourVendor\YourProject\Tests</string>
<array name="testStatusMap">
<element key="Passed">
<string>๐</string>
</element>
<element key="Error">
<string>๐</string>
</element>
<element key="Failure">
<string>๐</string>
</element>
<element key="Warning">
<string>๐งก</string>
</element>
<element key="Risky">
<string>๐</string>
</element>
<element key="Incomplete">
<string>๐</string>
</element>
<element key="Skipped">
<string>๐</string>
</element>
</array>
</arguments>
</listener>
</listeners>
</phpunit>
Example output
๐ Passed | ๐ Error | ๐ Failure | ๐งก Warning | ๐ Risky | ๐ Incomplete | ๐ Skipped
# Test suite: Unit-Test-Suite
* Environment: `Testing`
* Base namespace: `hollodotme\PHPUnit`
## UnitTest
- [x] Can Have Single Test (๐ 1)
- [ ] Can Have Test With Data Sets (๐ 3, ๐ 3, ๐ 3, ๐ 3, ๐งก 3, ๐ 3)
> 3: DataSet is risky.
> 4: DataSet is risky.
> 5: DataSet is risky.
> 6: DataSet was skipped.
> 7: DataSet was skipped.
> 8: DataSet was skipped.
> 9: DataSet is incomplete.
> 10: DataSet is incomplete.
> 11: DataSet is incomplete.
> 12: DataSet creates warning.
> 13: DataSet creates warning.
> 14: DataSet creates warning.
> 15: DataSet fails.
> 16: DataSet errors out.
> 17: DataSet errors out.
---
Report created at 2018-05-21 22:23:12 (UTC)
๐ Passed | ๐ Error | ๐ Failure | ๐งก Warning | ๐ Risky | ๐ Incomplete | ๐ Skipped, (*7)
Test suite: Unit-Test-Suite
- Environment:
Testing
- Base namespace:
hollodotme\PHPUnit
UnitTest
- [x] Can Have Single Test (๐ 1)
- [ ] Can Have Test With Data Sets (๐ 3, ๐ 3, ๐ 3, ๐ 3, ๐งก 3, ๐ 3)
> 3: DataSet is risky.
> 4: DataSet is risky.
> 5: DataSet is risky.
> 6: DataSet was skipped.
> 7: DataSet was skipped.
> 8: DataSet was skipped.
> 9: DataSet is incomplete.
> 10: DataSet is incomplete.
> 11: DataSet is incomplete.
> 12: DataSet creates warning.
> 13: DataSet creates warning.
> 14: DataSet creates warning.
> 15: DataSet fails.
> 16: DataSet errors out.
> 17: DataSet errors out.
Report created at 2018-05-21 22:23:12 (UTC), (*8)
Contributing
Contributions are welcome and will be fully credited. Please see the contribution guide for details., (*9)