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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-testrail-api-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 1dda32ab197618a6e75b0e83aa9150c3d4f7c8bfadaceb0e60e7f3455eaee318
MD5 c25bd114dc67d5eed01ee46cee0ede41
BLAKE2b-256 a6389ec0419e404b1e201a5958a0ebb3473dce8a3dd72b73272739d5a06ef121

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_testrail_api-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae802ba396175f76a403fa87474ad188fd3eb61ea3c6da6aa2a03308974815e4
MD5 69e27c696ce474c657d671eb825cbe8f
BLAKE2b-256 fb307141b8e1cbade5a65b9b455728ad5f0cbab1f93a6c316c300871680b34c1

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