No project description provided
Project description
Junit-Report
This Python package adds more control to your tests by decorating your functions and pytest fixtures and exporting them as JUnit xml.
Table of contents
Installation
pip install junit-report
Usage
import pytest
from junit_report import JunitTestSuite, JunitTestCase, JunitFixtureTestCase
class TestSomeThing:
@pytest.fixture
@JunitFixtureTestCase()
def my_fixture(self):
pass
@JunitTestCase()
def my_first_test_case(self):
pass
@JunitTestCase()
def my_second_test_case(self, name: str):
raise ValueError(f"Invalid name {name}")
@JunitTestSuite()
def test_suite(self, my_fixture):
self.my_first_test_case()
self.my_second_test_case("John")
Output
<?xml version="1.0" ?>
<?xml version="1.0" ?>
<testsuites disabled="0" errors="0" failures="1" tests="3" time="8.893013000488281e-05">
<testsuite disabled="0" errors="0" failures="1" name="TestSomeThing_test_suite" skipped="0" tests="3" time="8.893013000488281e-05">
<testcase name="my_fixture" time="0.000010" classname="TestSomeThing" class="fixture"/>
<testcase name="my_first_test_case" time="0.000007" classname="TestSomeThing" class="function"/>
<testcase name="my_second_test_case" time="0.000071" classname="TestSomeThing" class="function">
<failure type="ValueError" message="Invalid name John">Traceback ... ValueError(f"Invalid name {name}") ValueError: Invalid name John</failure>
</testcase>
</testsuite>
</testsuites>
OS parameters used for configuration
Variable | Description |
---|---|
JUNIT_REPORT_DIR | Reports directory where the reports will be extracted. If it does not exist - create it. |
FAIL_ON_MISSING_SUITE | Decide whether the test will throw a SuiteNotExistError exception if a JunitTestCase does not have a suite parent. Available values: 'True', 'true', 'y', 'Y', '1' |
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
junit-report-0.1.15.tar.gz
(8.0 kB
view hashes)
Built Distribution
Close
Hashes for junit_report-0.1.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23a0c8cae69e9ebdf2e3806534c9e6796d46b1ff90a93feaf09470e48296f8b0 |
|
MD5 | e2d57b97cc2bb19d2456958355f3129b |
|
BLAKE2b-256 | 0b185d8edf3d7c764244798572107e53d18be33800590e9b5bbb045f777374c0 |