2017 © Pedro Pelรกez
 

library phpunit-testdox-markdown

A PHPUnit test listener that creates a testdox markdown file with grouped dataset output

image

hollodotme/phpunit-testdox-markdown

A PHPUnit test listener that creates a testdox markdown file with grouped dataset output

  • Tuesday, May 22, 2018
  • by hollodotme
  • Repository
  • 1 Watchers
  • 5 Stars
  • 96 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 380 % Grown

The README.md

Latest Stable Version Total Downloads, (*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)

The Versions

22/05 2018

dev-master

9999999-dev

A PHPUnit test listener that creates a testdox markdown file with grouped dataset output

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

21/05 2018

v1.0.0

1.0.0.0

A PHPUnit test listener that creates a testdox markdown file with grouped dataset output

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires