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-0.3.11.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-0.3.11-py3-none-any.whl (100.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-testrail-api-0.3.11.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-0.3.11.tar.gz
Algorithm Hash digest
SHA256 8858fad37769f03995a7bfcc3b5883b022432ac1b8e4e1300f010c02c618ece8
MD5 126487ffc2df87972a58e62e92e42050
BLAKE2b-256 9f5eb208a977dc8d8aa6664d03af5af619064201bbe0dd569d7f368a0cae98fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_testrail_api-0.3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 4a7b0e52ce66fb51db78d4f6160167bca0032c82a0b2051f86f51ab1283fc75e
MD5 aee566f61a09f4ac46e7d6045312324b
BLAKE2b-256 bcfed6893b623f3a4831f2533e792f3eb8f2d08c222bc23c67e64f3bc6047985

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