Skip to main content

TestRail Api Python Client

Project description

3D4Medical Automated Tests

This is repository for 3D4Medical web sites, api and hybrid application automated tests. It contains different folders for different kind of tests:

  • Web - web sites tests
  • Rest - api tests
  • App - hybrid application tests

Features!

  • Running automated Rest tests
  • Running automated Web tests
  • Running automated tests for hybrid App
  • Allure Report generatin
  • Cucumber Report generation
  • Export test results in TestRail
  • TBD

You can also:

  • Export BDD test scenarios in TestRail

Tech

Framework uses a number of open source projects to work properly:

Installation

Each test framework has the requirements.txt file which contains all required packages for running the tests. For installing the packages run the following command:

pip install -r requirements.txt

For TestRail integration one more package is required. It can be installed like:

pip install git+https://github.com/yeromina/pytest-testrail-client.git@master --upgrade

There is an issue with creating a saucelabs session with default urllib3. I forked it and increased the default retry count. To install it run:

pip install git+https://github.com/yeromina/urllib3.git@1.26.x --upgrade

Running tests

All frameworks use the 'pytest' as test runner.

For runnings all tests just run:

$ pytest

For running tests from specific package run:

$ pytest tests/package_name

For running tests from specific module run:

$ pytest module_name.py

More details about pytest on it's official site For writing tests in BDD format the pytest-bdd is used The command line that runs tests and generate all kind of reports looks like the following:

pytest --cucumberjson=report/cucumber-report.json --cucumberjson-expanded --alluredir=target/allure-results --clean-alluredir  -v --pytest-testrail-export-test-results --pytest-testrail-test-plan-id 193 --pytest-testrail-test-configuration-name Chrome

Reporting

All frameworks can generate different kind of reports: Allure Report, Cucumber Report and export test results in TestRail

Allure

For generating allure report add the '--alluredir=target/allure-results --clean-alluredir' in the command line:

$ pytest --alluredir=target/allure-results --clean-alluredir

this will create the allure-results folder with results. After that you can generate report locally like

$ allure serve

or use Allure Jenkins Plugin for publishing report in Jenkins

Cucumber

For generating cucumber report add the '--cucumberjson=report/cucumber-report.json --cucumberjson-expanded' in the command line:

$ pytest --cucumberjson=report/cucumber-report.json --cucumberjson-expanded

this will create the cucumber-report.json. After that you can publish it in Jenkins with Cucumber Reports plugin

TestRail

For exporting tests in TestRail run:

$ pytest -v --pytest-testrail-export-test-cases --pytest-testrail-feature-files-relative-path "features"

TestRail Integration

TestRail configuration data can be provided in three different ways:

  • By using Environment Variables:

Please set your credentials to system variables. Manual at the Link

TESTRAIL_URL=[URL of TestRail instance]
TESTRAIL_EMAIL= [email [of user to be used for communication]]
TESTRAIL_KEY=key [of user to be used for communication]
TESTRAIL_PROJECT_ID=[project id to which the data is sent]
JIRA_PROJECT_KEY=[Jira project key for integration with Jira]
  • By using command line arguments:
--pytest-testrail-client True / False
--testrail-url [URL of TestRail instance]
--testrail-email [email [of user to be used for communication]]
--testrail-key key [of user to be used for communication]
--testrail-project-id [project id to which the data is sent]
--jira-project-key [Jira project key for integration with Jira]
  • By using pytest.ini file:
[pytest-testrail-client]
pytest-testrail-client = True / False
testrail-url = [URL of TestRail instance]
testrail-email = [email [of user to be used for communication]]
testrail-key = key [of user to be used for communication]
testrail-project-id = [project id to which the data is sent]
jira-project-key = [Jira project key for integration with Jira]

For exporting Test Cases in TestRail use:

pytest -v --pytest-testrail-export-test-cases --pytest-testrail-feature-files-relative-path "features"

For exporting Test Results in TestRail use:

python -m pytest ./tests -v --pytest-testrail-export-test-results --pytest-testrail-test-plan-id [ID of Plan to be used] --pytest-testrail-test-configuration-name [str: Id of Test Configuration to be used]

GIT Interaction

Pre-commit

####We are using the pre-commit feature in our project. This app includes 2 automate formatters:

  • Black
  • iSort

Installation:

  brew install isort black pre-commit
  cd /path/to/project/
  pre-commit install

After that before every push PyCharm will be applying the pre-commit feature to the updated files.

Instruction from the Backend team

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-testrail-api-1.0.0.tar.gz (72.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_testrail_api-1.0.0-py3-none-any.whl (100.0 kB view details)

Uploaded Python 3

File details

Details for the file pytest-testrail-api-1.0.0.tar.gz.

File metadata

  • Download URL: pytest-testrail-api-1.0.0.tar.gz
  • Upload date:
  • Size: 72.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for pytest-testrail-api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 96cb8e36a28d37653d013f40d944b172e24cca37afe5976b23c55d4148a66135
MD5 0e79937cb4d32ca21f14198d6a7afd9c
BLAKE2b-256 b56f0acd414de7e7389c57ef8bd673f0ee12a1c7ce739ca541324b9c37bb210d

See more details on using hashes here.

File details

Details for the file pytest_testrail_api-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_testrail_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc466a5f2303146aa16912b124310702d751b8128ce04a16fcbfd0bc522035d0
MD5 7a225d734fef77590d29cd8ab71abd6c
BLAKE2b-256 feec137359ba0bedd322ef47a13c89971dc2855aae69aea158b8229844e23e35

See more details on using hashes here.

Supported by

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