Skip to main content

A pytest plugin for generating NUnit3 test result XML output

Project description

Build status PyPI version Python versions PyPI download month

A pytest plugin for generating Nunit3 test result XML output

This plugin is an early beta release!

Configuration

–nunit-xml

Use --nunit-xml=output.xml to create an Nunit3-compatible file called output.xml

Argument takes a path to the output file, either relative, or absolute.

Fixtures

The following fixtures are made available by this plugin.

record_nunit_property

Calling record_nunit_property(key: str, value: str) will result in Property tags being added to the test-case for the related node.

def test_basic(record_nunit_property):
    record_nunit_property("test", "value")
    assert 1 == 1

add_nunit_attachment

Add an attachment to a node test-case by calling the add_nunit_attachment(path: str, description: str) function with the filepath and a description.

def test_attachment(add_nunit_attachment):
    pth = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'fixture.gif')
    add_nunit_attachment(path, "peanut butter jelly time")
    assert 1 == 1

Usage with Azure Pipelines

Add the following steps to your build job to publish the results to Azure Pipelines:

- script: "pip install pytest-nunit"

- script: |
    python -m pytest tests -v --nunit-xml=test-results.xml
  continueOnError: true

- task: PublishTestResults@2
  inputs:
    testResultsFormat: NUnit
    testResultsFiles: '**/test-results.xml'

Skipped Tests

Skipped tests will have the reason attribute (if provided) included in the results.

https://github.com/tonybaloney/pytest-nunit/raw/master/docs/source/_static/screen_skips.png

Attachments

Using the add_nunit_attachment fixture will render any attachments in the “attachments” tab inside the Tests console:

https://github.com/tonybaloney/pytest-nunit/raw/master/docs/source/_static/screen_attachments.png

Failures and xfails

Any failed tests, whether as xpass or xfail, will have the error output and comparison, as well as the failing line in the stack trace.

https://github.com/tonybaloney/pytest-nunit/raw/master/docs/source/_static/screen_fails.png

Project details


Download files

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

Source Distribution

pytest-nunit-0.2.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distributions

pytest_nunit-0.2.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

pytest_nunit-0.2.1-py2-none-any.whl (11.3 kB view details)

Uploaded Python 2

File details

Details for the file pytest-nunit-0.2.1.tar.gz.

File metadata

  • Download URL: pytest-nunit-0.2.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for pytest-nunit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 94cc487c437fae6a43c128d66c216e0b965fd5762ec80270eb65ae7b7f29d8dd
MD5 b8c1f90760301f0a68cf090cb1f3326f
BLAKE2b-256 9829fec20d90e1b158a3a617f5af3d54dd3738396f20e5487fbe4f8a8ee59ea8

See more details on using hashes here.

File details

Details for the file pytest_nunit-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pytest_nunit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for pytest_nunit-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1304a31005f9f577877fb6ee578d46a094f80c5ae62a8bd1de1567377c208744
MD5 f745841af7b2db88c075163e7bf3e659
BLAKE2b-256 ce0b9554f1034e8100a665f9f7947a65a04239e92157f07b014c7bda368037de

See more details on using hashes here.

File details

Details for the file pytest_nunit-0.2.1-py2-none-any.whl.

File metadata

  • Download URL: pytest_nunit-0.2.1-py2-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for pytest_nunit-0.2.1-py2-none-any.whl
Algorithm Hash digest
SHA256 e8690299e4d21ec9ee89f85b3b4303b23bace3441544b86a933077e944cea8c5
MD5 196347bb919918f99fd737d609cd89fa
BLAKE2b-256 2ec9a3d8f1f2ac44c4da5c1e8d508d1fdea1d790ea9bce3c8a410191b1d7dd32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page