Skip to main content

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

Release files for pytest-testrail-api 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-testrail-api 1.0.1
File Size Uploaded
pytest-testrail-api-1.0.1.tar.gz 72.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-testrail-api 1.0.1
File Interpreter ABI Platform
pytest_testrail_api-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 172.3 kB

Release files / pytest-testrail-api-1.0.1.tar.gz

Download URL pytest-testrail-api-1.0.1.tar.gz
Size 72.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1dda32ab197618a6e75b0e83aa9150c3d4f7c8bfadaceb0e60e7f3455eaee318
BLAKE2b-256 checksum
How to use checksums
a6389ec0419e404b1e201a5958a0ebb3473dce8a3dd72b73272739d5a06ef121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.11

Release files / pytest_testrail_api-1.0.1-py3-none-any.whl

Download URL pytest_testrail_api-1.0.1-py3-none-any.whl
Size 100.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae802ba396175f76a403fa87474ad188fd3eb61ea3c6da6aa2a03308974815e4
BLAKE2b-256 checksum
How to use checksums
fb307141b8e1cbade5a65b9b455728ad5f0cbab1f93a6c316c300871680b34c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.11

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.3.11

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page