Azure DevOps Test Case reporting for pytest tests
Project description
Make Pytest integrate into Microsoft Azure Test Plans and Pipelines.
Just run pytest with this plugin and see your test results connected to your Test Plan. You do need to mark the tests with the suite id and test case for this to work.
Overview
This pytest plugin will create an Azure Test Run and append TestResults to the test run as the tests are executed on a pipeline execution of a pytest test run.
This plugin is not ment to work with other reporting plugins like pytest-nunit and pytest-ads-testplan. Using this test with those plugins will cause duplicate test results to be reported on the pipeline.
Unlike the pytest-azurepipeline plugin, this plugin does not use NUnit to generate a report, then process the report. Instead, it upates the running tests as they complete. Therefore, a long running test can have it’s progress tracked in Azure Test Runs
Limitations
The tests must all be under the same TestPlan (defined by the plan id)
Each test that will be reported needs to define an ADS suite id and an ADS Test case id (test case work item).
The plugin will scan the test suite for the TestCase, and if found, will add test results for the test point id that matches the test case id defined in the test.
Example
Assuming your org is “TestOrg” and your Project is “TestProject” and your Test Plan ID is 123456
Source code for test case with markings for an ADS test case. Note the suite_id and test_case id are required, the revision is optional and defaults to 1. It is possible to have multiple test cases and test suites in a single test. In such a case, the test results will be repeated for each suite_id and test case. If the test case is not in the suite, then the results will not be reported.
@pytest.mark.regress_nightly
@pytest.mark.regress_smoke
@pytest.mark.suite_id("112233")
@pytest.mark.test_case("445556")
@pytest.mark.revision("1")
def test_ads_integration_fail(logger):
logger.info("This is a test of regression fail")
assert False
From the ADS pipeline, execute this command (bash script pipeline step)
pytest -m regress_nightly –adsinfo=TestOrg,TestProject,123456
The SuiteID must contain a test point with a matching test case, as a test point, in it. The plugin will search the Suite for the work item, and if found, extract it’s description and create a test result for the item.
Tests that are in error (no test case test point in suite) will not be reported
Run Tests outside of azure pipelines
You can use the plugin outside of an Azure Pipeline, however you would need to use your ADS personal access token (normally provided in the pipeline environment)
export SYSTEM_ACCESSTOKEN={token}
pytest -m regress_nightly --adsinfo=TestOrg,TestProject,123456
This will use your credentials instead of pipeline credentials and generate a test run that is not attached to a pipeline build.
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
File details
Details for the file pytest-ads-testplan-0.0.4.tar.gz
.
File metadata
- Download URL: pytest-ads-testplan-0.0.4.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/2.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f80c4d40e10d4f5c1351c6ac64b2dc474aa5ef4208d58671837faf5570be6169 |
|
MD5 | 47a6c00c104c3978f2f2cad3e2a37ebd |
|
BLAKE2b-256 | a72294fcd68b58ee3f9b8bd2bd758a7b03cdb1633852ce5aae28630cd0101b05 |