No description
This repository has been archived on 2026-04-20. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Python 67.7%
  • Gherkin 31.9%
  • Shell 0.3%
Find a file
navyaannajames 80a676bf05
Some checks failed
ci / tests (push) Failing after 38s
ci / create_dev_release (push) Has been skipped
flake8 fix
2023-08-29 16:56:51 +01:00
.github/workflows python version update in ci.yaml 2023-08-23 15:10:29 +01:00
environment Upgraded Black, Re-added shared-config-storage 2022-05-27 11:41:44 +01:00
tests flake8 fix 2023-08-29 16:56:51 +01:00
tests_resources Api 1.2 regression failures 2023-08-29 15:07:29 +01:00
.gitignore plan updates API 1.2 2023-08-23 10:33:22 +01:00
config.py Removed the unused data, files 2023-03-16 17:32:56 +00:00
Dockerfile python version update in dockerfile 2023-08-24 14:28:24 +01:00
Pipfile python version update to 3.11 2023-08-23 08:46:20 +01:00
Pipfile.lock python version update to 3.11 2023-08-23 08:46:20 +01:00
pytest.ini Revert "Merge branch 'fix_regression' into 'develop'" 2021-11-16 18:14:53 +00:00
README.md readme_changed 2022-01-10 17:24:32 +00:00
report-render.sh generalise script 2023-04-11 13:11:45 +01:00
settings.py Revert some of the changes from #157 2023-07-19 10:34:48 +01:00
tox.ini Added basic config for flake8 2020-07-27 20:51:50 +01:00

BinkAPI-TestAutomation-pytest-bdd

  • This is a framework design in Python for the test automation of Bink's APIs.
  • The framework has been designed using the Pytest-BDD plugin to implement the BDD approach.
  • Modules of the framework are designed in such a way that it can be reused by all merchants in any channels
  • This framework will provide a Regression testing suite for all available API endpoints, and also serve for Sanity, Smoke testing & In- Sprint testing for all channels & merchants.

Set Up

This project requires an up-to-date version of Python 3 (Currently using Python 3.8) It also uses pipenv to manage packages.

To set up this project on your local machine:

1. Clone it from this GitLab repository [QA GitHub](https://github.com/binkhq/bink-api-automation-pytest-bdd)
2. Run `pipenv install` from the project's root directory.
3. * Optional Step : For Django Web UI tests, install the appropriate browser and WebDriver executable
    * Current Django tests use Chrome and
     [chromedriver](https://chromedriver.chromium.org/downloads) 
4. Install Azure CLI and login to Azure for Key Vault access
    `brew install azure-cli`
    `az login`

Running Tests

1. Test Execution:
    - Use `pytest` command 
    - Use markers '-m' to fileter tests by BDD tags
    - Pass variables '--env' and '--channel' to set current environment and channel
    - The default environment is dev and default channel is bink
  
2. A few sample execution commands:
    - pytest -m "add" --env staging --channel barclays : Execute Add Journey for all merchants in staging-barclays 
    - pytest -m "add" --env staging                    : Execute Add Journey for all merchants in staging-bink
    - pytest -m "add and iceland" --env staging        : Execute Add Journey for Iceland in staging-bink
    - pytest -m "add and enrol"                        : Execute Add & Enrol Journey for all merchants in dev-bink 

3. Commands used for nighly regression in bink in staging
    - pytest -m "bink_regression" --env staging 
   Commands used for nighly regression in bink in staging
    - pytest -m "bmb_regression" --env staging --channel barclays 

Running Transaction Matching Scenario

1. Required .env file in local
    -get blob_dsn variable from azure
2. Once the varaible setup then Run Trasaction Matching sceanrio

Work with database query

Run command to hermes and harmonia to work locally
export HERMES_DATABASE_URI=$(echo $(kubectl get secret azure-pgfs -o json | jq -r .data.common_hermes | base64 --decode) | sed s/bink-uksouth-staging\.postgres\.database\.azure\.com/127\.0\.0\.1/)
export HARMONIA_DATABASE_URI=$(echo $(kubectl get secret azure-pgfs -o json | jq -r .data.common_harmonia | base64 --decode) | sed s/bink-uksouth-staging\.postgres\.database\.azure\.com/127\.0\.0\.1/)

Running Allure Reports

Ensure you have the following installed:

  • allure-pytest-bdd==2.943 or (latest stable version)
  • allure-python-commons==2.9.43 or (latest stable version)

Please ensure you are in the root directory before running any reports to avoid path issues.

Step 1 - Create Test Run with Allure:

In the terminal, enter test command - Example Test Command Run:

1. Commands used for nighly regression in bink in staging
- pytest -m "bink_regression" --env staging --alluredir=<new_destination_folder_name>
 Commands used for nighly regression in bink in staging
- pytest -m "bmb_regression" --env staging --channel barclays  --alluredir=<new_destination_folder_name> 

Step 2 - Spin up the Allure results in the Browser

In the terminal, enter:

  • allure serve <new_destination_folder_name>

This should automatically collect the generated results from the destination folder, then open a browser window displaying the allure report.

IMPORTANT if you have issues with using the allure command e.g. 'allure commnad not found' - you may need do brew install allure. If issues persist you may need to check your path, project interpreter.

Running inside Kubernetes

The project requires the following Environment Variables to function correctly:

  • NAME - The Human Readable Name which should be sent with reports
    • Example: Dev - Barclays
  • TEAMS_WEBHOOK - The Location to Alert to on Success/Failure
    • "Solutions Delivery/Alerts - Production" - https://outlook.office.com/webhook/bf220ac8-d509-474f-a568-148982784d19@a6e2367a-92ea-4e5a-b565-723830bcc095/IncomingWebhook/7ae4116d366e4e5a92a65d9135a0664d/48aca6b1-4d56-4a15-bc92-8aa9d97300df
    • "Solutions Delivery/Alerts - QA" - https://outlook.office.com/webhook/bf220ac8-d509-474f-a568-148982784d19@a6e2367a-92ea-4e5a-b565-723830bcc095/IncomingWebhook/0856493823a1484b9adfa37c942d2da4/48aca6b1-4d56-4a15-bc92-8aa9d97300df
    • "Solutions Delivery/QA" - https://outlook.office.com/webhook/bf220ac8-d509-474f-a568-148982784d19@a6e2367a-92ea-4e5a-b565-723830bcc095/IncomingWebhook/5d25733db5994811b6ee4049ef74713e/48aca6b1-4d56-4a15-bc92-8aa9d97300df
  • SCHEDULE - Uses Cron Syntax, use crontab guru for help
    • Run at 22:05: 5 22 * * *
    • Run at 22:00 on Mondays: 0 22 * * 1
  • COMMAND - The command to run
    • Barclays dev run: pytest --html report.html --self-contained-html -s -m dev --channel barclays
    • Bink dev run: pytest --html report.html --self-contained-html -s -m dev --channel bink --env dev
  • ALERT_ON_SUCCESS - if run is successful, send report to Webhook
    • Default: True
  • ALERT_ON_FAILURE - if run fails, send report to Webhook
    • Default: True