Skip to main content

A testdox format reporter for pytest

Project description

PyPI https://travis-ci.org/renanivo/pytest-testdox.svg?branch=master https://codecov.io/gh/renanivo/pytest-testdox/branch/master/graph/badge.svg

A TestDox format reporter for pytest

http://i.imgur.com/rJRL4x9.png

Install

pip install pytest-testdox

Usage

Add the parameter –testdox when running pytest. Ex:

pytest --testdox your-tests/

Tip: If you don’t want to type --testdox every time you run pytest, add it to addopts in your ini file. Ex:

# content of pytest.ini
# (or tox.ini or setup.cfg)
[pytest]
addopts = --testdox

Markers

@pytest.mark.describe

Override the class name in the testdox report. Example

# test_demo.py
@pytest.mark.describe('create_file')
class TestCreateFile():

    def test_creates_a_file_in_the_so(self):
        pass

Will produce the output:

test_demo.py

create_file
 [x] creates a file in the so

@pytest.mark.it

Override the test title in the testdox report. Example:

# test_demo.py
class TestCreateFile():

    @pytest.mark.it('Creates a local file in the SO')
    def test_creates_a_file_in_the_so(self):
        pass

Will produce the output:

test_demo.py

Create File
 [x] Creates a local file in the SO

Configuration file options

testdox_format

Specifies TestDox report format, plaintext or utf8 (default: utf8). Ex:

# content of pytest.ini
# (or tox.ini or setup.cfg)
[pytest]
testdox_format = plaintext
$ pytest test_demo.py
============================= test session starts ==============================
platform darwin -- Python 3.5.0, pytest-3.0.7, py-1.4.33, pluggy-0.4.0
rootdir: /private/tmp/demo, inifile: pytest.ini
plugins: testdox-dev
collected 2 items

test_demo.py
Pytest Testdox
 [x] prints a BDD style output to your tests
 [x] lets you focus on the behavior

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-testdox, version 1.2.0
Filename, size File type Python version Upload date Hashes
Filename, size pytest_testdox-1.2.0-py2.py3-none-any.whl (8.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size pytest-testdox-1.2.0.tar.gz (6.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page