Skip to main content

Package for creating and managing objects from the TestRail API

Project description

TestRail Data Model

Python package PyPI Downloads PyPI - Python Version PyPI - Implementation License Coverage Status

This package provides an object-oriented representation of TestRail data using Python data classes. This object structure facilitates the development of tools which programmatically interact with a TestRail service.

This wraps the tolstislon/testrail-api project, which in turn wraps the official TestRail API spec.

Example

from testrail_api import TestRailAPI

from testrail_data_model.builder import TestRailAPIObjectBuilder
from testrail_data_model.adapter import TestRailAPIAdapter
from testrail_data_model.model import TestRailSection, TestRailCase, TestRailSuite

# From testrail-api client library
api_client = TestRailAPI(url="https://testrail-instance.com", email="email@email.org", password="password")

# Performs API requests and tracks stats
adapter = TestRailAPIAdapter(api_client=api_client)

# For building the TestRail dataclass object hierarchies (e.g. TestRailSuite)
builder = TestRailAPIObjectBuilder(adapter=adapter)

# Construct a TestRailSuite object linked to its associated TestRailSection and TestRailCase objects
suite: TestRailSuite = builder.build_suite(project_id=1, suite_id=1)

# Display the TestRailSuite object structure
for section_id, section in suite.sections.items():
   assert isinstance(section, TestRailSection)
   print("Section", section_id, section.path)
   for case_id, case in section.cases.items():
       assert isinstance(case, TestRailCase)
       print("Case", case_id, case.title)

# Show the number of API requests made
print(adapter.stats)

Authors

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

testrail-data-model-0.2.0.tar.gz (17.5 kB view hashes)

Uploaded Source

Built Distribution

testrail_data_model-0.2.0-py3-none-any.whl (20.7 kB view hashes)

Uploaded Python 3

Supported by

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