A pytest plugin for generating Nunit3 test result XML output
Project description
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() 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-integration.xml
continueOnError: true
- task: PublishTestResults@2
inputs:
testResultsFormat: NUnit
testResultsFiles: '**/test-results*.xml'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pytest_nunit-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7988c5716748dab00b39a05bf3dbb1e5a82b6ee4430c41f5e89c78a6185a1812 |
|
MD5 | 6f8b112cc8583333669bc038d45f38eb |
|
BLAKE2b-256 | a9f3b227430ceb8bd722d31da72e5c47187b0a30e64ac5659a1f755b773c2401 |