open-southeners / phpunit-todo-markdown-printer
Print your failed tests as a to do list in Markdown format
1.1.0
2022-12-21 13:30 UTC
Requires
- php: >=7.3
- phpunit/phpunit: ^8.0|^9.0
Requires (Dev)
- phpstan/phpstan: ^1.0
README
Print your failed tests as a to do list in Markdown format
Status
Getting started
composer require open-southeners/phpunit-todo-markdown-printer
Configuration
Add the following to your phpunit.xml
:
<listeners> <listener class="OpenSoutheners\PHPUnitTodoMarkdownPrinter\Printer"> <arguments> <string name="out">todo_failed_tests.md</string> <boolean name="reportRiskyTests">true</boolean> <boolean name="reportIncompleteTests">true</boolean> <boolean name="reportSkippedTests">true</boolean> </arguments> </listener> </listeners>
And that's all you need to do, from now on your todo_failed_tests.md
will have the markdown similar as the one below.
Example output
Code
# Failed tests A summary of tests that failed. **Total of 1 failed within 1 files**. ## CommentControllerTest - [ ] test_that_fails_mostly ``` Call to a member function getKey() on null at /Users/my_user/Projects/my_project/app/Notifications/Notification.php:34 ---------- #0 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestCase.php(904): PHPUnit\Framework\TestResult->run(Object(Tests\Integration\Http\Controllers\Api\CommentControllerTest)) #1 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult)) #2 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult)) #3 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult)) #4 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(661): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult)) #5 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/Command.php(144): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\Framework\TestSuite), Array, Array, true) #6 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/Command.php(97): PHPUnit\TextUI\Command->run(Array, true) #7 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/phpunit(98): PHPUnit\TextUI\Command::main() #8 {main} ```
Preview
Failed tests
A summary of tests that failed. Total of 1 failed within 1 files.
CommentControllerTest
- test_that_fails_mostly
Call to a member function getKey() on null
at /Users/my_user/Projects/my_project/app/Notifications/Notification.php:34
----------
#0 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestCase.php(904): PHPUnit\Framework\TestResult->run(Object(Tests\Integration\Http\Controllers\Api\CommentControllerTest))
#1 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#2 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#3 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/Framework/TestSuite.php(675): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#4 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(661): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#5 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/Command.php(144): PHPUnit\TextUI\TestRunner->run(Object(PHPUnit\Framework\TestSuite), Array, Array, true)
#6 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/src/TextUI/Command.php(97): PHPUnit\TextUI\Command->run(Array, true)
#7 /Users/my_user/Projects/my_project/vendor/phpunit/phpunit/phpunit(98): PHPUnit\TextUI\Command::main()
#8 {main}